mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:57:35 +00:00
Kernel: Remove special-casing of sys$gettid() in syscall entry
We had a fast-path for the gettid syscall that was useful before we started caching the thread ID in LibC. Just get rid of it. :^)
This commit is contained in:
parent
485d1faf09
commit
8ec8ec8b1c
1 changed files with 1 additions and 8 deletions
|
@ -125,15 +125,7 @@ int handle(RegisterState& regs, u32 function, u32 arg1, u32 arg2, u32 arg3)
|
||||||
void syscall_handler(TrapFrame* trap)
|
void syscall_handler(TrapFrame* trap)
|
||||||
{
|
{
|
||||||
auto& regs = *trap->regs;
|
auto& regs = *trap->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.
|
|
||||||
auto current_thread = Thread::current();
|
auto current_thread = Thread::current();
|
||||||
auto& process = current_thread->process();
|
|
||||||
if (regs.eax == SC_gettid) {
|
|
||||||
regs.eax = process.sys$gettid();
|
|
||||||
current_thread->did_syscall();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (current_thread->tracer() && current_thread->tracer()->is_tracing_syscalls()) {
|
if (current_thread->tracer() && current_thread->tracer()->is_tracing_syscalls()) {
|
||||||
current_thread->tracer()->set_trace_syscalls(false);
|
current_thread->tracer()->set_trace_syscalls(false);
|
||||||
|
@ -149,6 +141,7 @@ void syscall_handler(TrapFrame* trap)
|
||||||
asm volatile(""
|
asm volatile(""
|
||||||
: "=m"(*ptr));
|
: "=m"(*ptr));
|
||||||
|
|
||||||
|
auto& process = current_thread->process();
|
||||||
if (!MM.validate_user_stack(process, VirtualAddress(regs.userspace_esp))) {
|
if (!MM.validate_user_stack(process, VirtualAddress(regs.userspace_esp))) {
|
||||||
dbg() << "Invalid stack pointer: " << String::format("%p", regs.userspace_esp);
|
dbg() << "Invalid stack pointer: " << String::format("%p", regs.userspace_esp);
|
||||||
handle_crash(regs, "Bad stack on syscall entry", SIGSTKFLT);
|
handle_crash(regs, "Bad stack on syscall entry", SIGSTKFLT);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue