muteki
Loading...
Searching...
No Matches
thread_s Struct Reference

Thread descriptor structure. More...

#include <threading.h>

Data Fields

int magic
 
uintptr_t * sp
 
void * stack
 
int exit_code
 
kerrno_t kerrno
 
uintptr_t unk_0x14
 
thread_func_t thread_func
 
short unk_0x1c
 
short sleep_counter
 
short wait_reason
 
short slot
 
char slot_low3b
 
char slot_high3b
 
unsigned char slot_low3b_bit
 
unsigned char slot_high3b_bit
 
event_tevent
 
thread_tprev
 
thread_tnext
 
union { 
 
   char   unk_0x34 [0x20] 
 
   uintptr_t   ktls [8] 
 
};  
 

Detailed Description

Thread descriptor structure.

Field Documentation

◆ event

event_t* thread_s::event

Event descriptor that belongs to the event the thread is currently waiting for.

◆ exit_code

int thread_s::exit_code

Exit code of the thread. Initializes to 0.

◆ kerrno

kerrno_t thread_s::kerrno

Error code.

◆ ktls

uintptr_t thread_s::ktls[8]

Kernel TLS (reusing the seemingly unused unk_0x34 fields)

◆ magic

int thread_s::magic

Magic. Always 0x100.

◆ next

thread_t* thread_s::next

Next thread descriptor.

◆ prev

thread_t* thread_s::prev

Previous thread descriptor.

◆ sleep_counter

short thread_s::sleep_counter

Milliseconds left to sleep.

◆ slot

short thread_s::slot

Slot number. For scheduler.

◆ slot_high3b

char thread_s::slot_high3b

Upper 3 bit of the slot number. For scheduler.

◆ slot_high3b_bit

unsigned char thread_s::slot_high3b_bit

Upper 3 bit bitmask of the slot number. For scheduler.

◆ slot_low3b

char thread_s::slot_low3b

Lower 3 bit of the slot number. For scheduler.

◆ slot_low3b_bit

unsigned char thread_s::slot_low3b_bit

Lower 3 bit bitmask of the slot number. For scheduler.

◆ sp

uintptr_t* thread_s::sp

Stack pointer. When the thread is suspended this will point to the CPU context saved on thread stack.

◆ stack

void* thread_s::stack

Allocated stack memory.

◆ thread_func

thread_func_t thread_s::thread_func

Thread function entrypoint.

◆ unk_0x14

uintptr_t thread_s::unk_0x14

Unknown. Initializes to 0x80000000.

◆ unk_0x1c

short thread_s::unk_0x1c

Unknown.

◆ unk_0x34

char thread_s::unk_0x34[0x20]

Unknown and seems to be uninitialized.

◆ wait_reason

short thread_s::wait_reason

Current wait reason of the thread.

See also
thread_wait_reason_e

The documentation for this struct was generated from the following file: