Page 1 of 1

is it normal to crash when enable interrupts?

Posted: Mon Oct 13, 2008 12:01 pm
by combate
im new to os programming, my kernel its very simple, it justs print to screen and halt. i didn't setup any idt or interrupt handling so far. so, my question, why the OS crash when i enable interrupts.

this is what i got

Code: Select all

void kmain(void)
{
	iniciarVideo();

	puts("HELLO WORLD\n");

	asm("sti");

	for (;;);
}
with the asm("sti"); the kernel crash and this is what appear in bochslog

Code: Select all

00009781417i[CPU0 ] >> add byte ptr ds:[eax], al : 0000
00009781417e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
is it normal or i got any bug code somewhere in kernel?

thanks

Re: is it normal to crash when enable interrupts?

Posted: Mon Oct 13, 2008 12:17 pm
by Craze Frog
It is normal.

Re: is it normal to crash when enable interrupts?

Posted: Mon Oct 13, 2008 12:35 pm
by Troy Martin
Oh hellz yeah, it's normal. It's because you don't have any handlers for interrupts, causing them to fire off and crash without anything to do. Until you have handlers written, never enable interrupts. It's the golden rule. :P

Re: is it normal to crash when enable interrupts?

Posted: Mon Oct 13, 2008 12:52 pm
by piranha
You need to have the interrupt handling enabled.
(Crashing shouldn't be normal most of the time)

Look >Here< or >Here<

Once you set those up, and write handlers, and do the necessary stuff it shouldn't crash.

-JL

Re: is it normal to crash when enable interrupts?

Posted: Mon Oct 13, 2008 1:51 pm
by Combuster
add byte ptr ds:[eax], al : 0000
That usually means your code is somewhere you don't want it (in a pagefull of zeroes most likely)