enabling interrupts?
Posted: Mon Feb 24, 2003 10:19 am
What are the necessary steps in order to enable interrupts in protected mode?
The Place to Start for Operating System Developers
http://f.osdev.org/
YEs, though it would be less funnyCould we stay on topic here.
Just get an array of N*8 bytes, with N>48 so that you're sure you can at least have an entry for every exception and IRQ.Pype.Clicker wrote: - have a valid IDT installed
This will be done through the Programmable Interrupt Controller (intel 8259A).- remap IRQ to some 'free' place (in real mode, they use 8..15 for IRQ0..7. in pmode, these slots are used by exceptions)
Code: Select all
Set8259A:
;[PROC]============================================================
;== Set 8255A interrupts vectors
;== Input: Bl= interrupt vector for IRQ0
;== Bh= interrupt vector for IRQ8
;==================================================================
push eax
push edx
mov al,11h
out 20h,al ;ICW1:=__init__ ;master
out 0A0h,al ;ICW1:=__init__ ;slave
call __wait
mov al,bl
out 21h,al ;ICW2:=irq0slot
mov al,bh
out 0A1h,al ;ICW2:=irq8slot
call __wait
mov al,4 ;bit 2 set => master recieves on irq 2
out 21h,al ;ICW3:=IRQ2 (Attach)
mov al,2 ;valeur=2 => slave sends to irq 2
out 0A1h,al ;ICW3:=IRQ2 (Attach)
call __wait
mov al,0xd
out 21h,al ;ICW4:=IntelEnvironnement
mov al,9
out 0A1h,al ;ICW4:=IntelEnvironnement
call __wait
pop edx
pop eax
ret
__wait:
%ifdef __IN_WAIT__
in al,21h ;just a tiny delay to let the bus resting
in al,0A1h ;Should be enough on any architecture
%else
push ecx
mov ecx,4096
.here: loop .here
pop ecx
%endif
ret
Get a match box or possibly a lighter and ... err .. waitaminute ...- light a candle and pray
just re-enables the hardware interrupts. Maybe you'll wish to mask most of them until you actually have a valid driver installed, which you can also do with the "mask" feature of 8259A -- accessed through port 0x21 in normal operations mode.- STI.