瀏覽代碼

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.
Andreas Kling 6 年之前
父節點
當前提交
72e75c52e3
共有 1 個文件被更改,包括 3 次插入7 次删除
  1. 3 7
      Kernel/Syscall.cpp

+ 3 - 7
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;