|
PatchworkOS
|
#include <kernel/sched/thread.h>#include <kernel/cpu/gdt.h>#include <kernel/cpu/smp.h>#include <kernel/init/init.h>#include <kernel/log/log.h>#include <kernel/log/panic.h>#include <kernel/mem/vmm.h>#include <kernel/sched/sched.h>#include <kernel/sched/timer.h>#include <kernel/sched/wait.h>#include <kernel/sync/lock.h>#include <stdlib.h>#include <string.h>#include <sys/list.h>#include <sys/math.h>Go to the source code of this file.
Functions | |
| static uintptr_t | thread_id_to_offset (tid_t tid, uint64_t maxPages) |
| static uint64_t | thread_init (thread_t *thread, process_t *process) |
| thread_t * | thread_new (process_t *process) |
| Creates a new thread structure. | |
| void | thread_free (thread_t *thread) |
| Frees a thread structure. | |
| void | thread_save (thread_t *thread, const interrupt_frame_t *frame) |
| Save state to a thread. | |
| void | thread_load (thread_t *thread, interrupt_frame_t *frame) |
| Load state from a thread. | |
| void | thread_get_interrupt_frame (thread_t *thread, interrupt_frame_t *frame) |
| Retrieve the interrupt frame from a thread. | |
| bool | thread_is_note_pending (thread_t *thread) |
| Check if a thread has a note pending. | |
| uint64_t | thread_send_note (thread_t *thread, const void *buffer, uint64_t count) |
| Send a note to a thread. | |
| SYSCALL_DEFINE (SYS_ERRNO, errno_t) | |
| SYSCALL_DEFINE (SYS_GETTID, tid_t) | |
| thread_t * | thread_get_boot (void) |
| Retrieves the boot thread. | |
| uint64_t | thread_handle_page_fault (const interrupt_frame_t *frame) |
| Handles a page fault that occurred in the currently running thread. | |
| uint64_t | thread_copy_from_user (thread_t *thread, void *dest, const void *userSrc, uint64_t length) |
| Safely copy data from user space. | |
| uint64_t | thread_copy_to_user (thread_t *thread, void *dest, const void *userSrc, uint64_t length) |
| Safely copy data to user space. | |
| 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. | |
| 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_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. | |
Variables | |
| static thread_t | bootThread |
| static bool | bootThreadInitalized = false |
| SYSCALL_DEFINE | ( | SYS_GETTID | , |
| tid_t | |||
| ) |
Definition at line 154 of file thread.c.
References thread_t::id, and sched_thread().
Definition at line 22 of file thread.c.
References maxPages, PAGE_SIZE, and STACK_POINTER_GUARD_PAGES.
Referenced by thread_init().
Definition at line 27 of file thread.c.
References atomic_init, CONFIG_MAX_KERNEL_STACK_PAGES, CONFIG_MAX_USER_STACK_PAGES, DEREF, thread_t::entry, ERR, thread_t::error, thread_t::frame, process_t::id, thread_t::id, thread_t::kernelStack, process_threads_t::list, list_entry_init(), list_push(), process_threads_t::lock, lock_acquire(), lock_release(), LOG_DEBUG, memset(), process_threads_t::newTid, note_queue_init(), thread_t::notes, thread_t::process, thread_t::processEntry, REF, thread_t::sched, sched_thread_ctx_init(), thread_t::simd, simd_ctx_init(), stack_pointer_init(), thread_t::syscall, syscall_ctx_init(), thread_id_to_offset(), THREAD_PARKED, process_t::threads, thread_t::userStack, VMM_KERNEL_STACKS_MAX, VMM_USER_SPACE_MAX, thread_t::wait, and wait_thread_ctx_init().
Referenced by thread_get_boot(), and thread_new().
|
static |
Definition at line 19 of file thread.c.
Referenced by init_early(), init_finalize(), thread_get_boot(), vmm_map_bootloader_lower_half(), and vmm_unmap_bootloader_lower_half().
Definition at line 20 of file thread.c.
Referenced by thread_get_boot().