[PATCH v2] x86_64: install emergency handler for double fault

2023-07-29 Thread Luca Dariz
* i386/i386/idt.c: add selector for the interrupt-specific stack * i386/i386/ktss.c: configure ist1 to use a dedicated stack * i386/i386/trap.c: add double fault handler, which just prints the state and panics. There is not much else to do in this case but it's useful for troubleshooting * x86_

[PATCH 3/5] x86_64: format pusha/popa macros for readability

2023-07-29 Thread Luca Dariz
--- x86_64/locore.S | 37 +++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/x86_64/locore.S b/x86_64/locore.S index 413d43c4..7127957b 100644 --- a/x86_64/locore.S +++ b/x86_64/locore.S @@ -39,8 +39,41 @@ #include #include -#define pusha pus

[PATCH 2/5] x86_64: disable V86 mode on full 64-bit configuration

2023-07-29 Thread Luca Dariz
* i386/i386/pcb.c: simplify exception stack location and adapt thread gettrs/setters * i386/i386/thread.h: don't include V86 fields on full 64-bit * x86_64/locore.S: don't include checks for V86 mode on full 64-bit --- i386/i386/pcb.c| 35 ++- i386/i386/thread

[PATCH 4/5] x86_64: refactor segment register handling

2023-07-29 Thread Luca Dariz
The actual values are not saved together with the rest of the thread state, both because it would be quite espensive (reading MSR, unless rdfsbase instructions are supported, but that's optional) and not really needed. The only way the user has to change its value is with a specific RPC, so we can

[PATCH 5/5] x86_64: remove unneeded segment selectors handling on full 64 bit

2023-07-29 Thread Luca Dariz
* i386/i386/db_interface.c: don't set unused segment selectors on full 64-bit * i386/i386/db_trace.c: likewise. * i386/i386/i386asm.sym: likewise. * i386/i386/pcb.c:: likewise. * i386/i386/thread.h: remove ES/DS/FS/GS from thread state on !USER32, as they are unused in this configuration. Only

[PATCH 1/5] x86_64: fix stack handling on recursive interrupts for USER32

2023-07-29 Thread Luca Dariz
* x86_64/locore.S: ensure the thread state is filled completely even on recursive interrups. The value of the segment selectors is not very important in this case, but we still need to align the stack to the bottom of i386_interrupt_state. --- x86_64/locore.S | 16 +++- 1 file ch