2026-06-26 20:05:01 -05:00
|
|
|
.code32
|
2026-06-11 23:23:39 -05:00
|
|
|
.macro ISR_NOERRCODE num
|
|
|
|
|
.global isr\num
|
|
|
|
|
isr\num:
|
|
|
|
|
pushl $0
|
|
|
|
|
pushl $\num
|
|
|
|
|
jmp isr_common_stub
|
|
|
|
|
.endm
|
|
|
|
|
|
|
|
|
|
.macro ISR_ERRCODE num
|
|
|
|
|
.global isr\num
|
|
|
|
|
isr\num:
|
|
|
|
|
pushl $\num
|
|
|
|
|
jmp isr_common_stub
|
|
|
|
|
.endm
|
|
|
|
|
|
2026-06-28 17:58:58 -05:00
|
|
|
.extern common_interrupt_handler # interrupts.c
|
2026-06-11 23:23:39 -05:00
|
|
|
isr_common_stub:
|
|
|
|
|
pushal
|
|
|
|
|
|
|
|
|
|
pushl %esp
|
|
|
|
|
call common_interrupt_handler
|
|
|
|
|
addl $4, %esp
|
|
|
|
|
|
|
|
|
|
popal
|
|
|
|
|
addl $8, %esp
|
|
|
|
|
iret
|
|
|
|
|
|
|
|
|
|
.extern idtr
|
|
|
|
|
.global load_idt
|
|
|
|
|
load_idt:
|
|
|
|
|
lidt idtr
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
ISR_NOERRCODE 0 # Divide by Zero
|
|
|
|
|
ISR_NOERRCODE 1 # Debug
|
|
|
|
|
ISR_ERRCODE 8 # Double Fault (Has Error Code!)
|
|
|
|
|
ISR_ERRCODE 13 # General Protection Fault (Has Error Code!)
|
|
|
|
|
ISR_ERRCODE 14 # Page Fault (Has Error Code!)
|
|
|
|
|
|
2026-06-26 20:05:01 -05:00
|
|
|
// This is a special case so we need to handle it for task switching
|
|
|
|
|
.global isr32
|
2026-06-28 17:58:58 -05:00
|
|
|
.extern switch_context # scheduler.c
|
2026-07-03 22:25:24 -05:00
|
|
|
.extern send_eoi_master # drivers/pic/pic.S
|
2026-06-26 20:05:01 -05:00
|
|
|
isr32:
|
|
|
|
|
cli
|
|
|
|
|
pushal
|
2026-06-28 17:58:58 -05:00
|
|
|
|
2026-06-26 20:05:01 -05:00
|
|
|
pushl %esp
|
2026-06-28 17:58:58 -05:00
|
|
|
call switch_context
|
2026-06-26 20:05:01 -05:00
|
|
|
movl %eax, %esp
|
|
|
|
|
|
2026-07-04 00:26:20 -05:00
|
|
|
call send_eoi_master
|
2026-06-30 19:26:31 -05:00
|
|
|
|
2026-06-26 20:05:01 -05:00
|
|
|
popal
|
|
|
|
|
sti
|
|
|
|
|
iret
|
|
|
|
|
|
2026-06-23 23:19:49 -05:00
|
|
|
ISR_NOERRCODE 33 # IRQ1 - Keyboard
|
|
|
|
|
|
|
|
|
|
ISR_NOERRCODE 46 # IRQ14
|
|
|
|
|
ISR_NOERRCODE 47 # IRQ15
|