From 72e75c52e370b4ec422f6ec8233efa71107c1f1e Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 31 Oct 2018 00:23:46 +0100 Subject: [PATCH] Pass the register dump to syscall_entry() via an argument. I'm not sure why this was using a global, but it was very racy and made processes walk over each other when multiple processes were doing syscalls simultaneously. --- Kernel/Syscall.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Kernel/Syscall.cpp b/Kernel/Syscall.cpp index 8ec4b7c28b..8b4a4a7f6f 100644 --- a/Kernel/Syscall.cpp +++ b/Kernel/Syscall.cpp @@ -3,15 +3,12 @@ #include "Syscall.h" #include "Console.h" -extern "C" void syscall_entry(); +extern "C" void syscall_entry(RegisterDump&); extern "C" void syscall_ISR(); extern volatile RegisterDump* syscallRegDump; asm( ".globl syscall_ISR \n" - ".globl syscallRegDump \n" - "syscallRegDump: \n" - ".long 0\n" "syscall_ISR:\n" " pusha\n" " pushw %ds\n" @@ -27,7 +24,7 @@ asm( " popw %es\n" " popw %fs\n" " popw %gs\n" - " mov %esp, syscallRegDump\n" + " mov %esp, %eax\n" " call syscall_entry\n" " popw %gs\n" " popw %gs\n" @@ -125,9 +122,8 @@ DWORD handle(DWORD function, DWORD arg1, DWORD arg2, DWORD arg3) } -void syscall_entry() +void syscall_entry(RegisterDump& regs) { - auto& regs = *syscallRegDump; DWORD function = regs.eax; DWORD arg1 = regs.edx; DWORD arg2 = regs.ecx;