5#include "mos/platform/platform_defs.h"
33 void *
const arg = (
void *) regs->
di;
122 switch (switch_flags)
136 __atomic_store_n(&
current_cpu->thread, new_thread, __ATOMIC_SEQ_CST);
137 __atomic_store_n(&
per_cpu(x86_cpu_descriptor)->tss.rsp0, new_thread->
k_stack.
top, __ATOMIC_SEQ_CST);
142 bool trash_lock =
false;
143 bool *
const lock =
current ? &
current->state_lock.flag : &trash_lock;
#define MOS_ASSERT_X(cond, msg,...)
#define MOS_UNREACHABLE()
void platform_context_setup_child_thread(thread_t *thread, thread_entry_t entry, void *arg)
static platform_regs_t * x86_setup_thread_common(thread_t *thread)
void platform_context_clone(const thread_t *from, thread_t *to)
static void x86_start_kernel_thread()
static void x86_start_user_thread()
void x86_context_switch_impl(ptr_t *old_stack, ptr_t new_kstack, switch_func_t switcher, bool *lock)
void platform_context_setup_main_thread(thread_t *thread, ptr_t entry, ptr_t sp, int argc, ptr_t argv, ptr_t envp)
void platform_context_cleanup(thread_t *thread)
void x86_set_fsbase(thread_t *thread)
void platform_switch_to_thread(thread_t *current, thread_t *new_thread, switch_flags_t switch_flags)
void x86_normal_switch_impl()
#define GDT_SEGMENT_USERCODE
#define GDT_SEGMENT_KCODE
#define GDT_SEGMENT_USERDATA
#define GDT_SEGMENT_KDATA
void x86_xrstor_thread(thread_t *thread)
void x86_xsave_thread(thread_t *thread)
void signal_exit_to_user_prepare(platform_regs_t *regs)
Prepare to exit to userspace.
MOSAPI void(1, 2) fatal_abort(const char *fmt
#define statement_expr(type,...)
static void * memcpy(void *s1, const void *s2, size_t n)
platform_process_options_t platform_options
platform per-process flags
platform_thread_options_t platform_options
platform-specific thread options
thread_mode mode
user-mode thread or kernel-mode
downwards_stack_t u_stack
user-mode stack
downwards_stack_t k_stack
kernel-mode stack
void(* thread_entry_t)(void *arg)