Ensure SS and ESP are saved in trap frame
Некоторые проверки не удались
Builds / ExectOS (amd64, release) (push) Successful in 36s
Builds / ExectOS (amd64, debug) (push) Failing after 45s
Builds / ExectOS (i686, debug) (push) Successful in 35s
Builds / ExectOS (i686, release) (push) Successful in 42s

Этот коммит содержится в:
2026-03-15 00:33:09 +01:00
родитель 428928c7e1
Коммит 6cdb66cbb3
2 изменённых файлов: 13 добавлений и 2 удалений

Просмотреть файл

@@ -75,12 +75,20 @@ _ArTrap\Vector:
/* Test previous mode and swap GS if needed */
movl $0, TrapPreviousMode(%ebp)
mov %cs, %ax
and $1, %al
and $3, %al
mov %al, TrapPreviousMode(%ebp)
jz KernelMode$\Vector
swapgs
jmp UserMode$\Vector
KernelMode$\Vector:
/* Save kernel stack pointer (SS:ESP) as CPU did not push them */
movl %ss, %eax
mov %eax, TrapSegSs(%ebp)
lea TrapEsp(%ebp), %eax
mov %eax, TrapEsp(%ebp)
UserMode$\Vector:
/* Push Frame Pointer, clear direction flag and pass to trap dispatcher */
push %esp
cld
@@ -100,6 +108,7 @@ KernelModeReturn$\Vector:
mov TrapSegDs(%ebp), %ds
mov TrapSegEs(%ebp), %es
mov TrapSegFs(%ebp), %fs
mov TrapSegGs(%ebp), %gs
/* Free stack space */
add $(TRAP_FRAME_SIZE - TRAP_REGISTERS_SIZE), %esp

Просмотреть файл

@@ -24,9 +24,11 @@
#define TrapSegEs 38
#define TrapSegFs 40
#define TrapSegGs 42
#define TrapEsp 92
#define TrapSegSs 96
/* KTRAP_FRAME length related definitions */
#define TRAP_FRAME_SIZE 100
#define TRAP_REGISTERS_SIZE 56
#endif /* __XTOSKRNL_AMD64_ASMSUP_H */
#endif /* __XTOSKRNL_I686_ASMSUP_H */