如何彻底暂停处理器? [英] How to completely suspend the processor?
问题描述
我正在写一个基于x86的PC小引导程序。问题是CPU在执行这些指令后莫名其妙地仍然有效:
I'm writing a small bootloader for an x86 based PC. The problem is that the CPU is somehow still active after executing these instructions:
sti
hlt
STI 应该禁止中断的下一条指令结果
HLT 应该完全停止处理器
sti is supposed to disable interrupts for the next instruction
hlt is supposed to completely halt the processor
由于它们一起使用时,我以为他们只会冻结计算机。但是,当我组装它并将它安装在VirtualBox中的软盘映像,我的CPU跳转到100%。
Since they're used together, I assumed they would just 'freeze' the computer. But when I assemble it and mount it in VirtualBox as a floppy image, my CPU jumps to 100%.
我在做什么错了?
推荐答案
我觉得你是一个有点困惑这两个命令。
I think you are a bit confused about both of these commands.
的 STI
命令启用中断和CLI命令禁用它们。
The sti
command enables interrupts and the cli command disables them.
暂停状态类似于一个空闲循环,因此不会暂停处理器。
The halt state is similar to an idle loop, so it doesn't suspend the processor.
下面有一些链接,可以帮助你:
在STI / CLI命令的信息:<一href=\"http://en.wikipedia.org/wiki/STI_%28x86_instruction%29\">http://en.wikipedia.org/wiki/STI_%28x86_instruction%29
Here are some links that may help you: Info on the STI/CLI commands: http://en.wikipedia.org/wiki/STI_%28x86_instruction%29
信息上的x86指令:<一href=\"http://en.wikipedia.org/wiki/X86_instruction_listings\">http://en.wikipedia.org/wiki/X86_instruction_listings
从这里有到 HLT
命令,可以帮助的链接。
Info on the x86 instructions: http://en.wikipedia.org/wiki/X86_instruction_listings
From here there is a link to the hlt
command that may help.
如果您暂停处理器,你怎么又来唤醒它,如果禁用中断?
If you suspend the processor, how do you wake it up again, if you disable the interrupts?
这篇关于如何彻底暂停处理器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!