summaryrefslogtreecommitdiff
path: root/src/kernel/arch/i386/sysenter.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/arch/i386/sysenter.c')
-rw-r--r--src/kernel/arch/i386/sysenter.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/src/kernel/arch/i386/sysenter.c b/src/kernel/arch/i386/sysenter.c
index a7c7123..a2810b2 100644
--- a/src/kernel/arch/i386/sysenter.c
+++ b/src/kernel/arch/i386/sysenter.c
@@ -22,26 +22,16 @@ void sysexit(struct registers regs) {
_sysexit_real();
}
-void sysenter_stage2(int edi, int esi, void *ebp, void *esp,
- int ebx, int edx, int ecx, int eax)
-{
+_Noreturn void sysenter_stage2() {
uint64_t val;
- process_current->regs = (struct registers) {
- // EAX and EDX will get overriden with the return value later on
-
- .eax = eax,
- .ecx = ecx,
- .edx = edx,
- .ebx = ebx,
- .esi = esi,
- .edi = edi,
-
- .esp = (void*) ecx, // not a typo, part of my calling convention
- .eip = (void*) edx, // ^
- .ebp = ebp,
- };
+ struct registers *regs = &process_current->regs;
+
+ *regs = _sysexit_regs; // save the registers
+ regs->esp = regs->ecx; // fix them up
+ regs->eip = regs->edx;
- val = syscall_handler(eax, ebx, esi, edi);
+ val = syscall_handler(regs->eax, regs->ebx,
+ regs->esi, regs->edi);
regs_savereturn(&process_current->regs, val);
process_switch(process_current); // TODO process_resume