Skip to content

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

C

world switch: mask debug exceptions in the XNU world

Heyang Zhouf0a2617502f6
diff --git a/xnu-ko/world.S b/xnu-ko/world.S
index 24bd4ab..4a95162 100644
--- a/xnu-ko/world.S
+++ b/xnu-ko/world.S
@@ -23,6 +23,7 @@ xnu_world_call:
bl fki_enter /* no preemption, no IRQs */
W(x9)
str x0, [x9, #104]
+ msr daifset, #0xf /* XNU's kernel runs with debug exceptions masked (PSTATE.D) */
mrs x10, tpidr_el0 /* XNU writes the user TLS registers of the thread it believes current */
str x10, [x9, #216]
mrs x10, tpidrro_el0