Kernel: save and load sse context in more spaces
This commit is contained in:
parent
be786be67d
commit
a0123e7c2d
|
@ -36,6 +36,8 @@ start_kernel_thread:
|
|||
|
||||
.global start_userspace_thread
|
||||
start_userspace_thread:
|
||||
call load_thread_sse
|
||||
|
||||
call get_thread_start_sp
|
||||
movl %eax, %esp
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ start_kernel_thread:
|
|||
|
||||
.global start_userspace_thread
|
||||
start_userspace_thread:
|
||||
call load_thread_sse
|
||||
|
||||
call get_thread_start_sp
|
||||
movq %rax, %rsp
|
||||
|
||||
|
|
|
@ -354,6 +354,8 @@ namespace Kernel
|
|||
asm volatile("cli; 1: hlt; jmp 1b");
|
||||
}
|
||||
|
||||
Thread::current().save_sse();
|
||||
|
||||
ASSERT(InterruptController::get().is_in_service(IRQ_TIMER - IRQ_VECTOR_BASE));
|
||||
InterruptController::get().eoi(IRQ_TIMER - IRQ_VECTOR_BASE);
|
||||
|
||||
|
@ -365,6 +367,8 @@ namespace Kernel
|
|||
auto& current_thread = Thread::current();
|
||||
if (current_thread.can_add_signal_to_execute())
|
||||
current_thread.handle_signal();
|
||||
|
||||
Thread::current().load_sse();
|
||||
}
|
||||
|
||||
extern "C" void cpp_irq_handler(uint32_t irq)
|
||||
|
|
|
@ -34,6 +34,11 @@ namespace Kernel
|
|||
return Thread::current().userspace_stack_top() - 4 * sizeof(uintptr_t);
|
||||
}
|
||||
|
||||
extern "C" void load_thread_sse()
|
||||
{
|
||||
Thread::current().load_sse();
|
||||
}
|
||||
|
||||
static pid_t s_next_tid = 1;
|
||||
|
||||
alignas(16) static uint8_t s_default_sse_storage[512];
|
||||
|
@ -168,6 +173,7 @@ namespace Kernel
|
|||
{
|
||||
auto* thread = TRY(create_userspace(m_process, m_process->page_table()));
|
||||
|
||||
save_sse();
|
||||
memcpy(thread->m_sse_storage, m_sse_storage, sizeof(m_sse_storage));
|
||||
|
||||
thread->setup_exec_impl(
|
||||
|
@ -202,6 +208,7 @@ namespace Kernel
|
|||
thread->m_interrupt_stack.sp = sp;
|
||||
thread->m_interrupt_stack.ss = 0x10;
|
||||
|
||||
save_sse();
|
||||
memcpy(thread->m_sse_storage, m_sse_storage, sizeof(m_sse_storage));
|
||||
|
||||
#if ARCH(x86_64)
|
||||
|
|
Loading…
Reference in New Issue