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

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
User avatar
spix
Member
Member
Posts: 128
Joined: Mon Jun 26, 2006 8:41 am
Location: Millicent, South Australia
Contact:

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

Post 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
ineo

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

Post 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.
ed_tait

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

Post 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.
paulbarker

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

Post 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.
User avatar
spix
Member
Member
Posts: 128
Joined: Mon Jun 26, 2006 8:41 am
Location: Millicent, South Australia
Contact:

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

Post 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
earlz

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

Post by earlz »

yes notice it says warning instead of error
btw
IF is Interrupt Flag
Post Reply