118 lines
1.6 KiB
PHP
118 lines
1.6 KiB
PHP
;idt.inc
|
|
;Author: Josh Holtrop
|
|
;Date: 10/30/03
|
|
;Modified: 01/02/06
|
|
|
|
idtr:
|
|
dw 50*8-1 ;size of idt
|
|
dd IDT_V ;address of idt
|
|
|
|
|
|
%macro isr_label 1
|
|
isr_%1:
|
|
push eax
|
|
mov eax, %1
|
|
jmp isr_main
|
|
%endmacro
|
|
|
|
isr_label 0
|
|
isr_label 1
|
|
isr_label 2
|
|
isr_label 3
|
|
isr_label 4
|
|
isr_label 5
|
|
isr_label 6
|
|
isr_label 7
|
|
isr_label 8
|
|
isr_label 9
|
|
isr_label 10
|
|
isr_label 11
|
|
isr_label 12
|
|
isr_label 13
|
|
isr_label 14
|
|
isr_label 15
|
|
isr_label 16
|
|
isr_label 17
|
|
isr_label 18
|
|
isr_label 19
|
|
isr_label 20
|
|
isr_label 21
|
|
isr_label 22
|
|
isr_label 23
|
|
isr_label 24
|
|
isr_label 25
|
|
isr_label 26
|
|
isr_label 27
|
|
isr_label 28
|
|
isr_label 29
|
|
isr_label 30
|
|
isr_label 31
|
|
isr_label 32
|
|
isr_label 33
|
|
isr_label 34
|
|
isr_label 35
|
|
isr_label 36
|
|
isr_label 37
|
|
isr_label 38
|
|
isr_label 39
|
|
isr_label 40
|
|
isr_label 41
|
|
isr_label 42
|
|
isr_label 43
|
|
isr_label 44
|
|
isr_label 45
|
|
isr_label 46
|
|
isr_label 47
|
|
isr_label 48
|
|
isr_label 49
|
|
|
|
isr_main:
|
|
; ok, here, we need to duplicate the top item on the stack
|
|
; (the old eax) if the interrupt number is not 8 or 10-14
|
|
; this is to properly align the stack for both exceptions
|
|
; having and not having error codes
|
|
cmp eax, 8
|
|
jz isr_main_nodup ; if int=8, no dup
|
|
cmp eax, 10
|
|
jb isr_main_dup ; if int<10, dup
|
|
cmp eax, 14
|
|
jbe isr_main_nodup ; if int<=14, no dup
|
|
isr_main_dup: ; else dup
|
|
sub esp, 4
|
|
push eax
|
|
mov eax, [esp+8]
|
|
mov [esp+4], eax
|
|
pop eax
|
|
isr_main_nodup:
|
|
push ebx
|
|
push ecx
|
|
push edx
|
|
push edi
|
|
push esi
|
|
push ebp
|
|
push ds
|
|
push es
|
|
push fs
|
|
push gs
|
|
|
|
push esp
|
|
push eax ;interrupt number
|
|
call _isr
|
|
add esp, 8
|
|
|
|
pop gs
|
|
pop fs
|
|
pop es
|
|
pop ds
|
|
pop ebp
|
|
pop esi
|
|
pop edi
|
|
pop edx
|
|
pop ecx
|
|
pop ebx
|
|
add esp, 4 ;bypass error code
|
|
pop eax ;original saved eax
|
|
|
|
iret
|
|
|