XNU as a loadable kernel module inside Linux (macOS personality for arm64 Linux)
C
Commits on main
tools/dev/kcdis.py: disassemble a range of a fileset KC (debugging aid)
b5ca4f0 Heyang Zhou committed 8 days ago
FKI: foreign non-abort kernel exceptions (FPAC, undefined, BTI: die()) go to the fault handler too, so XNU's end the run instead of oopsing the host task (an AMFI FPAC killed insmod and hung the VM)
9d4cc39 Heyang Zhou committed 8 days ago
XNU patch: hosted IOPlatformExpert::callPlatformFunction waits 2 s for a function's provider, then reports it unsupported (AMFI's AKS_services blocked launchd's sysctl forever waiting for AppleKeyStore)
9bd7534 Heyang Zhou committed 8 days ago
Debug: log each sysctl MIB and the calling thread's kernel stack
9817248 Heyang Zhou committed 8 days ago
FKI: the parts that let Linux run (idle, host file I/O) move to a Linux-shaped stack of their own when called on a foreign stack (Linux's entry check panicked on an XNU stack with sp bit 14 set); xnu.ko notes such upcalls
27bc6e3 Heyang Zhou committed 8 days ago
vm-sysdisk-launchd.sh: macOS's launchd as PID 1 on the system disk (or the test init back)
6fb8f10 Heyang Zhou committed 8 days ago
Test init: the child runs Apple's /bin/sh -c (echo, uname, ls, a loop), falling back to /bin/echo; vm-sysdisk-init.sh updates the init in the system disk
b32220c Heyang Zhou committed 8 days ago
README: M2e done, M3 status (EL0 path, host-file root, Apple's /bin/echo through dyld and the shared cache)
0e6c4a5 Heyang Zhou committed 8 days ago
Probe: declare pmap_find_phys locally (not visible in vm_unix.c)
923fe36 Heyang Zhou committed 8 days ago
Probe: read the source page through ml_phys_read_double_64 (the extern declarations broke the build)
320258c Heyang Zhou committed 8 days ago
EL0 path keeps the user's NEON/FP registers (q0-q31, FPSR, FPCR) in the thread's uNeon across exceptions (upcalls let Linux schedule and reuse them); probe the dyld dynamic-data source page by physical address and AT S1E0R
51c0e6b Heyang Zhou committed 8 days ago
Kernel faults inside copyin/copyout that vm_fault cannot resolve return through XNU's copyio recovery (x0 = EFAULT) instead of ending the run (linux64_kernel_fault_recover, fki_regs_set_reg)
d36a59d Heyang Zhou committed 8 days ago
Debug: after shared_region_map_and_slide_2_np, what the process sees at the dyld dynamic-data mapping (fd -1) and its source
18af600 Heyang Zhou committed 8 days ago
Upcalls keep XNU's user TLS registers: Linux's context switch (an upcall that sleeps: idle, host disk I/O) zeroes TPIDRRO_EL0, and dyld's __error read the TSD through it (null + 8)
0f795b3 Heyang Zhou committed 8 days ago
Debug: log each EL0 system call's return (x0, x1, error) and the path of open/openat/access/stat/execve
01b933d Heyang Zhou committed 8 days ago
memdev: the disk size in bytes is 64-bit (mdSize << 12 overflowed 32 bits: a 16G host disk read as empty, a 6G one as 2G)
17c24a7 Heyang Zhou committed 8 days ago
vm-mk-sysdisk: the tarball lives in /var/tmp (the VM's /tmp is cleared at boot)
778823a Heyang Zhou committed 8 days ago
vm-mk-sysdisk: 16G image (the shared cache is larger on disk than du showed)
93df297 Heyang Zhou committed 8 days ago
Test init: console as fds 0-2, the child execs Apple's /bin/echo (dyld + shared cache) when the root has it, else /sbin/hello; vm-mk-sysdisk.sh builds an HFS+ system disk image for the host-disk root
875240c Heyang Zhou committed 8 days ago
Host disk upcalls return 0 (a nonzero hook return ends the run): size and I/O results come back through the request
0f3d464 Heyang Zhou committed 8 days ago
Host-file root disk: FKI fki_file_open/rw/close (I/O with Linux running, bounce buffer), xnu.ko hostdisk= (stages 995 size, 994 I/O), XNU memdev host mode (strategy and raw rw through the host) added as md0 when there is no RAM disk
b51780c Heyang Zhou committed 8 days ago
XNU's world runs with TCR.A1 = 0 so its user pmaps' TTBR0 ASIDs are live (with Linux's A1 every pmap shared Linux's ASID and XNU's per-ASID flushes missed: stale walk after exec/exit)
5e5a28a Heyang Zhou committed 8 days ago
tools/init: the forked child execve()s /sbin/hello (a second static binary that writes a line and exits 7)
37e62f5 Heyang Zhou committed 8 days ago
tools/init: align sp to 16 at entry (the parent's wait4 status load took an SP alignment fault, SIGBUS)
8bf7f1d Heyang Zhou committed 8 days ago
EL0 exceptions hand XNU the user's PSTATE without the DAIF bits we mask at EL0 (a user abort otherwise panics as non-interruptible); log TTBR0/ttep per EL0 exception
bba3ef3 Heyang Zhou committed 8 days ago
tools/init: fork test (child writes and exits 7, parent wait4s and checks the status, then exits 42)
b141140 Heyang Zhou committed 8 days ago
Hosted XNU's console_write (/dev/console, km tty) goes to the host log through stage 996, line-buffered as 'darwin console:'
c94e5f5 Heyang Zhou committed 8 days ago
tools/init: test init opens /dev/console, writes a line, exits 42 (errno-coded exits on failure)
7241e39 Heyang Zhou committed 8 days ago