diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-04-20 19:29:48 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-04-20 19:29:48 +0200 |
commit | 5562ab3f5ac46066e240b2cdacbb8aaa99932b25 (patch) | |
tree | fc9f09456a4790786bd2142faad6d04fda6fb230 | |
parent | b2ebf6c7985534968b3238e06e0e43a70b2bebb8 (diff) | |
download | serenity-5562ab3f5ac46066e240b2cdacbb8aaa99932b25.zip |
Kernel: Remove some more unnecessary Thread members.
-rw-r--r-- | Kernel/Thread.cpp | 12 | ||||
-rw-r--r-- | Kernel/Thread.h | 7 |
2 files changed, 6 insertions, 13 deletions
diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp index 87295fc6b9..69cc363722 100644 --- a/Kernel/Thread.cpp +++ b/Kernel/Thread.cpp @@ -44,14 +44,12 @@ Thread::Thread(Process& process) // FIXME: This memory is leaked. // But uh, there's also no kernel process termination, so I guess it's not technically leaked... dword stack_bottom = (dword)kmalloc_eternal(default_kernel_stack_size); - m_stack_top0 = (stack_bottom + default_kernel_stack_size) & 0xffffff8; - m_tss.esp = m_stack_top0; + m_tss.esp = (stack_bottom + default_kernel_stack_size) & 0xffffff8; } else { // Ring3 processes need a separate stack for Ring0. m_kernel_stack = kmalloc(default_kernel_stack_size); - m_stack_top0 = ((dword)m_kernel_stack + default_kernel_stack_size) & 0xffffff8; m_tss.ss0 = 0x10; - m_tss.esp0 = m_stack_top0; + m_tss.esp0 = ((dword)m_kernel_stack + default_kernel_stack_size) & 0xffffff8; } // HACK: Ring2 SS in the TSS is the current PID. @@ -433,8 +431,7 @@ void Thread::make_userspace_stack_for_main_thread(Vector<String> arguments, Vect { auto* region = m_process.allocate_region(LinearAddress(), default_userspace_stack_size, "stack"); ASSERT(region); - m_stack_top3 = region->laddr().offset(default_userspace_stack_size).get(); - m_tss.esp = m_stack_top3; + m_tss.esp = region->laddr().offset(default_userspace_stack_size).get(); char* stack_base = (char*)region->laddr().get(); int argc = arguments.size(); @@ -480,8 +477,7 @@ void Thread::make_userspace_stack_for_secondary_thread(void *argument) { auto* region = m_process.allocate_region(LinearAddress(), default_userspace_stack_size, String::format("Thread %u Stack", tid())); ASSERT(region); - m_stack_top3 = region->laddr().offset(default_userspace_stack_size).get(); - m_tss.esp = m_stack_top3; + m_tss.esp = region->laddr().offset(default_userspace_stack_size).get(); // NOTE: The stack needs to be 16-byte aligned. push_value_on_stack((dword)argument); diff --git a/Kernel/Thread.h b/Kernel/Thread.h index c0609daea0..f974c91619 100644 --- a/Kernel/Thread.h +++ b/Kernel/Thread.h @@ -45,7 +45,7 @@ public: void finalize(); - enum State { + enum State : byte { Invalid = 0, Runnable, Running, @@ -78,7 +78,6 @@ public: dword frame_ptr() const { return m_tss.ebp; } dword stack_ptr() const { return m_tss.esp; } - dword stack_top() const { return m_tss.ss == 0x10 ? m_stack_top0 : m_stack_top3; } word selector() const { return m_far_ptr.selector; } TSS32& tss() { return m_tss; } @@ -143,8 +142,6 @@ private: FarPtr m_far_ptr; dword m_ticks { 0 }; dword m_ticks_left { 0 }; - dword m_stack_top0 { 0 }; - dword m_stack_top3 { 0 }; qword m_wakeup_time { 0 }; dword m_times_scheduled { 0 }; dword m_pending_signals { 0 }; @@ -161,8 +158,8 @@ private: Vector<int> m_select_read_fds; Vector<int> m_select_write_fds; Vector<int> m_select_exceptional_fds; - State m_state { Invalid }; FPUState* m_fpu_state { nullptr }; + State m_state { Invalid }; bool m_select_has_timeout { false }; bool m_has_used_fpu { false }; bool m_was_interrupted_while_blocked { false }; |