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

Kernel: Shrink Thread by making kernel resume TSS heap-allocated.

This commit is contained in:
Andreas Kling 2019-04-20 19:23:45 +02:00
parent c9b86be1cc
commit b2ebf6c798
3 changed files with 6 additions and 4 deletions

View file

@ -694,7 +694,8 @@ void Process::sys$sigreturn()
{ {
InterruptDisabler disabler; InterruptDisabler disabler;
Scheduler::prepare_to_modify_tss(*current); Scheduler::prepare_to_modify_tss(*current);
current->m_tss = current->m_tss_to_resume_kernel; current->m_tss = *current->m_tss_to_resume_kernel;
current->m_tss_to_resume_kernel.clear();
#ifdef SIGNAL_DEBUG #ifdef SIGNAL_DEBUG
kprintf("sys$sigreturn in %s(%u)\n", name().characters(), pid()); kprintf("sys$sigreturn in %s(%u)\n", name().characters(), pid());
auto& tss = current->tss(); auto& tss = current->tss();

View file

@ -347,9 +347,9 @@ ShouldUnblockThread Thread::dispatch_signal(byte signal)
kprintf("dispatch_signal to %s(%u) in state=%s with return to %w:%x\n", name().characters(), pid(), to_string(state()), ret_cs, ret_eip); kprintf("dispatch_signal to %s(%u) in state=%s with return to %w:%x\n", name().characters(), pid(), to_string(state()), ret_cs, ret_eip);
#endif #endif
ASSERT(is_blocked()); ASSERT(is_blocked());
m_tss_to_resume_kernel = m_tss; m_tss_to_resume_kernel = make<TSS32>(m_tss);
#ifdef SIGNAL_DEBUG #ifdef SIGNAL_DEBUG
kprintf("resume tss pc: %w:%x stack: %w:%x flags: %x cr3: %x\n", m_tss_to_resume_kernel.cs, m_tss_to_resume_kernel.eip, m_tss_to_resume_kernel.ss, m_tss_to_resume_kernel.esp, m_tss_to_resume_kernel.eflags, m_tss_to_resume_kernel.cr3); kprintf("resume tss pc: %w:%x stack: %w:%x flags: %x cr3: %x\n", m_tss_to_resume_kernel.cs, m_tss_to_resume_kernel->eip, m_tss_to_resume_kernel->ss, m_tss_to_resume_kernel->esp, m_tss_to_resume_kernel->eflags, m_tss_to_resume_kernel->cr3);
#endif #endif
if (!m_signal_stack_user_region) { if (!m_signal_stack_user_region) {

View file

@ -6,6 +6,7 @@
#include <Kernel/UnixTypes.h> #include <Kernel/UnixTypes.h>
#include <AK/AKString.h> #include <AK/AKString.h>
#include <AK/InlineLinkedList.h> #include <AK/InlineLinkedList.h>
#include <AK/OwnPtr.h>
#include <AK/RetainPtr.h> #include <AK/RetainPtr.h>
#include <AK/Vector.h> #include <AK/Vector.h>
@ -138,7 +139,7 @@ private:
Process& m_process; Process& m_process;
int m_tid { -1 }; int m_tid { -1 };
TSS32 m_tss; TSS32 m_tss;
TSS32 m_tss_to_resume_kernel; OwnPtr<TSS32> m_tss_to_resume_kernel;
FarPtr m_far_ptr; FarPtr m_far_ptr;
dword m_ticks { 0 }; dword m_ticks { 0 };
dword m_ticks_left { 0 }; dword m_ticks_left { 0 };