]>
wirehaze git hosting - BOS.git/blob - kernel/int/idt.asm
1 ;----------------------------------------------------------;
2 ; BOS kernel Christoffer Bubach, 2003-2015. ;
3 ;----------------------------------------------------------;
5 ; Set/modify IDT entries ;
7 ;----------------------------------------------------------;
9 ;-----------------------------------------------------;
11 ; IDT entry structure ;
13 ; 16bit - entry offset bits 0..15 ;
14 ; 16bit - code segment selector in GDT or LDT ;
15 ; 8bit - unused, set to 0 ;
16 ; 8bit - type and attributes ;
17 ; - 0xE = 32bit intterrupt ;
18 ; - 0x8 = Present bit = 1 ;
19 ; 16bit - entry offset bits 16..31 ;
21 ; middle section for code segment 08 = 0x8E000008 ;
22 ;-----------------------------------------------------;
25 ;--------------------------------------------------;
27 ; in: esi = pointer to "unhandled int"-function. ;
28 ;--------------------------------------------------;
36 add edi, [idtr
.address
]
37 .l1: ; loop full IDT table
39 mov word [edi], ax ; set handler lower offset
42 mov dword [edi], 0x8E000008 ; set IDT segment and attributes
47 mov word [edi], ax ; set handler high offset
51 cmp cx, word [idtr
.size
] ; 256 ints
61 ;--------------------------------------;
62 ; modify IDT, set any int ;
63 ; in: cl = int number ;
64 ; edi = int function pointer ;
65 ;--------------------------------------;
70 mov al, 8 ; 8 bytes for each int
72 movzx ecx, ax ; ecx = IDT offset
73 shr ecx, 1 ; 1/2 for dword list
74 mov dword [(idt_list
+ecx)], edi ; add to dword int list
75 movzx ecx, ax ; ecx = IDT offset
78 mov [(0x6c00+ecx)], ax
81 mov dword [(0x6c00+ecx)], 0x8E000008
86 mov [(0x6c00+ecx)], ax
94 ;------------------------------------------------;
96 ; in: cl = int number ;
97 ; out: esi = address or 0 if none present ;
98 ;------------------------------------------------;
102 mov eax, 4 ; 4 bytes for each address
103 mul cl ; cl * al = ax
113 ;----------------------------------------;
114 ; sets ints from list ;
115 ; in: esi = pointer to int list ;
116 ;----------------------------------------;
139 ;------------------------------;
140 ; list of idt entries. ;
142 ;------------------------------;
163 times 12 dd 0 ; 12 unused ints
166 times 16 dd 0 ; 16 unused ints
167 dd isr32
; First free and BOS system interrupt.
168 times 205 dd 0 ; 205 unused ints