summaryrefslogtreecommitdiff
path: root/src/kernel/arch/i386/sysenter.c
diff options
context:
space:
mode:
authordzwdz2021-07-24 18:53:34 +0200
committerdzwdz2021-07-24 18:53:34 +0200
commitae9c1d1b16061242068353ff9064c8c9ef63b577 (patch)
tree59c91ac4d15d8231cab1174b7402128ce895fb0f /src/kernel/arch/i386/sysenter.c
parentb0690678bef7d51bbdadce6b606c835ce76d4d92 (diff)
sysexit() now overrides all registers
when doing anything more complex than starting a new program, you pretty much need to pass a full register dump. otherwise stuff will break
Diffstat (limited to 'src/kernel/arch/i386/sysenter.c')
-rw-r--r--src/kernel/arch/i386/sysenter.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/kernel/arch/i386/sysenter.c b/src/kernel/arch/i386/sysenter.c
index 91dac2e..f3f5987 100644
--- a/src/kernel/arch/i386/sysenter.c
+++ b/src/kernel/arch/i386/sysenter.c
@@ -1,6 +1,27 @@
#include <kernel/arch/generic.h>
#include <kernel/proc.h>
+struct registers_pushad _sysexit_regs; // a hack
+
+extern void _sysexit_real();
+
+void sysexit(struct registers regs) {
+ _sysexit_regs = (struct registers_pushad) {
+ .eax = regs.eax,
+ .ebx = regs.ebx,
+ .ebp = regs.ebp,
+ .esi = regs.esi,
+ .edi = regs.edi,
+
+ // sysexit args
+ .ecx = regs.esp,
+ .edx = regs.eip,
+
+ // ESP doesn't matter
+ };
+ _sysexit_real();
+}
+
void sysenter_stage2(int edi, int esi, void *ebp, void *esp,
int ebx, int edx, int ecx, int eax)
{