1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-23 18:55:08 +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

@ -145,7 +145,7 @@ NEVER_INLINE void syscall_handler(TrapFrame* trap)
auto& regs = *trap->regs;
auto* current_thread = Thread::current();
VERIFY(current_thread->previous_mode() == Thread::PreviousMode::UserMode);
VERIFY(current_thread->previous_mode() == ExecutionMode::User);
auto& process = current_thread->process();
if (process.is_dying()) {
// It's possible this thread is just about to make a syscall while another is
@ -205,7 +205,7 @@ NEVER_INLINE void syscall_handler(TrapFrame* trap)
current_thread->check_dispatch_pending_signal();
// If the previous mode somehow changed something is seriously messed up...
VERIFY(current_thread->previous_mode() == Thread::PreviousMode::UserMode);
VERIFY(current_thread->previous_mode() == ExecutionMode::User);
// Check if we're supposed to return to userspace or just die.
current_thread->die_if_needed();