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, 15 insertions, 2 deletions
diff --git a/kernel/traps.s b/kernel/traps.s
index 0381ee8..15e2640 100644
--- a/kernel/traps.s
+++ b/kernel/traps.s
@@ -23,7 +23,7 @@ extern register_isr
mov fs, ax
mov gs, ax
; restore EAX (needed for syscalls)
- mov eax, [esp+44]
+ mov eax, [esp+30]
%endmacro
%macro SAVE_ERR 0
@@ -64,6 +64,19 @@ extern register_isr
iret
%endmacro
+%macro RESTORE_SYS 0
+ ; preserve our modified EAX (return value for syscalls)
+ mov [esp+30], eax
+ ; restore the data segment selectors
+ pop ax
+ mov ds, ax
+ mov es, ax
+ mov fs, ax
+ mov gs, ax
+ popa
+ iret
+%endmacro
+
traps:
dd exc_div
dd exc_debug
@@ -230,7 +243,7 @@ syscall_handler:
call [eax]
add esp, 12
- RESTORE
+ RESTORE_SYS
syscall_init: