I want to change idt table. I disable all irqs. and here is my structures and codes. But when I execute an interrupt, I get int13 error.
My interrupt descriptor and register structures:
Code: Select all
typedef struct {
word offset_l;
word selector;
byte param_cnt;
byte access;
word offset_h;
} InterruptDescriptor;
typedef struct {
word limit;
dword base;
} IDTR;
Code: Select all
extern void isr_00_wrapper();
void SetIDTEntry (InterruptDescriptor *item, word selector, dword offset, byte access, byte param_cnt) {
item->selector = selector;
item->offset_l = offset & 0xFFFF;
item->offset_h = (offset >> 16) & 0xFFFF;
item->access = access;
item->param_cnt = param_cnt;
}
void intoc()
{
OutTextXY(10, 10, "Interrupt occured...");
for(;;); //print and hang here..
}
int main(void)
{
InterruptDescriptor idt[256];
IDTR idtr;
int a;
disable();
InitPIC(0x20, 0x28);
for(a=0; a<256;a++)
SetIDTEntry (&idt[a], 0x08, (word)&isr_00_wrapper, ACS_INT, 0);
idtr.base = (word)&idt;
idtr.limit = sizeof(idt)-1;
lidt (&idtr);
enable();
CallInt(0x15);
for(;;);
return -1;
}
Code: Select all
_lidt:
lidt [esp+4]
ret
_isr_00_wrapper:
push ds
push es ; saving segment registers and
pusha ; other regs because it's an ISR
mov ax, 10h
mov ds, ax
mov es, ax ; load ds and es with valid selector
call _intoc ; call actual ISR code
popa ; restoring the regs
pop es
pop ds
ret