Lines Matching refs:thread

12 #include <arch/thread.h>
25 #include <thread.h>
72 // Initial thread saved state.
84 Thread* thread = thread_get_current_thread();
86 atomic_and(&thread->flags, ~THREAD_FLAGS_RESTART_SYSCALL);
87 atomic_or(&thread->flags, THREAD_FLAGS_SYSCALL_RESTARTED);
99 x86_set_tls_context(Thread* thread)
102 x86_write_msr(IA32_MSR_FS_BASE, thread->user_local_storage);
103 x86_write_msr(IA32_MSR_KERNEL_GS_BASE, thread->arch_info.user_gs_base);
121 get_signal_stack(Thread* thread, iframe* frame, struct sigaction* action,
125 if (thread->signal_stack_enabled
127 && (frame->user_sp < thread->signal_stack_base
128 || frame->user_sp >= thread->signal_stack_base
129 + thread->signal_stack_size)) {
130 addr_t stackTop = thread->signal_stack_base + thread->signal_stack_size;
159 Thread* thread = thread_get_current_thread();
160 thread->arch_info.user_gs_base = base;
176 // part of each new thread.
216 arch_thread_init_thread_struct(Thread* thread)
218 // Copy the initial saved FPU state to the new thread.
219 memcpy(&thread->arch_info, &sInitialState, sizeof(arch_thread));
221 // Initialise the current thread pointer.
222 thread->arch_info.thread = thread;
228 /*! Prepares the given thread's kernel stack for executing its entry function.
230 \param thread The thread.
231 \param stack The usable bottom of the thread's kernel stack.
232 \param stackTop The usable top of the thread's kernel stack.
233 \param function The entry function the thread shall execute.
237 arch_thread_init_kthread_stack(Thread* thread, void* _stack, void* _stackTop,
246 thread->arch_info.syscall_rsp = (uint64*)thread->kernel_stack_top;
248 thread->arch_info.instruction_pointer
255 thread->arch_info.current_stack = stackTop;
262 arch_thread* thread = (arch_thread*)info;
264 kprintf("\trsp: %p\n", thread->current_stack);
265 kprintf("\tsyscall_rsp: %p\n", thread->syscall_rsp);
266 kprintf("\tuser_rsp: %p\n", thread->user_rsp);
267 kprintf("\tfpu_state at %p\n", thread->fpu_state);
271 /*! Sets up initial thread context and enters user space
274 arch_thread_enter_userspace(Thread* thread, addr_t entry, void* args1,
277 addr_t stackTop = thread->user_stack_base + thread->user_stack_size;
285 // Copy the address of the stub that calls exit_thread() when the thread
288 addr_t commPageAddress = (addr_t)thread->team->commpage_address;
309 x86_initial_return_to_userland(thread, &frame);
318 copies it to the thread's userland stack (the one on which the signal shall
327 - \c context.uc_stack: The stack currently used by the thread.
332 Furthermore the function needs to set \c thread->user_signal_context to the
335 \param thread The current thread.
342 arch_setup_signal_frame(Thread* thread, struct sigaction* action,
386 uint8* userStack = get_signal_stack(thread, frame, action,
403 thread->user_signal_context = &userSignalFrameData->context;
407 addr_t* commPageAddress = (addr_t*)thread->team->commpage_address;
446 Thread* thread = thread_get_current_thread();
448 memcpy(thread->arch_info.fpu_state,
450 frame->fpu = &thread->arch_info.fpu_state;