base-linux: 64-bit ARM support

This patch adds support for running Genode/Linux on the AARCH64
architecture.

- The kernel-agnostic startup code (crt0) had to be extended to
  capture the initial stack pointer, which the Linux kernel uses
  to pass the process environment. This is in line with the
  existing startup code for x86_32 and x86_64.

- The link order of the host libraries linked to lx_hybrid
  programs had to be adjusted such that libgcc appears at last
  because the other libraries depend on symbols provided by
  libgcc.

- When using AARCH64 Linux as host, one can execute run scripts
  via 'make run/<script> KERNEL=linux BOARD=linux' now.

Issue #4136
This commit is contained in:
Norman Feske
2021-05-05 19:20:37 +02:00
committed by Christian Helmuth
parent 718f44ae5b
commit 2f9d430c00
21 changed files with 126 additions and 8 deletions

View File

@ -60,6 +60,11 @@ inline int lx_open(char const *pathname, int flags, mode_t mode = 0)
inline int lx_stat_size(char const *path, Genode::uint64_t &out_size)
{
#ifdef __aarch64__
struct statx buf { };
int result = lx_syscall(SYS_statx, AT_FDCWD, path, 0, STATX_SIZE, &buf);
out_size = buf.stx_size;
#else
#ifdef _LP64
struct stat buf { };
int result = lx_syscall(SYS_stat, path, &buf);
@ -68,6 +73,7 @@ inline int lx_stat_size(char const *path, Genode::uint64_t &out_size)
struct stat64 buf { };
int result = lx_syscall(SYS_stat64, path, &buf);
out_size = buf.st_size;
#endif
#endif
return result;
}