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

Kernel: Replace "current" with Thread::current and Process::current

Suggested by Sergey. The currently running Thread and Process are now
Thread::current and Process::current respectively. :^)
This commit is contained in:
Andreas Kling 2020-02-17 15:04:27 +01:00
parent 4f4af24b9d
commit 48f7c28a5c
37 changed files with 257 additions and 252 deletions

View file

@ -85,8 +85,8 @@ static Handler s_syscall_table[] = {
int handle(RegisterState& regs, u32 function, u32 arg1, u32 arg2, u32 arg3)
{
ASSERT_INTERRUPTS_ENABLED();
auto& process = current->process();
current->did_syscall();
auto& process = *Process::current;
Thread::current->did_syscall();
if (function == SC_exit || function == SC_exit_thread) {
// These syscalls need special handling since they never return to the caller.
@ -126,8 +126,8 @@ void syscall_handler(RegisterState regs)
// Special handling of the "gettid" syscall since it's extremely hot.
// FIXME: Remove this hack once userspace locks stop calling it so damn much.
if (regs.eax == SC_gettid) {
regs.eax = current->process().sys$gettid();
current->did_syscall();
regs.eax = Process::current->sys$gettid();
Thread::current->did_syscall();
return;
}
@ -140,7 +140,7 @@ void syscall_handler(RegisterState regs)
asm volatile(""
: "=m"(*ptr));
auto& process = current->process();
auto& process = *Process::current;
if (!MM.validate_user_stack(process, VirtualAddress(regs.userspace_esp))) {
dbgprintf("Invalid stack pointer: %p\n", regs.userspace_esp);
@ -172,10 +172,10 @@ void syscall_handler(RegisterState regs)
process.big_lock().unlock();
// Check if we're supposed to return to userspace or just die.
current->die_if_needed();
Thread::current->die_if_needed();
if (current->has_unmasked_pending_signals())
(void)current->block<Thread::SemiPermanentBlocker>(Thread::SemiPermanentBlocker::Reason::Signal);
if (Thread::current->has_unmasked_pending_signals())
(void)Thread::current->block<Thread::SemiPermanentBlocker>(Thread::SemiPermanentBlocker::Reason::Signal);
}
}