ISRs and IRQs push a register_state_t* to the stack (arg to the handler functions)
@@ -101,9 +101,14 @@ isr_common_stub:
mov fs, ax
mov gs, ax
+ push esp
+
; call general isr handler
call isr_receive
+ ; add esp, 4
+ pop esp
+
; restore data segment selector
pop eax
mov gs, ax
@@ -122,7 +127,17 @@ isr_common_stub:
; up for kernel mode arguments, calls C-level fault handler,
; and finally restores stack frame
irq_common_stub:
- pushad ; pushes edi, esi, ebp, esp, ebx, edx, ecx, eax
+ ; push in this order:
+ ; EAX
+ ; ECX
+ ; EDX
+ ; EBX
+ ; EBP
+ ; ESP (original value)
+ ; EBP
+ ; ESI
+ ; EDI
+ pushad
; move current data segment into ax
; push to stack so we can restore it later
@@ -137,8 +152,14 @@ irq_common_stub:
mov fs, ax
mov gs, ax
+ push esp
+
call irq_receive
+ ; pop esp pointer from stack without storing it
+ ; add esp, 4
+ pop esp
+
; restore data segment selector
pop eax
mov gs, ax
