??????????????--?ж???
???????????? ???????[ 2013/8/23 10:04:59 ] ????????
????????г???????Interrupt???ж????????????????Fault??Trap??Abort??????????????????ж??????????????ж???????ж??????????????????????ж????????????????ж??????????????int n???????ж??
??????????int n?????ж?????????????????????е????????????á?
???????ж??????????Щ????????????????ж??????????????????????ж??????????£?
?????????8259A??????????IRQ0~IRQ7??????ж?????20h~27h???????IRQ8~IRQ15???????ж?????28h~2Fh????????????????????з??????
; IDT
[SECTION .idt] ;sect.idt #show#-->
ALIGN 32
[BITS 32]
LABEL_IDT:
; ?? ????????? ???? DCount?? ????
%rep 32
Gate SelectorCode32?? SpuriousHandler?? 0?? DA_386IGate
%endrep
.020h: Gate SelectorCode32?? ClockHandler?? 0?? DA_386IGate
%rep 95
Gate SelectorCode32?? SpuriousHandler?? 0?? DA_386IGate
%endrep
.080h: Gate SelectorCode32?? UserIntHandler?? 0?? DA_386IGate
IdtLen equ $ - LABEL_IDT
IdtPtr dw IdtLen - 1 ; ?ν???
dd 0 ; ?????
; END of [SECTION .idt]
[SECTION .s16]
[BITS 16]
LABEL_BEGIN:
; ????? IDTR ?????
xor eax?? eax
mov ax?? ds
shl eax?? 4
add eax?? LABEL_IDT ; eax <- idt ?????
mov dword [IdtPtr + 2]?? eax ; [IdtPtr + 2] <- idt ?????
; ???? IDTR
sidt [_SavedIDTR]
; ?????ж????μ????(IMREG)?
in al?? 21h
mov [_SavedIMREG]?? al
; ???? GDTR
lgdt [GdtPtr]
; ???ж?
;cli
; ???? IDTR
lidt [IdtPtr]
; ???????A20
in al?? 92h
or al?? 00000010b
out 92h?? al
; ????л?????????
mov eax?? cr0
or eax?? 1
mov cr0?? eax
; ????????????
jmp dword SelectorCode32:0 ; ?????????? SelectorCode32 ??? cs?? ??????? Code32Selector:0 ??
; Init8259A ---------------------------------------------------------------------------------------------
Init8259A:
mov al?? 011h
out 020h?? al ; ??8259?? ICW1.
call io_delay
out 0A0h?? al ; ??8259?? ICW1.
call io_delay
mov al?? 020h ; IRQ0 ????ж????? 0x20
out 021h?? al ; ??8259?? ICW2.
call io_delay
mov al?? 028h ; IRQ8 ????ж????? 0x28
out 0A1h?? al ; ??8259?? ICW2.
call io_delay
mov al?? 004h ; IR2 ?????8259
out 021h?? al ; ??8259?? ICW3.
call io_delay
mov al?? 002h ; ?????8259?? IR2
out 0A1h?? al ; ??8259?? ICW3.
call io_delay
mov al?? 001h
out 021h?? al ; ??8259?? ICW4.
call io_delay
out 0A1h?? al ; ??8259?? ICW4.
call io_delay
;mov al?? 11111111b ; ??????8259?????ж?
mov al?? 11111110b ; ?????????????ж?
out 021h?? al ; ??8259?? OCW1.
call io_delay
mov al?? 11111111b ; ???δ?8259?????ж?
out 0A1h?? al ; ??8259?? OCW1.
call io_delay
ret
; Init8259A ---------------------------------------------------------------------------------------------
LABEL_SEG_CODE32:
mov ax?? SelectorData
mov ds?? ax ; ??????????
mov es?? ax
mov ax?? SelectorVideo
mov gs?? ax ; ??????????
mov ax?? SelectorStack
mov ss?? ax ; ??????????
mov esp?? TopOfStack
call Init8259A
int 080h
sti
jmp $
; int handler ---------------------------------------------------------------
_UserIntHandler:
UserIntHandler equ _UserIntHandler - $$
mov ah?? 0Ch ; 0000: ??? 1100: ????
mov al?? 'I'
mov [gs:((80 * 0 + 70) * 2)]?? ax ; ????? 0 ?У? ?? 70 ?С?
iretd
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11