I have the problem that my irq code isn´t called in qemu although it is called in bochs and some other other code of me is working.
1st this is my code:
Code: Select all
#define PIC_MASTER_PORT 0x20
#define PIC_SLAVE_PORT 0xa0
#define PIC_ICW1 0x11
#define PIC_ICW2_MASTER 0x20
#define PIC_ICW2_SLAVE 0x28
#define PIC_ICW3_MASTER 0x04
#define PIC_ICW3_SLAVE 0x02
#define PIC_ICW4 0x01
void picInit() {
//init the pic
outb(PIC_MASTER_PORT,PIC_ICW1);
outb(PIC_SLAVE_PORT,PIC_ICW1);
outb(PIC_MASTER_PORT+1,PIC_ICW2_MASTER);
outb(PIC_SLAVE_PORT+1,PIC_ICW2_SLAVE);
outb(PIC_MASTER_PORT+1,PIC_ICW3_MASTER);
outb(PIC_SLAVE_PORT+1,PIC_ICW3_SLAVE);
outb(PIC_MASTER_PORT+1,PIC_ICW4);
outb(PIC_SLAVE_PORT+1,PIC_ICW4);
//mask all the irqs
outb(PIC_MASTER_PORT+1,0xff);
outb(PIC_SLAVE_PORT+1,0xff);
}
void picUnMask(uint8t irq) {
uint8t res;
if(irq < 8) {
res= inb(PIC_MASTER_PORT+1);
outb(PIC_MASTER_PORT+1,res & ~(1 << irq));
} else {
res= inb(PIC_SLAVE_PORT+1);
outb(PIC_SLAVE_PORT+1,res & ~(1 << (irq - 8)));
}
}
void idtSetInt(uint32t interupt, void *base, uint8t sel, uint8t flags) {
struct idt_entry_t *idtEntry= (struct idt_entry_t *)(IDT_ADDR + (interupt << 3));
idtEntry->baseLo= (uint16t)((uint32t)base & 0xffff);
idtEntry->sel= sel;
idtEntry->flags= flags;
idtEntry->baseHi= (uint16t)((uint32t)base >> 16);
}
void kbdInit() {
idtSetInt(0x21,kbdIRQidt,8,0x8e);
picUnMask(1);
}
Code: Select all
kbdIRQidt:
pushad
; call kbdIRQFunc
add byte[0xb8002],1
in al,0x60
mov al,0x20
out 0x20,al
popad
iret
Is there something I miss?
Edit::
First I call "picInit()", then "kbdInit()" and then I enable ints.