summaryrefslogtreecommitdiff
path: root/kernel/traps.s
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/traps.s')
-rw-r--r--kernel/traps.s17
1 files changed, 11 insertions, 6 deletions
diff --git a/kernel/traps.s b/kernel/traps.s
index 7b7446b..ba9814c 100644
--- a/kernel/traps.s
+++ b/kernel/traps.s
@@ -5,9 +5,9 @@
global syscall_init
global traps_init
+extern call_table
extern idt
extern register_isr
-extern syscall
%macro SAVE 0
pusha
@@ -20,6 +20,8 @@ extern syscall
mov es, ax
mov fs, ax
mov gs, ax
+ ; restore EAX (needed for syscalls)
+ mov eax, [esp+44]
%endmacro
%macro SAVE_ERR 0
@@ -206,11 +208,14 @@ exc_reserved:
syscall_handler:
SAVE
- ; pass the saved ESP value to the REAL handler
- mov eax, [esp+46]
- push eax
- call syscall
- add esp, 4
+ push edx
+ push ecx
+ push ebx
+ and eax, 0xFF
+ shl eax, 2
+ add eax, call_table
+ call [eax]
+ add esp, 12
RESTORE