Page 1 of 1

>>PANIC<< WARNING: HLT instruction with IF=0!

Posted: Fri Jul 28, 2006 5:28 am
by spix
Hi there,

I was thinking about how to stop the computer when my OS panics or shuts down, and I thought seeming "hlt" stops the processor until an interrupt occurs, and if i disable interrupts well it won't start again.

I noticed a lot of people do something like "while(1);" to halt, but I was thinking that the processor would be running all the time getting hot when it was supposed to be shut down, which is why i thought hlt would be a good idea.

Bochs doesn't like it though, it panics and quits. Have I done something bad? or do I need to upgrade bochs or something?

Thanks

Re:>>PANIC<< WARNING: HLT instruction with IF=0!

Posted: Fri Jul 28, 2006 5:37 am
by ineo
No you did nothing wrong I think.
I have the same with my code. I believe Bochs just know that the CPU is halted forever ;) And that's what you want isn't it ?

However I added a while(1) loop around the HLT since it seems on some hardware the CPU is able to go out of the HLT even if you mask interrupts.

Re:>>PANIC<< WARNING: HLT instruction with IF=0!

Posted: Fri Jul 28, 2006 5:56 am
by ed_tait
Its proberbly the way bochs i configured for you. when i execute

cli
hlt

bochs says:

warning: hlt instruction when if=0

you should be able to change the way it responds to cli hlt in bochsrc.txt. It should tell you what to do in the documentation.

Re:>>PANIC<< WARNING: HLT instruction with IF=0!

Posted: Fri Jul 28, 2006 7:24 am
by paulbarker
Try (in your bochsrc):

debug: action=ignore
panic: action=ask
error: action=report
info: action=report

-or-

debug: action=ignore
panic: action=fatal
error: action=ask
info: action=report

I think, though I'm not sure, it's the "debug" action that will be invoked when this warning is raised. The first of the 2 is from my bochsrc, the second I think I found on an FAQ somewhere. Play around with the actions and see what you get.

Setting these actions also helps with the "CPU_LOOP 1" messages and even fixed a segfault on my machine so I consider it good practice to always set the actions to what you want instead of relying on the defaults.

Re:>>PANIC<< WARNING: HLT instruction with IF=0!

Posted: Fri Jul 28, 2006 7:50 am
by spix
Thanks for the info, I'll fix the debug settings. I just wasn't sure if I was doing the right thing because it paniced.

Thanks again

Re:>>PANIC<< WARNING: HLT instruction with IF=0!

Posted: Fri Aug 04, 2006 9:26 pm
by earlz
yes notice it says warning instead of error
btw
IF is Interrupt Flag