summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2020-01-09 18:02:01 +0100
committerAndreas Kling <awesomekling@gmail.com>2020-01-09 18:02:01 +0100
commit17ef5bc0ace2eb662445b612913e4ae5e3304c34 (patch)
tree2eeaee0443484b5fe7c14db1bab474d12eb410bb /Kernel
parentf007a63b1086988736313142c2f332160e1698ab (diff)
downloadserenity-17ef5bc0ace2eb662445b612913e4ae5e3304c34.zip
Kernel: Rename {ss,esp}_if_crossRing to userspace_{ss,esp}
These were always so awkwardly named.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Arch/i386/CPU.cpp8
-rw-r--r--Kernel/Arch/i386/CPU.h4
-rw-r--r--Kernel/Process.cpp8
-rw-r--r--Kernel/Scheduler.cpp4
-rw-r--r--Kernel/Syscall.cpp4
-rw-r--r--Kernel/Thread.cpp2
6 files changed, 15 insertions, 15 deletions
diff --git a/Kernel/Arch/i386/CPU.cpp b/Kernel/Arch/i386/CPU.cpp
index 6282adfcc7..f9f9a1f3b5 100644
--- a/Kernel/Arch/i386/CPU.cpp
+++ b/Kernel/Arch/i386/CPU.cpp
@@ -135,8 +135,8 @@ static void dump(const RegisterDump& regs)
ss = regs.ss;
esp = regs.esp;
} else {
- ss = regs.ss_if_crossRing;
- esp = regs.esp_if_crossRing;
+ ss = regs.userspace_ss;
+ esp = regs.userspace_esp;
}
kprintf("exception code: %04x (isr: %04x)\n", regs.exception_code, regs.isr_number);
@@ -247,8 +247,8 @@ void page_fault_handler(RegisterDump regs)
#endif
bool faulted_in_userspace = (regs.cs & 3) == 3;
- if (faulted_in_userspace && !MM.validate_user_stack(current->process(), VirtualAddress(regs.esp_if_crossRing))) {
- dbgprintf("Invalid stack pointer: %p\n", regs.esp_if_crossRing);
+ if (faulted_in_userspace && !MM.validate_user_stack(current->process(), VirtualAddress(regs.userspace_esp))) {
+ dbgprintf("Invalid stack pointer: %p\n", regs.userspace_esp);
handle_crash(regs, "Bad stack on page fault", SIGSTKFLT);
ASSERT_NOT_REACHED();
}
diff --git a/Kernel/Arch/i386/CPU.h b/Kernel/Arch/i386/CPU.h
index 29b769826c..ba6c654246 100644
--- a/Kernel/Arch/i386/CPU.h
+++ b/Kernel/Arch/i386/CPU.h
@@ -410,8 +410,8 @@ struct [[gnu::packed]] RegisterDump
u32 eip;
u32 cs;
u32 eflags;
- u32 esp_if_crossRing;
- u32 ss_if_crossRing;
+ u32 userspace_esp;
+ u32 userspace_ss;
};
struct [[gnu::aligned(16)]] FPUState
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index 0dbbe36982..1ff7183901 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -587,7 +587,7 @@ pid_t Process::sys$fork(RegisterDump& regs)
child_tss.ecx = regs.ecx;
child_tss.edx = regs.edx;
child_tss.ebp = regs.ebp;
- child_tss.esp = regs.esp_if_crossRing;
+ child_tss.esp = regs.userspace_esp;
child_tss.esi = regs.esi;
child_tss.edi = regs.edi;
child_tss.eflags = regs.eflags;
@@ -597,7 +597,7 @@ pid_t Process::sys$fork(RegisterDump& regs)
child_tss.es = regs.es;
child_tss.fs = regs.fs;
child_tss.gs = regs.gs;
- child_tss.ss = regs.ss_if_crossRing;
+ child_tss.ss = regs.userspace_ss;
#ifdef FORK_DEBUG
dbgprintf("fork: child will begin executing at %w:%x with stack %w:%x, kstack %w:%x\n", child_tss.cs, child_tss.eip, child_tss.ss, child_tss.esp, child_tss.ss0, child_tss.esp0);
@@ -1180,7 +1180,7 @@ int Process::sys$sigreturn(RegisterDump& registers)
SmapDisabler disabler;
//Here, we restore the state pushed by dispatch signal and asm_signal_trampoline.
- u32* stack_ptr = (u32*)registers.esp_if_crossRing;
+ u32* stack_ptr = (u32*)registers.userspace_esp;
u32 smuggled_eax = *stack_ptr;
//pop the stored eax, ebp, return address, handler and signal code
@@ -1199,7 +1199,7 @@ int Process::sys$sigreturn(RegisterDump& registers)
registers.eflags = *stack_ptr;
stack_ptr++;
- registers.esp_if_crossRing = registers.esp;
+ registers.userspace_esp = registers.esp;
return smuggled_eax;
}
diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp
index 0151de2847..f5a431d616 100644
--- a/Kernel/Scheduler.cpp
+++ b/Kernel/Scheduler.cpp
@@ -603,8 +603,8 @@ void Scheduler::timer_tick(RegisterDump& regs)
outgoing_tss.ss = regs.ss;
if ((outgoing_tss.cs & 3) != 0) {
- outgoing_tss.ss = regs.ss_if_crossRing;
- outgoing_tss.esp = regs.esp_if_crossRing;
+ outgoing_tss.ss = regs.userspace_ss;
+ outgoing_tss.esp = regs.userspace_esp;
}
prepare_for_iret_to_new_process();
diff --git a/Kernel/Syscall.cpp b/Kernel/Syscall.cpp
index 5e5a5a2fb3..e4e39d6769 100644
--- a/Kernel/Syscall.cpp
+++ b/Kernel/Syscall.cpp
@@ -104,8 +104,8 @@ void syscall_handler(RegisterDump regs)
auto& process = current->process();
- if (!MM.validate_user_stack(process, VirtualAddress(regs.esp_if_crossRing))) {
- dbgprintf("Invalid stack pointer: %p\n", regs.esp_if_crossRing);
+ if (!MM.validate_user_stack(process, VirtualAddress(regs.userspace_esp))) {
+ dbgprintf("Invalid stack pointer: %p\n", regs.userspace_esp);
handle_crash(regs, "Bad stack on syscall entry", SIGSTKFLT);
ASSERT_NOT_REACHED();
}
diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp
index f1f8dba307..d957fdb952 100644
--- a/Kernel/Thread.cpp
+++ b/Kernel/Thread.cpp
@@ -557,7 +557,7 @@ ShouldUnblockThread Thread::dispatch_signal(u8 signal)
set_state(Skip1SchedulerPass);
} else {
auto& regs = get_register_dump_from_stack();
- u32* stack = &regs.esp_if_crossRing;
+ u32* stack = &regs.userspace_esp;
setup_stack(regs, stack);
regs.eip = g_return_to_ring3_from_signal_trampoline.get();
}