clock_gettime(CLOCK_PROCESS_CPUTIME_ID) - subtract idle time

clock_gettime(CLOCK_PROCESS_CPUTIME_ID) currently returns the full wall time
since boot, but we are expected to remove, at least, idle time, so this patch
does it.

As explained in comments, the accuracy of this implementation is
limited to the length of idle time slices (while a cpu is inside the
idle time slice, we don't know that it is, and believe it is busy);
This currently cannot be more than 0.1 seconds but on a busy system
is usually much shorter. I think this is fine (certainly better than what
we had until now), but if it bothers anyone we can fix it in the future).

Reviewed-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
runtime: Implement times()

Java application calls os.getProcessCpuTime() which in turn calls times() to
get process cpu time.

With this patch, solr-benchmark[1] reports Average CPU Load correctly. This
patch also makes jvisualvm get the correct cpu usage.

[1] https://hg.codespot.com/a/apache-extras.org/luceneutil

Fixes #321

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Asias He <asias@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
vfs: implement futimesat()

Fixes #330

OpenJDK uses futimesat() in some places.
dirfd must point to a directory if pathname is not absolute.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Jaspal Singh Dhillon <jaspal.iiith@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
mempool, trace: use single tracepoint to track memory allocations

Because of #295 (per-CPU tracepoint buffers) some samples may be lost what
quite effectively ruins attempts to track the lifetime of allocations.
Since the ability to show which allocations are still unfreed is not crucial
the simplest solution is be not to use memory_free tracepoints and put all
needed information in memory_malloc_{large, mempool}.

Signed-off-by: Pawel Dziepak <pdziepak@quarnos.org>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
aarch64: update to latest Mach-Virt addresses

until we have the ACPI ported, we have to follow mach-virt.
Its addresses for the GIC have been recently changed.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
elf: move arch-specific relocation enums to arch

add a per-arch jump slot define for pltgot relocation,
add basic rela relocations for aarch64.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
elf: aarch64: relocate pltgot

this adds basic support for AArch64
object::relocate_pltgot()
object::resolve_pltgot()

including support for lazy binding.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
elf: implement R_AARCH64_ABS64, and workaround for _Unwind_Resume

implement R_AARCH64_ABS64 relocation and add a workaround
for the _Unwind_Resume symbol.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
build.mk: aarch64: add --nomount to cmdline

don't try to mount zfs in our first simplified loader image.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
XXX add tests/tst-hello.so to the bootfs.manifest.skel

could find no way to do it better.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>