1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +00:00

Kernel: Rename Thread::tss to Thread::regs and add x86_64 support

We're using software context switches so calling this struct tss is
somewhat misleading.
This commit is contained in:
Gunnar Beutner 2021-06-26 19:57:16 +02:00 committed by Andreas Kling
parent eba33f82b8
commit f285241cb8
14 changed files with 246 additions and 204 deletions

View file

@ -61,16 +61,17 @@ KResultOr<int> Process::sys$create_thread(void* (*entry)(void*), Userspace<const
if (!is_thread_joinable)
thread->detach();
auto& regs = thread->regs();
#if ARCH(I386)
auto& tss = thread->tss();
tss.eip = (FlatPtr)entry;
tss.eflags = 0x0202;
tss.cr3 = space().page_directory().cr3();
tss.esp = user_esp.value();
regs.eip = (FlatPtr)entry;
regs.eflags = 0x0202;
regs.esp = user_esp.value();
#else
(void)entry;
PANIC("Process::sys$create_thread() not implemented");
regs.rip = (FlatPtr)entry;
regs.rflags = 0x0202;
regs.rsp = user_esp.value();
#endif
regs.cr3 = space().page_directory().cr3();
auto tsr_result = thread->make_thread_specific_region({});
if (tsr_result.is_error())