Expand description
Trap backend: rewrite residual Darwin svc and host hypercall entry.
Production path: freestanding libSystem → kh_hypercall_entry (alt
stack + NEON tramp + [kh_trampoline_dispatch]). No SIGTRAP on that path.
Residual svc: leftover Darwin svc in fixtures / unpatched third-party
code is rewritten to brk #IMM so Linux does not treat it as a host
syscall. The SIGTRAP handler translates those sites. This is not a
second production path — freestanding libSystem is always hypercall-wired.
Former experimental svc→veneer (KAKEHASHI_TRAMPOLINE) was removed.
Live handlers require Linux aarch64. Patching works on any host.
Structs§
- Trap
Config - Configuration for the trap backend.
- Trap
Event - One observed trap / translated syscall event.
Enums§
- Trap
Error - Trap subsystem errors.
- Trap
Outcome - Outcome of handling a trap.
Constants§
- BRK_
TRAP_ IMM - Marker immediate for patched traps (
brk #0x0F00). - PSTATE_
C - AArch64
PSTATE/ CPSR carry flag (bit 29 of NZCV).
Functions§
- clear_
expect_ code - Disables the expect-code gate.
- clear_
trace_ on_ exit - Clears the trace-on-exit flag (default for plain
kh run). - exit_
requested - Whether the guest requested exit.
- finish_
with_ exit_ code - Terminates the host process as if the guest called BSD
exit(code). - hypercall_
entry_ addr - install_
trap_ handlers - Installs the
SIGTRAPhandler used by the micro execution backend. - patch_
svc_ to_ brk - Patches every AArch64
svcin executable regions tobrk #IMM. - reset_
trap_ state - Resets exit / event state before a new run.
- set_
expect_ code - Sets the expected guest exit code for the micro gate (
--expect-code). - set_
trace_ on_ exit - When set, the exit trap prints recorded events to stdout before
_exit. - take_
exit_ code - Exit code from the last guest
exittrap. - take_
trace_ events - Drains recorded trap events (for
kh trace).