Files
42_KFS/src/interrupt/irq.s
2025-11-05 16:19:21 +01:00

138 lines
1.6 KiB
ArmAsm

.intel_syntax noprefix
.extern irq_handler
irq_common_stub:
// push general purpose registers
pusha
// push data segment selector
mov ax, ds
push eax
// use kernel data segment
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
// hand over stack to C function
push esp
// and call it
call irq_handler
// pop stack pointer again
pop eax
// restore original segment pointers segment
pop eax
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
// restore registers
popa
// remove int_no and err_code from stack
add esp, 8
iret
irq0:
push 0
push 32
jmp irq_common_stub
irq1:
push 1
push 33
jmp irq_common_stub
irq2:
push 2
push 34
jmp irq_common_stub
irq3:
push 3
push 35
jmp irq_common_stub
irq4:
push 4
push 36
jmp irq_common_stub
irq5:
push 5
push 37
jmp irq_common_stub
irq6:
push 6
push 38
jmp irq_common_stub
irq7:
push 7
push 39
jmp irq_common_stub
irq8:
push 8
push 40
jmp irq_common_stub
irq9:
push 9
push 41
jmp irq_common_stub
irq10:
push 10
push 42
jmp irq_common_stub
irq11:
push 11
push 43
jmp irq_common_stub
irq12:
push 12
push 44
jmp irq_common_stub
irq13:
push 13
push 45
jmp irq_common_stub
irq14:
push 14
push 46
jmp irq_common_stub
irq15:
push 15
push 47
jmp irq_common_stub
.global irq_stub_table
irq_stub_table:
.long irq0
.long irq1
.long irq2
.long irq3
.long irq4
.long irq5
.long irq6
.long irq7
.long irq8
.long irq9
.long irq10
.long irq11
.long irq12
.long irq13
.long irq14
.long irq15