XNU as a loadable kernel module inside Linux (macOS personality for arm64 Linux)
C
Commits on main
tools/init: test init opens /dev/console, writes a line, exits 42 (errno-coded exits on failure); vm-install.sh builds it into root.img
90b9f27 Heyang Zhou committed 8 days ago
EL0 path keeps the host's x18 (Linux's shadow call stack pointer): saved at EL0 entry, restored on EL0 exceptions; kprintf per EL0 exception back
2a84cf9 Heyang Zhou committed 8 days ago
Debug: no kprintf in the EL0 exception path (step stopped there); monitor labels dbg[15] as step
11860a0 Heyang Zhou committed 8 days ago
Debug: steps of linux64_el0_exception (dbg[15]) and a kprintf per EL0 exception
6fce44f Heyang Zhou committed 8 days ago
Debug: EL0 exception counters (count, ESR/FAR/PC, unexpected current-EL vector) in the monitor
81ae8e7 Heyang Zhou committed 8 days ago
M3: XNU user threads run at EL0 while hosted: linux64_el0_run (eret with XNU's TTBR0, IRQs masked, private vectors), EL0 exceptions go through linux64_el0_vectors to sleh_synchronous and back
3f18f3a Heyang Zhou committed 8 days ago
xnu.ko bootargs=; tools/init: a minimal static Mach-O init for test roots
0a8e47a Heyang Zhou committed 8 days ago
XNU's user half keeps Linux's T0SZ: a 4K XNU user pmap's hw_ttep is an L0 table above its L1 root (seen in the walk: TTBR0 = ttep - 4K)
7991f44 Heyang Zhou committed 8 days ago
Debug: log the first user faults XNU resolves (map, pmap, ttep, ASID, resulting phys, live TTBR0, map page size)
430b8e8 Heyang Zhou committed 8 days ago
Debug: on a repeating fault, print TTBR0/TCR and walk the user table (fki_phys_peek)
6a76f3d Heyang Zhou committed 8 days ago
xnu.ko: a fault that repeats on one address after vm_fault resolved it ends the run with its details
c2ba9b2 Heyang Zhou committed 8 days ago
User half per world: world switch saves/loads TTBR0 and TCR (XNU's user pmaps and T0SZ 25 vs Linux's mm) with a local TLB flush; faults on user addresses while XNU runs (copyio) go to vm_fault on the thread's map
8ff8f1c Heyang Zhou committed 8 days ago
XNU patch: hosted test root skips DroidVM's owner root check (no OS volume/boot manifest)
d7a3c92 Heyang Zhou committed 8 days ago
XNU patch: thread-state signing (MANIPULATE_SIGNED_THREAD_STATE, initial user state) restores the SPSel it found instead of forcing SP0 (hosted XNU runs on SP1; SP_EL0 is Linux's current)
7951874 Heyang Zhou committed 8 days ago
XNU patch: hosted arm64_thread_exception_return also goes through C (task_wait_to_return and friends reach user space that way)
8771cab Heyang Zhou committed 8 days ago
Hosted thread_bootstrap_return goes through C: run the user-return ASTs (bsdinit_task execs launchd), then report the user-space entry pc and end the run (EL0 is M3)
4769358 Heyang Zhou committed 8 days ago
xnu.ko: root RAM disk (param ramdisk=: /chosen/memory-map RAMDisk, rd=md0)
115231c Heyang Zhou committed 8 days ago
ADT cpu0 without device_type cpu (Apple's AppleARMCPU would claim it)
f7308e1 Heyang Zhou committed 8 days ago
ADT /chosen: AP identity Image4 reads (crypto-hash-method sha2-384, VM chip/board, insecure non-production modes)
ca46877 Heyang Zhou committed 8 days ago
XNU patch: IONVRAMCHRPHandler::unserializeVariables skips partitions of a blank store (no image, no offsets)
149cb51 Heyang Zhou committed 8 days ago
ADT /chosen nvram-bank-size + blank nvram-proxy-data (IODTNVRAM, now that /options exists)
56d5a0f Heyang Zhou committed 8 days ago
ADT /options (NVRAM's node; AppleImage4's nonce magazine reads IODeviceTree:/options)
65a17f7 Heyang Zhou committed 8 days ago
XNU faults nothing resolves end the run cleanly: FKI offers faults by pc too and exposes fki_regs_pc/lr/set_pc; xnu.ko returns the exception into xnu_world_fault_abort (Linux keys back, then xnu_world_abort)
56a26c1 Heyang Zhou committed 8 days ago
ADT /chosen: boot-manifest-hash, manifest-properties, asmb (what 27's AppleImage4 and SIP read)
19ed9c4 Heyang Zhou committed 8 days ago
FKI fault hook on __do_kernel_fault (covers both do_bad_area's translation faults and do_page_fault's kernel permission faults)
a135698 Heyang Zhou committed 8 days ago