13 #define RUN_HANDLER_ON_FAULTING_STACK ((void*)1)
16 #define WRITE_DATA_TO_HANDLER_STACK NULL
19 #define WRITE_DATA_TO_FAULTING_STACK ((ERRF_ExceptionData*)1)
117 *(
u32*)(tls + 0x40) = (
u32)handler;
118 *(
u32*)(tls + 0x44) = (
u32)stack_top;
119 *(
u32*)(tls + 0x48) = (
u32)exception_data;
__attribute__((warn_unused_result)) rbtree_node_t *rbtree_insert(rbtree_t *tree
Inserts a node into an rbtree.
Structure representing CPU registers.
Definition: types.h:63
static void * getThreadLocalStorage(void)
Gets the thread local storage buffer.
Definition: svc.h:531
Provides synchronization locks.
static void __dsb(void)
Performs a Data Synchronization Barrier operation.
Definition: synchronization.h:34
static void __isb(void)
Performs an Instruction Synchronization Barrier (officially "flush prefetch buffer") operation.
Definition: synchronization.h:46
struct Thread_tag * Thread
libctru thread handle type
Definition: thread.h:22
void(* ExceptionHandler)(ERRF_ExceptionInfo *excep, CpuRegisters *regs)
Exception handler type, necessarily an ARM function that does not return.
Definition: thread.h:25
Thread threadCreate(ThreadFunc entrypoint, void *arg, size_t stack_size, int prio, int core_id, bool detached)
Creates a new libctru thread.
Result threadJoin(Thread thread, u64 timeout_ns)
Waits for a libctru thread to finish (or returns immediately if it is already finished).
Handle threadGetHandle(Thread thread)
Retrieves the OS thread handle of a libctru thread.
void threadExit(int rc) __attribute__((noreturn))
Exits the current libctru thread with an exit code (not usable from the main thread).
Thread threadGetCurrent(void)
Retrieves the libctru thread handle of the current thread.
void threadDetach(Thread thread)
Changes a thread's status from attached to detached.
static void threadOnException(ExceptionHandler handler, void *stack_top, ERRF_ExceptionData *exception_data)
Sets the exception handler for the current thread.
Definition: thread.h:113
int threadGetExitCode(Thread thread)
Retrieves the exit code of a finished libctru thread.
void threadFree(Thread thread)
Frees a finished libctru thread.
uint64_t u64
64-bit unsigned integer
Definition: types.h:24
void(* ThreadFunc)(void *)
Thread entrypoint function.
Definition: types.h:43
uint8_t u8
would be nice if newlib had this already
Definition: types.h:21
u32 Handle
Resource handle.
Definition: types.h:41
s32 Result
Function result.
Definition: types.h:42
uint32_t u32
32-bit unsigned integer
Definition: types.h:23