Software Archive
Read-only legacy content

HLT vs JMP $

vikranth958
Beginner
729 Views

Hi,

Can anybody help me know the difference between HLT and JMP $ ?

Is there any possibility that NMI is generated during processor HLT state andif it occurs, how the processor reacts to it.

If NMI occurs during HLT where will the processor return after handling it.

Thanks in advance.

Regards,

Vikranth

0 Kudos
3 Replies
jim_dempsey
Beginner
729 Views

An enabled interrupt, NMI, or a reset will resume execution after the HLT.

JMP stays at JMP location

HLT is privleged of course.

Jim

0 Kudos
Sven_Olaf_K_
Beginner
729 Views

how about:

WAITFOREVER:

HLT

JMP WAITFOREVER

not sure on energy efficiency but i'd think HLT when no interrupts take place takes less effort than bouncing the jmp to itself all the time. (someone from intel is kindly invited to give energy efficiency details on both methods for all models, 8088 and up :P (it's probably a lot different for newer cpus with powersaving modes and tons of cache inside).. it can just sit there and wait for an interrupt and do nothing but on the other hand, compared to the JMP to itself, on that last one the instruction pointer doesn't change, not sure what takes more 'effort' for the cpu and therefore more power.

0 Kudos
SergeyKostrov
Valued Contributor II
729 Views
>>...HLT is privleged of course. This is a right point. Another thing is that HLT will be executed in a context of the current thread pinned to some logical CPU that executes that thread. Could you explain why do you need to execute HLT instruction instead of PAUSE?
0 Kudos
Reply