summaryrefslogtreecommitdiff
path: root/src/kernel/arch
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/arch')
-rw-r--r--src/kernel/arch/generic.h2
-rw-r--r--src/kernel/arch/i386/sysenter.s9
2 files changed, 10 insertions, 1 deletions
diff --git a/src/kernel/arch/generic.h b/src/kernel/arch/generic.h
index 08f26a7..0b005a2 100644
--- a/src/kernel/arch/generic.h
+++ b/src/kernel/arch/generic.h
@@ -17,7 +17,7 @@ void halt_cpu();
// src/arch/i386/sysenter.s
void sysexit(void (*fun)(), void *stack_top);
void sysenter_setup();
-void syscall_handler();
+int syscall_handler(int, int, int, int);
// all of those can allocate memory
struct pagedir *pagedir_new();
diff --git a/src/kernel/arch/i386/sysenter.s b/src/kernel/arch/i386/sysenter.s
index 3fcd4c3..7375e06 100644
--- a/src/kernel/arch/i386/sysenter.s
+++ b/src/kernel/arch/i386/sysenter.s
@@ -49,6 +49,10 @@ sysenter_setup:
sysenter_handler:
pushal
+ push %edi
+ push %esi
+ push %ebx
+ push %eax
mov %cr0, %eax
and $0x7FFFFFFF, %eax // disable paging
@@ -56,9 +60,14 @@ sysenter_handler:
call syscall_handler
+ // save the return value
+ mov %eax, 44(%esp) // 16 [top of eflags] + 7*4 [skip until EAX]
+ mov %edx, 32(%esp) // 16 + 4*4 [skip until EBX]
+
mov %cr0, %eax
or $0x80000000, %eax // enable paging
mov %eax, %cr0
+ add $16, %esp
popal
sysexit