Errors when setting up interrupts
Posted: Sat Sep 27, 2008 12:21 am
Hi,
I am currently trying to continue my kernel and keep on hitting the same problem.
When I try to install an interrupt descriptor table, I get triple faults when generating any form of interrupt.
Here is the relevant bit of code. From what I have picked up, you should be able to generate an interrupt using the 'int' instruction even if interrupts are currently disabled.
From the tutorials, that would seem to be the minimum needed to actually catch a Pmode interrupt. However, it is triple faulting when executing the interrupt instruction.
Just as background, It is certainly not the bootloader at fault. My bootloader runs the demo of this fine but not this one. I have also copied the project settings from that demo so its nothing to do with the configuration.
Can anyone help?
Andrew
EDIT
it seems your form doesn't like the preincremental operator following a semicolon in the loop - possibly a counter to a possible injection attack: Contents should be:
idt_table[x].baselo = ptr & 0xFFFF;
idt_table[x].basehi = (ptr >> 16);
idt_table[x].reserved = 0;
idt_table[x].sel = 0x08;
idt_table[x].flags = 0x8E;
I am currently trying to continue my kernel and keep on hitting the same problem.
When I try to install an interrupt descriptor table, I get triple faults when generating any form of interrupt.
Code: Select all
static struct idt_desc idt_table[256];
static struct idtr idt_reg;
void def_handler()
{
unsigned short * screen = (unsigned short*)0xB8000;
*screen = (unsigned short)0x0F00|'D';
for(;;);
}
bool GetIntWorking()
{
idt_reg.limit = sizeof(idt_desc)*256 -1;
idt_reg.base = (unsigned char)idt_table;
unsigned int ptr = (unsigned int)def_handler;
for(int x=0;x<256>> 16);
idt_table[x].reserved = 0;
idt_table[x].sel = 0x08;
idt_table[x].flags = 0x8E;
}
__asm lidt [idt_reg];
__asm int 0x80;
return false;
}
From the tutorials, that would seem to be the minimum needed to actually catch a Pmode interrupt. However, it is triple faulting when executing the interrupt instruction.
Just as background, It is certainly not the bootloader at fault. My bootloader runs the demo of this fine but not this one. I have also copied the project settings from that demo so its nothing to do with the configuration.
Can anyone help?
Andrew
EDIT
it seems your form doesn't like the preincremental operator following a semicolon in the loop - possibly a counter to a possible injection attack: Contents should be:
idt_table[x].baselo = ptr & 0xFFFF;
idt_table[x].basehi = (ptr >> 16);
idt_table[x].reserved = 0;
idt_table[x].sel = 0x08;
idt_table[x].flags = 0x8E;