Code: Select all
extern old_esp
global _irq0
_irq0:
pusha
pushf
mov eax, [old_esp]
mov [eax], esp
jmp isr32
Code: Select all
; The old esp is saved by the interrupt handler.
extern current_esp, current_ldt
global do_task_switch
do_task_switch:
mov esp, [current_esp]
popf
popa
lldt [current_ldt]
iret
Also, when I tried 0x03 instead of 0x18 for the LDT selector, it loaded the LDT without a crash, but then GPFed again when I tried to set CS to 0x04. I used the same flags for the LDT's code segment as I did for the GDT's one at 0x08.