Kernel: Implement syscalls for i686 and cleanup x86_64

This actually allows i686 to boot properly!
This commit is contained in:
2024-04-03 02:23:23 +03:00
parent 9e073e9fa0
commit 0dd74e3c9d
8 changed files with 120 additions and 48 deletions

View File

@@ -28,9 +28,9 @@ namespace Kernel
#undef O
};
extern "C" long cpp_syscall_handler(int syscall, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4, uintptr_t arg5, InterruptStack& interrupt_stack)
extern "C" long cpp_syscall_handler(int syscall, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4, uintptr_t arg5, InterruptStack* interrupt_stack)
{
ASSERT((interrupt_stack.cs & 0b11) == 0b11);
ASSERT(GDT::is_user_segment(interrupt_stack->cs));
asm volatile("sti");

View File

@@ -24,9 +24,9 @@ namespace Kernel
*(uintptr_t*)rsp = (uintptr_t)value;
}
extern "C" uintptr_t get_start_kernel_thread_sp()
extern "C" uintptr_t get_thread_start_sp()
{
return Thread::current().kernel_stack_top() - 4 * sizeof(uintptr_t);
return Thread::current().interrupt_stack().sp;
}
extern "C" uintptr_t get_userspace_thread_stack_top()
@@ -192,6 +192,12 @@ namespace Kernel
thread->m_interrupt_stack.sp = sp;
thread->m_interrupt_stack.ss = 0x10;
#if ARCH(x86_64)
thread->m_interrupt_registers.rax = 0;
#elif ARCH(i686)
thread->m_interrupt_registers.eax = 0;
#endif
thread_deleter.disable();
return thread;