aarch64 loader passes os (#1042)

* Reorder Launch arguments, pass aarch64 os

Third and fourth arguments are now identical between cosmo and Launch.
By passing sp as argument 4, we save a bit of register juggling.

Fourth argument (os) is now always passed by the loader on aarch64. It
is not yet processed by cosmo. Pushing this change separately, as the
cosmo side turns out to be somewhat more involved.

* cosmo2 receives os from loader

FreeBSD aarch64 now traps early rather than pretending to be Linux.
o/aarch64/examples/env.com still works on Linux and Xnu.
This commit is contained in:
Jōshin 2023-12-31 09:42:36 -05:00 committed by GitHub
parent d8ad34686a
commit 14fe83facd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 20 deletions

View file

@ -32,15 +32,15 @@
// @param rdi is passed through as-is
// @param rsi is address of entrypoint (becomes zero)
// @param rdx is passed through as-is
// @param rcx is stack pointer (becomes r8)
// @param rcx is passed through as-is
// @param r8 is stack pointer (becomes zero)
// @noreturn
Launch:
#ifdef __aarch64__
mov x16,x1
mov sp,x3
mov sp,x4
mov x1,0
mov x3,x4
mov x4,0
mov x5,0
mov x6,0
@ -70,8 +70,7 @@ Launch:
#else
mov %rcx,%rsp
mov %r8,%rcx
mov %r8,%rsp
xor %r8d,%r8d
xor %r9d,%r9d
xor %r10d,%r10d