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.
This commit is contained in:
Andreas Kling 2018-10-31 00:23:46 +01:00
parent b4f3bc078f
commit 72e75c52e3
Notes: sideshowbarker 2024-07-19 18:36:14 +09:00

View File

@ -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;