#include <kern/hv_support_kext.h>

kern/hv_support_kext.h Kernel.framework

includes: Kernel/stdint.h, kern/kern_types.h, Kernel/mach/kern_return.h, kern/hv_io_notifier.h
19 functions · 5 typedefs · 2 enums · 2 structs · 2 variables · 1 macro

enumhv_volatile_state_t

underlying type unsigned int
HV_DEBUG_STATE0

typedefhv_volatile_state_t

typedef enum hv_volatile_state_t hv_volatile_state_t;

enumhv_trap_type_t

underlying type unsigned int
HV_TASK_TRAP0
HV_THREAD_TRAP1

typedefhv_trap_type_t

typedef enum hv_trap_type_t hv_trap_type_t;

typedefhv_trap_t

typedef kern_return_t (*hv_trap_t) (void *target, uint64_t arg)

structhv_trap_table_t

size 16, align 8
const hv_trap_t *traps
unsigned inttrap_count

typedefhv_trap_table_t

typedef struct hv_trap_table_t hv_trap_table_t;

structhv_callbacks_t

size 64, align 8
void (*)(void *)dispatch
void (*)(void *)preempt
void (*)()suspend
void (*)(void *)thread_destroy
void (*)(void *)task_destroy
void (*)(void *, int)volatile_state
void (*)()resume
void (*)()memory_pressure

typedefhv_callbacks_t

typedef struct hv_callbacks_t hv_callbacks_t;

macroHV_CALLBACKS_RESUME_DEFINED

#define HV_CALLBACKS_RESUME_DEFINED 1

variablehv_callbacks

extern hv_callbacks_t hv_callbacks

variablehv_support_available

extern int hv_support_available

functionhv_support_init

extern void hv_support_init(void)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/hv_support_kext.c
Boot-time initialization for hypervisor support. On Intel kernels built with CONFIG_VMX, probes VMX hardware-virtualization capability (vmx_hv_support) and records the result in hv_support_available; hv_get_support reports it. Called by the kernel at startup, not by kexts.

functionhv_get_support

extern int hv_get_support(void)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/hv_support_kext.c
Returns nonzero if hypervisor (hardware virtualization) support is available on this machine, as determined at boot by hv_support_init.

functionhv_set_task_target

extern void hv_set_task_target(void *target)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/hv_support_kext.c
Associates a hypervisor object (the Hypervisor kext's per-VM state) with the current task. The pointer is stored in the task and later passed as the target argument to handlers dispatched by hv_task_trap and to the task_destroy callback.

functionhv_set_thread_target

extern void hv_set_thread_target(void *target)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/hv_support_kext.c
Associates a hypervisor object (the Hypervisor kext's per-vCPU state) with the current thread. The pointer is stored in the thread and later passed as the target argument to handlers dispatched by hv_thread_trap and to the thread scheduling callbacks.

functionhv_get_task_target

extern void *hv_get_task_target(void)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/hv_support_kext.c
Returns the hypervisor object associated with the current task by hv_set_task_target, or NULL if none.

functionhv_get_thread_target

extern void *hv_get_thread_target(void)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/hv_support_kext.c
Returns the hypervisor object associated with the current thread by hv_set_thread_target, or NULL if none.

functionhv_get_volatile_state

extern int hv_get_volatile_state(hv_volatile_state_t state)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/hv_support_kext.c
Tests whether the given class of thread state may be volatile between dispatch and preemption. For HV_DEBUG_STATE on Intel, returns nonzero when the current thread has installed a custom debug state; returns 0 in all other cases.

functionhv_set_traps

extern kern_return_t hv_set_traps(
	hv_trap_type_t trap_type,
	const hv_trap_t *traps,
	unsigned trap_count
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/hv_support_kext.c
Registers the table of handlers backing the hv_task_trap or hv_thread_trap Mach traps, selected by trap_type (HV_TASK_TRAP or HV_THREAD_TRAP). traps is an array of trap_count functions indexed by the trap's index argument. Returns KERN_FAILURE if a table is already registered for that type, KERN_SUCCESS otherwise. Released with hv_release_traps.

functionhv_release_traps

extern void hv_release_traps(hv_trap_type_t trap_type)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/hv_support_kext.c
Unregisters the trap handler table previously installed by hv_set_traps for trap_type; subsequent hv_task_trap/hv_thread_trap calls of that type return KERN_INVALID_ARGUMENT.

functionhv_set_callbacks

extern kern_return_t hv_set_callbacks(hv_callbacks_t callbacks)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/hv_support_kext.c
Registers the Hypervisor kext's callbacks for events affecting tasks and threads that have associated hv objects: dispatch thread is being dispatched for execution preempt thread is being preempted suspend/resume system sleep transitions thread_destroy, task_destroy object teardown volatile_state thread state becoming volatile Only one registration may be active; returns KERN_FAILURE if callbacks are already enabled, KERN_SUCCESS otherwise.

functionhv_release_callbacks

extern void hv_release_callbacks(void)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/hv_support_kext.c
Clears the callbacks registered by hv_set_callbacks and disables callback delivery.

functionhv_suspend

extern void hv_suspend(void)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/hv_support_kext.c
System-suspend notification: invokes the suspend callback registered with hv_set_callbacks, if callbacks are enabled. Called by the kernel on the sleep path.

functionhv_resume

extern void hv_resume(void)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/hv_support_kext.c
System-resume notification: invokes the resume callback registered with hv_set_callbacks, if callbacks are enabled and a resume callback was supplied.

functionhv_task_trap

extern kern_return_t hv_task_trap(uint64_t index, uint64_t arg)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/hv_support_kext.c
Kernel entry point for the hv_task_trap Mach trap. Dispatches to entry index of the handler table registered via hv_set_traps(HV_TASK_TRAP, ...), passing the current task's hv target object and arg, and returns the handler's result. Returns KERN_INVALID_ARGUMENT if index is out of range or no handlers are registered; the handler is responsible for validating the target. Emits kdebug and DTrace probes around the dispatch.

functionhv_thread_trap

extern kern_return_t hv_thread_trap(uint64_t index, uint64_t arg)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/hv_support_kext.c
Kernel entry point for the hv_thread_trap Mach trap. Dispatches to entry index of the handler table registered via hv_set_traps(HV_THREAD_TRAP, ...), passing the current thread's hv target object and arg, and returns the handler's result. Returns KERN_INVALID_ARGUMENT if index is out of range or no handlers are registered; the handler is responsible for validating the target. Emits kdebug and DTrace probes around the dispatch.

functionhv_ast_pending

extern boolean_t hv_ast_pending(void)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/hv_support_kext.c
Returns TRUE if any asynchronous system trap (AST) is pending on the current CPU, letting the Hypervisor kext decide to leave guest context so the host kernel can process it.

functionhv_trace_guest_enter

extern void hv_trace_guest_enter(uint32_t vcpu_id, uint64_t *vcpu_regs)
claude-fable-5, 2026-08-24 · not from Apple sources
Records a trace event for entry to a guest vCPU, identified by vcpu_id, with the guest register state in vcpu_regs. Declared in kern/hv_support_kext.h for use by the Hypervisor kext; no implementation appears in the published xnu source, so the event's destination and format are unspecified here.

functionhv_trace_guest_exit

extern void hv_trace_guest_exit(uint32_t vcpu_id, uint64_t *vcpu_regs, uint32_t reason)
claude-fable-5, 2026-08-24 · not from Apple sources
Records a trace event for exit from a guest vCPU, identified by vcpu_id, with the guest register state in vcpu_regs and an exit reason code. Declared in kern/hv_support_kext.h for use by the Hypervisor kext; no implementation appears in the published xnu source.

functionhv_trace_guest_error

extern void hv_trace_guest_error(
	uint32_t vcpu_id,
	uint64_t *vcpu_regs,
	uint32_t failure,
	uint32_t error
)
claude-fable-5, 2026-08-24 · not from Apple sources
Records a trace event for a guest vCPU error, identified by vcpu_id, with the guest register state in vcpu_regs and failure and error codes. Declared in kern/hv_support_kext.h for use by the Hypervisor kext; no implementation appears in the published xnu source.