is it normal to crash when enable interrupts?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
combate
Posts: 2
Joined: Fri Oct 10, 2008 3:05 am

is it normal to crash when enable interrupts?

Post 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
Craze Frog
Member
Member
Posts: 368
Joined: Sun Sep 23, 2007 4:52 am

Re: is it normal to crash when enable interrupts?

Post by Craze Frog »

It is normal.
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: is it normal to crash when enable interrupts?

Post 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
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Re: is it normal to crash when enable interrupts?

Post 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
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: is it normal to crash when enable interrupts?

Post 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)
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply