1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:28:10 +00:00

Kernel: Factor our PreviousMode into RegisterState::previous_mode

Various places in the kernel were manually checking the cs register for
x86_64, however to share this with aarch64 a function in RegisterState
is added, and the call-sites are updated. While we're here the
PreviousMode enum is renamed to ExecutionMode.
This commit is contained in:
Timon Kruiper 2023-01-08 16:16:08 +01:00 committed by Andreas Kling
parent 247109cee6
commit fb10774862
11 changed files with 53 additions and 29 deletions

View file

@ -987,12 +987,8 @@ public:
u64 time_in_user() const { return m_total_time_scheduled_user.load(AK::MemoryOrder::memory_order_relaxed); }
u64 time_in_kernel() const { return m_total_time_scheduled_kernel.load(AK::MemoryOrder::memory_order_relaxed); }
enum class PreviousMode : u8 {
KernelMode = 0,
UserMode
};
PreviousMode previous_mode() const { return m_previous_mode; }
bool set_previous_mode(PreviousMode mode)
ExecutionMode previous_mode() const { return m_previous_mode; }
bool set_previous_mode(ExecutionMode mode)
{
if (m_previous_mode == mode)
return false;
@ -1215,7 +1211,7 @@ private:
Atomic<bool, AK::MemoryOrder::memory_order_relaxed> m_is_active { false };
bool m_is_joinable { true };
bool m_handling_page_fault { false };
PreviousMode m_previous_mode { PreviousMode::KernelMode }; // We always start out in kernel mode
ExecutionMode m_previous_mode { ExecutionMode::Kernel }; // We always start out in kernel mode
unsigned m_syscall_count { 0 };
unsigned m_inode_faults { 0 };