libc: add minimal support for AArch64

this contains still prototyped code, which if reached either
hangs (setjmp, longjmp), aborts (all that requires mmu::),
or implements differently (allocating with malloc instead of mmap)
This is enough libc AArch64 support for reaching the end of premain.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
bsd/aarch64: improve asm for atomic and endian

use %wn when referring to the non-extended register n,
and %n when referring to the extended register n,
emit the right memory barrier instructions, get the
semantics of atomic_store_rel hopefully right.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
bsd: add stubs for AArch64

virt_to_phys just returns the virtual address again
for AArch64 for now, while mmu_unmap will abort.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
arch.hh: introduce arch::halt_no_interrupts

rename processor::halt_no_interrupts to cli_hlt, which
logically matches existing processor::sti_hlt.

Make use of arch::halt_no_interrupts in core/power.cc,
enclose x64-specific code in ifdefs, as well as putting
code on AArch64.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
arch/aarch64: first implementation

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
drivers: move debug-console to arch-specific dir

Signed-off-by: Jani Kokkonen <jani.kokkonen@huawei.com>
Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
include/api/aarch64: first implementation

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
debug: add debug_early functionality

the functions debug_early, debug_early_u64 and
debug_early_entry can be used very early, before premain.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
drivers/console: allowing building for AArch64

stub console_init for AArch64.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
include/osv/trace.hh: ifdef x64-specific code

protect x64 machine code in #ifdef __x86_64__

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
elf: ifdef x64-specific code, add AArch64 dynamic rels

implementation includes only for the few rels that are actually
encountered during elf::get_init().

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
fs: add minimal stubs for AArch64

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
include: remove unused include file

include/api/x64/atomic.h is not used anywhere.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
core: add AArch64 stubs for mempool and mmio.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
core: add AArch64 stubs for sched.cc

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
loader, runtime: add stubs for AArch64

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
build.mk: enable first AArch64 stubbed support

This should build and reach end of premain.

See PORTING for some initial build instructions.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
aarch64: install simple vectors and get the cmdline

get the command line and elf header start, then try to
stay clear of apparent random limitations during boot
early stage with the model, and set up vectors as soon
as possible, to enable some minimal post-mortem info.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Merge branch 'aarch64-next' of https://github.com/hw-claudio/osv_aarch64

"This is v3 of the patch series that enables first stubbed support
for AArch64."

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>

Conflicts:
	bsd/porting/mmu.cc
	build.mk
	fs/vfs/vfs_fops.cc