diff options
author | dzwdz | 2021-07-24 19:19:34 +0200 |
---|---|---|
committer | dzwdz | 2021-07-24 19:19:34 +0200 |
commit | 5ea03fb258a9952846e73f3061bb4fca36ef9fd6 (patch) | |
tree | 2f55d684ada0ad962a61f1aaf65fcdc1ddcb5f7f /src | |
parent | ae9c1d1b16061242068353ff9064c8c9ef63b577 (diff) |
merge the `register` and `register_pushad` structs
Diffstat (limited to 'src')
-rw-r--r-- | src/kernel/arch/i386/registers.h | 12 | ||||
-rw-r--r-- | src/kernel/arch/i386/sysenter.c | 4 |
2 files changed, 7 insertions, 9 deletions
diff --git a/src/kernel/arch/i386/registers.h b/src/kernel/arch/i386/registers.h index 1264139..cca374d 100644 --- a/src/kernel/arch/i386/registers.h +++ b/src/kernel/arch/i386/registers.h @@ -1,15 +1,13 @@ #pragma once #include <stdint.h> -// TODO merge registers and registers_pushad - struct registers { - uint32_t eax, ebx, ecx, edx, esi, edi; - void *ebp, *esp, *eip; -}; - -struct registers_pushad { + /* those are in the order of pushad/popad - so you can load/save this + * struct in (almost) one instruction */ uint32_t edi, esi, ebp, esp, ebx, edx, ecx, eax; + + // not part of pushad/popad, but still useful + uint32_t eip; } __attribute__((__packed__)); // saves a return value according to the SysV ABI diff --git a/src/kernel/arch/i386/sysenter.c b/src/kernel/arch/i386/sysenter.c index f3f5987..a7c7123 100644 --- a/src/kernel/arch/i386/sysenter.c +++ b/src/kernel/arch/i386/sysenter.c @@ -1,12 +1,12 @@ #include <kernel/arch/generic.h> #include <kernel/proc.h> -struct registers_pushad _sysexit_regs; // a hack +struct registers _sysexit_regs; // a hack extern void _sysexit_real(); void sysexit(struct registers regs) { - _sysexit_regs = (struct registers_pushad) { + _sysexit_regs = (struct registers) { .eax = regs.eax, .ebx = regs.ebx, .ebp = regs.ebp, |