elf: Fix statically-linked executable base address

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
elf: Fix permissions for static executables

A statically linked "hello, world" C++ application will page fault on
its stack because there's a PT_RELRO segment type present that sets the
stack page to read-only...

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
x64: Fix ELF initial stack state

Fix ELF initial stack state as per Figure 3.9 ("Initial Process Stack")
in the x86-64 ABI specification. This is needed for statically linked
executables.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
x64: Make DUMMY_HANDLER less dumb

It's nice to at least see the RIP where the invalid opcode exception
happened at...

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
x64: 'syscall' instruction support

Enable "fast system calls" via the 'syscall' instruction on OSv. The
instruction is used by Go programs on Linux/x86-64 for system calls.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
linux: Make syscall() return ENOSYS if syscall not supported

Make the syscall() function return ENOSYS if a syscall number is not
supported. Keep a debug printout, though, as our system call coverage is
very low.

This is needed for statically linked programs to limp along even if a
syscall isn't supported.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
linux: Fix futex() command bitmask

The "op" argument passed to futex() also include flags so we need to
mask the command bits.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
linux: Wire up uname system call

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc/mman: Add brk() stub

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
linux: Wire up brk system call

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>