The userland test stubs run as freestanding multiboot modules: the
kernel exec path hands them control at _start with argc/argv/envp
laid out sysv-style on the stack, and they call c_start(sp) to find
their arguments. The i386 and x86_64 arms already implement this;
add the aarch64 equivalent (mov x0, sp; bl c_start) so test modules
can be cross-compiled with aarch64-unknown-none-elf-gcc and entered
by Bugaev's pcb/exec path.
bl rather than a tail-call b keeps the saved-LR contract intact in
case anything unwinds out of the userland prelude.
---
tests/start.S | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tests/start.S b/tests/start.S
index 15970fb9..71e055ab 100644
--- a/tests/start.S
+++ b/tests/start.S
@@ -26,5 +26,15 @@ _start:
movq %rsp,%rdi
callq c_start
#endif /* __x86_64__ */
+#ifdef __aarch64__
+ /*
+ * Kernel hands us argc/argv/envp on the stack (sysv-style);
+ * pass sp through x0 as c_start's first argument (per AAPCS).
+ * bl rather than a tail-call keeps the saved-LR contract
+ * intact in case anything unwinds.
+ */
+ mov x0, sp
+ bl c_start
+#endif /* __aarch64__ */
.section .note.GNU-stack,"",%progbits
--
2.54.0