feature: start to implement keyboard handler and better isrs/irqs
This commit is contained in:
@ -1,45 +1,137 @@
|
||||
.intel_syntax noprefix
|
||||
.extern irq_handler
|
||||
|
||||
.macro irq_common_stub nb
|
||||
irq_stub_\nb:
|
||||
mov bl, \nb
|
||||
call irq_handler
|
||||
iret
|
||||
.endm
|
||||
irq_common_stub:
|
||||
// push general purpose registers
|
||||
pusha
|
||||
|
||||
irq_common_stub 0
|
||||
irq_common_stub 1
|
||||
irq_common_stub 2
|
||||
irq_common_stub 3
|
||||
irq_common_stub 4
|
||||
irq_common_stub 5
|
||||
irq_common_stub 6
|
||||
irq_common_stub 7
|
||||
irq_common_stub 8
|
||||
irq_common_stub 9
|
||||
irq_common_stub 10
|
||||
irq_common_stub 11
|
||||
irq_common_stub 12
|
||||
irq_common_stub 13
|
||||
irq_common_stub 14
|
||||
irq_common_stub 15
|
||||
// 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 irq_stub_0
|
||||
.long irq_stub_1
|
||||
.long irq_stub_2
|
||||
.long irq_stub_3
|
||||
.long irq_stub_4
|
||||
.long irq_stub_5
|
||||
.long irq_stub_6
|
||||
.long irq_stub_7
|
||||
.long irq_stub_8
|
||||
.long irq_stub_9
|
||||
.long irq_stub_10
|
||||
.long irq_stub_11
|
||||
.long irq_stub_12
|
||||
.long irq_stub_13
|
||||
.long irq_stub_14
|
||||
.long irq_stub_15
|
||||
.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
|
||||
|
||||
Reference in New Issue
Block a user