#include <kern/restartable.h>

kern/restartable.h Kernel.framework

2 typedefs · 2 functions · 1 struct · 1 macro

structtask_restartable_range_t

@typedef task_restartable_range_t @brief Describes a userspace recoverable range. @field location The pointer to the beginning of a restartable section. @field length The length of the critical section anchored at location. @field recovery_offs The offset from the initial location that should be used for the recovery codepath. @field flags Currently unused, pass 0.
size 16, align 8
mach_vm_address_tlocation
unsigned shortlength
unsigned shortrecovery_offs
unsigned intflags

typedeftask_restartable_range_t

typedef struct task_restartable_range_t task_restartable_range_t;

typedeftask_restartable_range_array_t

typedef task_restartable_range_t *task_restartable_range_array_t

functiontask_restartable_ranges_register

extern kern_return_t task_restartable_ranges_register(
	task_t task,
	task_restartable_range_array_t ranges,
	mach_msg_type_number_t count
)
@function task_restartable_ranges_register @brief Register a set of restartable ranges for the current task. @param task The task to operate on @param ranges An array of address ranges for which PC resets are performed. @param count The number of address ranges. @returns - KERN_SUCCESS on success - KERN_FAILURE if the task isn't the current one - KERN_INVALID_ARGUMENT for various invalid inputs - KERN_NOT_SUPPORTED the request is not supported (second registration on release kernels, registration when the task has gone wide) - KERN_RESOURCE_SHORTAGE if not enough memory

functiontask_restartable_ranges_synchronize

extern kern_return_t task_restartable_ranges_synchronize(task_t task)
@function task_restartable_ranges_synchronize @brief Require for all threads in the task to reset their PC if within a restartable range. @param task The task to operate on (needs to be current task) @returns - KERN_SUCCESS - KERN_FAILURE if the task isn't the current one

macroTASK_RESTARTABLE_OFFSET_MAX

@const TASK_RESTARTABLE_OFFSET_MAX The maximum value length / recovery_offs can have.
#define TASK_RESTARTABLE_OFFSET_MAX 4096u