42_KFS/src/interrupt/isr.s

258 lines
3.6 KiB
ArmAsm

.intel_syntax noprefix
.extern isr_handler
isr_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 isr_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
// 0: Divide By Zero Exception
isr0:
push 0
push 0
jmp isr_common_stub
// 1: Debug Exception
isr1:
push 0
push 1
jmp isr_common_stub
// 2: Non Maskable Interrupt Exception
isr2:
push 0
push 2
jmp isr_common_stub
// 3: Int 3 Exception
isr3:
push 0
push 3
jmp isr_common_stub
// 4: INTO Exception
isr4:
push 0
push 4
jmp isr_common_stub
// 5: Out of Bounds Exception
isr5:
push 0
push 5
jmp isr_common_stub
// 6: Invalid Opcode Exception
isr6:
push 0
push 6
jmp isr_common_stub
// 7: Coprocessor Not Available Exception
isr7:
push 0
push 7
jmp isr_common_stub
// 8: Double Fault Exception (With Error Code!)
isr8:
push 8
jmp isr_common_stub
// 9: Coprocessor Segment Overrun Exception
isr9:
push 0
push 9
jmp isr_common_stub
// 10: Bad TSS Exception (With Error Code!)
isr10:
push 10
jmp isr_common_stub
// 11: Segment Not Present Exception (With Error Code!)
isr11:
push 11
jmp isr_common_stub
// 12: Stack Fault Exception (With Error Code!)
isr12:
push 12
jmp isr_common_stub
// 13: General Protection Fault Exception (With Error Code!)
isr13:
push 13
jmp isr_common_stub
// 14: Page Fault Exception (With Error Code!)
isr14:
push 14
jmp isr_common_stub
// 15: Reserved Exception
isr15:
push 0
push 15
jmp isr_common_stub
// 16: Floating Point Exception
isr16:
push 0
push 16
jmp isr_common_stub
// 17: Alignment Check Exception
isr17:
push 17
jmp isr_common_stub
// 18: Machine Check Exception
isr18:
push 0
push 18
jmp isr_common_stub
// 19: Reserved
isr19:
push 0
push 19
jmp isr_common_stub
// 20: Reserved
isr20:
push 0
push 20
jmp isr_common_stub
// 21: Reserved
isr21:
push 21
jmp isr_common_stub
// 22: Reserved
isr22:
push 0
push 22
jmp isr_common_stub
// 23: Reserved
isr23:
push 0
push 23
jmp isr_common_stub
// 24: Reserved
isr24:
push 0
push 24
jmp isr_common_stub
// 25: Reserved
isr25:
push 0
push 25
jmp isr_common_stub
// 26: Reserved
isr26:
push 0
push 26
jmp isr_common_stub
// 27: Reserved
isr27:
push 0
push 27
jmp isr_common_stub
// 28: Reserved
isr28:
push 0
push 28
jmp isr_common_stub
// 29: Reserved
isr29:
push 0
push 29
jmp isr_common_stub
// 30: Reserved
isr30:
push 0
push 30
jmp isr_common_stub
// 31: Reserved
isr31:
push 0
push 31
jmp isr_common_stub
.global isr_stub_table
isr_stub_table:
.long isr0
.long isr1
.long isr2
.long isr3
.long isr4
.long isr5
.long isr6
.long isr7
.long isr8
.long isr9
.long isr10
.long isr11
.long isr12
.long isr13
.long isr14
.long isr15
.long isr16
.long isr17
.long isr18
.long isr19
.long isr20
.long isr21
.long isr22
.long isr23
.long isr24
.long isr25
.long isr26
.long isr27
.long isr28
.long isr29
.long isr30
.long isr31