StupidOS/kernel/idt.inc

60 lines
827 B
PHP
Raw Normal View History

2024-07-14 13:11:28 +00:00
;; File: idt.inc
2024-07-07 13:29:41 +00:00
2024-07-14 13:11:28 +00:00
idt_set_gate:
mov [aInterruptGate + (ecx * 8)], ax
mov [aInterruptGate + (ecx * 8) + 2], word 0x08
mov [aInterruptGate + (ecx * 8) + 5], word 0x8E
shr eax, 16
mov [aInterruptGate + (ecx * 8) + 6], ax
2024-07-07 13:29:41 +00:00
ret
idt_setup:
2024-07-14 13:11:28 +00:00
xor ecx, ecx
@@:
mov eax, [aISRTable + (ecx * 4)]
call idt_set_gate
inc ecx
cmp ecx, 32
jb @b
mov eax, pit_irq
call idt_set_gate
inc ecx
mov eax, kbd_irq
call idt_set_gate
inc ecx
@@:
mov eax, irq_dummy
call idt_set_gate
inc ecx
cmp ecx, 0x30
jb @b
2024-07-18 09:48:35 +00:00
mov ecx, 36
mov eax, com_irq
call idt_set_gate
mov ecx, 38
mov eax, floppy_irq
call idt_set_gate
2024-07-14 13:11:28 +00:00
mov ecx, 0x42
mov eax, isr_syscall
call idt_set_gate
lidt [pIDT]
sti
2024-07-07 13:29:41 +00:00
ret
2024-07-14 13:11:28 +00:00
pIDT:
dw aInterruptGate.end-aInterruptGate-1
dd aInterruptGate
; variable: idt_entries
aInterruptGate:
dd 256*2 dup(0)
.end: