#define CLI_SCOPE()
Macro to increment CLI depth for the duration of the current scope.
uint64_t thread_copy_from_user_string_array(thread_t *thread, const char **user, char ***out, uint64_t *outAmount)
Safely copy a null-terminated array of strings and their contents from user space into a string vecto...
bool thread_is_note_pending(thread_t *thread)
Check if a thread has a note pending.
void thread_free(thread_t *thread)
Frees a thread structure.
uint64_t thread_copy_from_user(thread_t *thread, void *dest, const void *userSrc, uint64_t length)
Safely copy data from user space.
void thread_load(thread_t *thread, interrupt_frame_t *frame)
Load state from a thread.
static thread_t * thread_idle(void)
Retrieves the idle thread for the current CPU.
static thread_t * thread_current(void)
Retrieves the currently running thread.
_NORETURN void thread_jump(thread_t *thread)
Jump to a thread by calling thread_load() and then loading its interrupt frame.
static thread_t * thread_idle_unsafe(void)
Retrieves the idle thread for the current CPU without disabling interrupts.
uint64_t thread_load_atomic_from_user(thread_t *thread, atomic_uint64_t *userObj, uint64_t *outValue)
Atomically load a 64-bit value from a user-space atomic variable.
uint64_t thread_copy_from_user_terminated(thread_t *thread, const void *userArray, const void *terminator, uint8_t objectSize, uint64_t maxCount, void **outArray, uint64_t *outCount)
Safely copy a null-terminated array of objects from user space.
static thread_t * thread_current_unsafe(void)
Retrieves the currently running thread without disabling interrupts.
uint64_t thread_copy_from_user_pathname(thread_t *thread, pathname_t *pathname, const char *userPath)
Safely copy a string from user space and use it to initialize a pathname.
uint64_t thread_copy_from_user_string(thread_t *thread, char *dest, const char *userSrc, uint64_t size)
Safely copy a string from user space.
thread_t * thread_new(process_t *process)
Creates a new thread structure.
uint64_t thread_copy_to_user(thread_t *thread, void *userDest, const void *src, uint64_t length)
Safely copy data to user space.
void thread_save(thread_t *thread, const interrupt_frame_t *frame)
Save state to a thread.
thread_state_t
Thread state enum.
void(* thread_kernel_entry_t)(void *arg)
Kernel thread entry point function type.
tid_t thread_kernel_create(thread_kernel_entry_t entry, void *arg)
Creates a new thread that runs in kernel mode and submits it to the scheduler.
uint64_t thread_send_note(thread_t *thread, const char *string)
Send a note to a thread.
@ THREAD_UNBLOCKING
Has started unblocking, used to prevent the same thread being unblocked multiple times.
@ THREAD_PRE_BLOCK
Has started the process of blocking but has not yet been given to a owner cpu.
@ THREAD_BLOCKED
Is blocking and waiting in one or multiple wait queues.
@ THREAD_PARKED
Is doing nothing, not in a queue, not blocking, think of it as "other".
@ THREAD_DYING
The thread is currently dying, it will be freed by the scheduler once its invoked.
@ THREAD_ACTIVE
Is either running or ready to run.
sched_t PERCPU _pcpu_sched
The per CPU scheduler.
__UINT64_TYPE__ tid_t
Thread Identifier.
__UINTPTR_TYPE__ uintptr_t
A entry in a doubly linked list.
Per-Thread performance context.
Intrusive RCU head structure.
Per-thread scheduler context.
thread_t *volatile runThread
The currently running thread on this CPU.
thread_t *volatile idleThread
The idle thread for this CPU.
Structure to define a stack in memory.
Per thread syscall context.
Thread of execution structure.
list_entry_t processEntry
The entry for the parent process.
process_t * process
The parent process that the thread executes within.
_Atomic(thread_state_t) state
stack_pointer_t kernelStack
The kernel stack of the thread.
uintptr_t fsBase
The FS base address for the thread.
stack_pointer_t userStack
The user stack of the thread.
tid_t id
The thread id, unique within a process_t.
Represents a thread in the waiting subsystem.