diff options
Diffstat (limited to 'src/hardware/interrupts.asm')
-rw-r--r-- | src/hardware/interrupts.asm | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/src/hardware/interrupts.asm b/src/hardware/interrupts.asm index 155b2af..30204e7 100644 --- a/src/hardware/interrupts.asm +++ b/src/hardware/interrupts.asm @@ -53,6 +53,8 @@ IRQ_BASE equ 0x20 global interrupts_handle_irq_%1 interrupts_handle_irq_%1: mov [interrupt_no], byte IRQ_BASE + %1 + ; error + push 0x0 jmp int_entry %endmacro @@ -62,11 +64,18 @@ irq_stub 0x0C int_entry: ; safe state of interrupted code - pusha - push ds - push es - push fs - push gs + ;pusha + push ebp + push edi + push esi + push edx + push ecx + push ebx + push eax + ;push ds + ;push es + ;push fs + ;push gs ; call the static C handler with the correct interrupt number ; uint32_t interrupts_handle_interrupt( uint8_t interrupt_no, uint32_t esp ); @@ -74,15 +83,25 @@ int_entry: mov eax, [interrupt_no] push eax call interrupts_handle_static_interrupt - ;add esp, 8 + ; switch stack mov esp, eax - ; restore state - pop gs - pop fs - pop es - pop ds - popa + ; restore state (no popa or pusha, we have to align to cpu_state in tasks.h) + ;pop gs + ;pop fs + ;pop es + ;pop ds + ;popa + pop eax + pop ebx + pop ecx + pop edx + pop esi + pop edi + pop ebp + + ; remove error from the stack + add esp, 4 iret |