diff options
author | Tom <tomut@yahoo.com> | 2021-01-25 16:37:36 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-27 21:12:24 +0100 |
commit | 33cdc1d2f141cf216501465a80c8c3198d005f6a (patch) | |
tree | 9710a742cadb57a0b80675f6999893cd31a2c80f | |
parent | 0bd558081e3db0a51fd156244cd8288352a5ee87 (diff) | |
download | serenity-33cdc1d2f141cf216501465a80c8c3198d005f6a.zip |
Kernel: Use new Thread::previous_mode to track ticks
-rw-r--r-- | Kernel/Scheduler.cpp | 2 | ||||
-rw-r--r-- | Kernel/Thread.cpp | 4 | ||||
-rw-r--r-- | Kernel/Thread.h | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp index f949f60462..1d29ffb5fc 100644 --- a/Kernel/Scheduler.cpp +++ b/Kernel/Scheduler.cpp @@ -500,7 +500,7 @@ void Scheduler::timer_tick(const RegisterState& regs) [[maybe_unused]] auto rc = perf_events.append_with_eip_and_ebp(regs.eip, regs.ebp, PERF_EVENT_SAMPLE, 0, 0); } - if (current_thread->tick((regs.cs & 3) == 0)) + if (current_thread->tick()) return; ASSERT_INTERRUPTS_DISABLED(); diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp index 17f8748b36..7bef932346 100644 --- a/Kernel/Thread.cpp +++ b/Kernel/Thread.cpp @@ -413,9 +413,9 @@ void Thread::finalize_dying_threads() } } -bool Thread::tick(bool in_kernel) +bool Thread::tick() { - if (in_kernel) { + if (previous_mode() == PreviousMode::KernelMode) { ++m_process->m_ticks_in_kernel; ++m_ticks_in_kernel; } else { diff --git a/Kernel/Thread.h b/Kernel/Thread.h index 94cda9b7c2..52fa204e6d 100644 --- a/Kernel/Thread.h +++ b/Kernel/Thread.h @@ -971,7 +971,7 @@ public: void exit(void* = nullptr); - bool tick(bool in_kernel); + bool tick(); void set_ticks_left(u32 t) { m_ticks_left = t; } u32 ticks_left() const { return m_ticks_left; } |