218 lines
3.9 KiB
NASM
218 lines
3.9 KiB
NASM
bits 32
|
|
|
|
; !!! ISRs !!!
|
|
global _i86_isr0
|
|
global _i86_isr1
|
|
global _i86_isr2
|
|
global _i86_isr3
|
|
global _i86_isr4
|
|
global _i86_isr5
|
|
global _i86_isr6
|
|
global _i86_isr7
|
|
global _i86_isr8
|
|
global _i86_isr9
|
|
global _i86_isr10
|
|
global _i86_isr11
|
|
global _i86_isr12
|
|
global _i86_isr13
|
|
global _i86_isr14
|
|
global _i86_isr15
|
|
global _i86_isr16
|
|
global _i86_isr17
|
|
global _i86_isr18
|
|
global _i86_isr19
|
|
global _i86_isr20
|
|
global _i86_isr21
|
|
global _i86_isr22
|
|
global _i86_isr23
|
|
global _i86_isr24
|
|
global _i86_isr25
|
|
global _i86_isr26
|
|
global _i86_isr27
|
|
global _i86_isr28
|
|
global _i86_isr29
|
|
global _i86_isr30
|
|
global _i86_isr31
|
|
|
|
_i86_isr0:
|
|
cli
|
|
push byte 0; A normal ISR stub that pops a dummy error code to keep a
|
|
; uniform stack frame
|
|
push byte 0
|
|
jmp isr_common_stub
|
|
_i86_isr1:
|
|
cli
|
|
push byte 0
|
|
push byte 1
|
|
jmp isr_common_stub
|
|
_i86_isr2:
|
|
cli
|
|
push byte 0
|
|
push byte 2
|
|
jmp isr_common_stub
|
|
_i86_isr3:
|
|
cli
|
|
push byte 0
|
|
push byte 3
|
|
jmp isr_common_stub
|
|
_i86_isr4:
|
|
cli
|
|
push byte 0
|
|
push byte 4
|
|
jmp isr_common_stub
|
|
_i86_isr5:
|
|
cli
|
|
push byte 0
|
|
push byte 5
|
|
jmp isr_common_stub
|
|
_i86_isr6:
|
|
cli
|
|
push byte 0
|
|
push byte 6
|
|
jmp isr_common_stub
|
|
_i86_isr7:
|
|
cli
|
|
push byte 0
|
|
push byte 7
|
|
jmp isr_common_stub
|
|
_i86_isr8:
|
|
cli
|
|
push byte 8
|
|
jmp isr_common_stub
|
|
_i86_isr9:
|
|
cli
|
|
push byte 0
|
|
push byte 9
|
|
jmp isr_common_stub
|
|
_i86_isr10:
|
|
cli
|
|
push byte 10
|
|
jmp isr_common_stub
|
|
_i86_isr11:
|
|
cli
|
|
push byte 11
|
|
jmp isr_common_stub
|
|
_i86_isr12:
|
|
cli
|
|
push byte 12
|
|
jmp isr_common_stub
|
|
_i86_isr13:
|
|
cli
|
|
push byte 13
|
|
jmp isr_common_stub
|
|
_i86_isr14:
|
|
cli
|
|
push byte 14
|
|
jmp isr_common_stub
|
|
_i86_isr15:
|
|
cli
|
|
push byte 0
|
|
push byte 15
|
|
jmp isr_common_stub
|
|
_i86_isr16:
|
|
cli
|
|
push byte 0
|
|
push byte 16
|
|
jmp isr_common_stub
|
|
_i86_isr17:
|
|
cli
|
|
push byte 0
|
|
push byte 17
|
|
jmp isr_common_stub
|
|
_i86_isr18:
|
|
cli
|
|
push byte 0
|
|
push byte 18
|
|
jmp isr_common_stub
|
|
_i86_isr19:
|
|
cli
|
|
push byte 0
|
|
push byte 19
|
|
jmp isr_common_stub
|
|
_i86_isr20:
|
|
cli
|
|
push byte 0
|
|
push byte 20
|
|
jmp isr_common_stub
|
|
_i86_isr21:
|
|
cli
|
|
push byte 0
|
|
push byte 21
|
|
jmp isr_common_stub
|
|
_i86_isr22:
|
|
cli
|
|
push byte 0
|
|
push byte 22
|
|
jmp isr_common_stub
|
|
_i86_isr23:
|
|
cli
|
|
push byte 0
|
|
push byte 23
|
|
jmp isr_common_stub
|
|
_i86_isr24:
|
|
cli
|
|
push byte 0
|
|
push byte 24
|
|
jmp isr_common_stub
|
|
_i86_isr25:
|
|
cli
|
|
push byte 0
|
|
push byte 25
|
|
jmp isr_common_stub
|
|
_i86_isr26:
|
|
cli
|
|
push byte 0
|
|
push byte 26
|
|
jmp isr_common_stub
|
|
_i86_isr27:
|
|
cli
|
|
push byte 0
|
|
push byte 27
|
|
jmp isr_common_stub
|
|
_i86_isr28:
|
|
cli
|
|
push byte 0
|
|
push byte 28
|
|
jmp isr_common_stub
|
|
_i86_isr29:
|
|
cli
|
|
push byte 0
|
|
push byte 29
|
|
jmp isr_common_stub
|
|
_i86_isr30:
|
|
cli
|
|
push byte 0
|
|
push byte 30
|
|
jmp isr_common_stub
|
|
_i86_isr31:
|
|
cli
|
|
push byte 0
|
|
push byte 31
|
|
jmp isr_common_stub
|
|
|
|
extern _i86_fault_handler
|
|
|
|
isr_common_stub:
|
|
pusha
|
|
push ds
|
|
push es
|
|
push fs
|
|
push gs
|
|
mov ax, 0x10 ; Load the Kernel Data Segment descriptor!
|
|
mov ds, ax
|
|
mov es, ax
|
|
mov fs, ax
|
|
mov gs, ax
|
|
mov eax, esp ; Push us the stack
|
|
push eax
|
|
mov eax, _i86_fault_handler
|
|
call eax ; A special call, preserves the 'eip' register
|
|
pop eax
|
|
pop gs
|
|
pop fs
|
|
pop es
|
|
pop ds
|
|
popa
|
|
add esp, 8 ; Cleans up the pushed error code and pushed ISR number
|
|
iret ; pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP!
|