Skip to content

XNU as a loadable kernel module inside Linux (macOS personality for arm64 Linux)

C

tools/init: align sp to 16 at entry (the parent's wait4 status load took an SP alignment fault, SIGBUS)

Heyang Zhou8bf7f1d12eb0
diff --git a/tools/init/start.s b/tools/init/start.s
index dc6bf2c..fec1db9 100644
--- a/tools/init/start.s
+++ b/tools/init/start.s
@@ -7,6 +7,8 @@
.globl _start
.p2align 2
_start:
+ mov x9, sp // the kernel hands over sp at the Mach-O stack's argc slot (8-aligned); EL0 checks SP alignment
+ and sp, x9, #~15
adr x0, Lpath
mov x1, #1 // O_WRONLY
mov x2, #0