#include <arm/thread.h>
arm/thread.h
structperfcontrol_state
| uint64_t[8] | opaque |
variable_MachineStateCount
Maps state flavor to number of words in the state:
extern unsigned int _MachineStateCount[]
functionml_make_pcpu_base_and_cpu_number
static inline long ml_make_pcpu_base_and_cpu_number(long base, uint16_t cpu)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/arm/thread.h
Packs a per-CPU data base address and a cpu number into a single word, (base << 16) | cpu, the encoding stored in the machine thread state's pcpu_data_base_and_cpu_number field.
functionget_user_regs
extern struct arm_saved_state * get_user_regs(thread_t)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/arm64/status.c
Returns the thread's saved user-mode register state (the machine PCB).
functionfind_user_regs
extern struct arm_saved_state * find_user_regs(thread_t)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/arm64/status.c
Returns the thread's saved user-mode register state; identical to get_user_regs.
functionfind_kern_regs
extern struct arm_saved_state * find_kern_regs(thread_t)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/arm64/status.c
Returns the saved kernel register state of an interrupted kernel thread, taken from the current CPU's interrupt state. Returns NULL unless thread is the current thread and an interrupt is being handled.
functionfind_user_vfp
extern struct arm_vfpsaved_state * find_user_vfp(thread_t)
▾
claude-fable-5, 2026-08-24 · not from Apple sources
Returns a pointer to the thread's saved user-mode VFP (floating-point) state. No implementation is present in the current arm64 sources, where floating-point state is kept as NEON saved state.
functionfind_debug_state32
extern arm_debug_state32_t * find_debug_state32(thread_t)
functionfind_or_allocate_debug_state32
extern arm_debug_state32_t * find_or_allocate_debug_state32(thread_t)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/arm64/status.c
Returns the thread's 32-bit debug state, allocating a zero-filled record (flavor ARM_DEBUG_STATE32) if none exists. Returns NULL if the thread is NULL or the allocation fails.
functionfind_debug_state64
extern arm_debug_state64_t * find_debug_state64(thread_t)
functionfind_or_allocate_debug_state64
extern arm_debug_state64_t * find_or_allocate_debug_state64(thread_t)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/arm64/status.c
Returns the thread's 64-bit debug state, allocating a zero-filled record (flavor ARM_DEBUG_STATE64) if none exists. Returns NULL if the thread is NULL or the allocation fails.
functionallocate_debug_state64
extern arm_debug_state_t * allocate_debug_state64(void)
▾
claude-fable-5, 2026-08-24 · not from Apple sources
Allocates a 64-bit debug state record. Not present in current xnu sources, which allocate debug state through find_or_allocate_debug_state64.
functionfree_debug_state
extern void free_debug_state(arm_debug_state_t *)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/arm64/status.c
Releases a debug state record allocated by the find_or_allocate_debug_state routines, dropping its reference and freeing it to the debug-state zone when the count reaches zero; does nothing if none is allocated. Current xnu implements this as a static helper taking the owning thread rather than the state pointer.
functionset_user_neon_reg
extern void set_user_neon_reg(thread_t, unsigned int, uint128_t)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/arm64/status.c
Sets the value of NEON register Q[regno] in the thread's saved user state. On SME-capable CPUs the accessor follows hardware aliasing rules: if the thread is in streaming SVE mode (SVCR.SM set), the write updates Z[regno][127:0] and zeroes the remaining bits of Z[regno].
macroFIND_PERFCONTROL_STATE
#define FIND_PERFCONTROL_STATE(th) (&th->machine.perfctrl_state)
functionact_thread_csave
extern void *act_thread_csave(void)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/arm64/status.c
Captures the current thread's machine context, ARM_THREAD_STATE plus the NEON state (ARM_NEON_STATE64 or ARM_NEON_STATE according to the thread's data width), into a freshly allocated context block. Returns the block for later use with act_thread_catt, or NULL on failure.
functionact_thread_catt
extern void act_thread_catt(void *ctx)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/arm64/status.c
Restores into the current thread the machine context captured by act_thread_csave (thread state, then NEON state, via machine_thread_set_state), then frees the context block. Does nothing if ctx is NULL.
functionact_thread_cfree
extern void act_thread_cfree(void *ctx)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/arm64/status.c
Frees a context block obtained from act_thread_csave without restoring it.
macroGET_RETURN_PC
Return address of the function that called current function, given
address of the first parameter of current function.
#define GET_RETURN_PC(addr) (__builtin_return_address(0))