Questions about hlt instruction
Posted: Fri May 23, 2003 4:12 am
Hi,
I am under the impression that when you have an idle thread it should use the hlt instruction to "pause" the cpu.
Question 1:
If an idle thread gets halted, and an interrupt for the disk occurs (as an example), does cpu resume at the instruction after the hlt instruction, or does it jump to the irq code?
If it resumes the code after the hlt, isn't that an unserviced interrupt?
Question 2:
It seems that hlt can only be executed by code at CPL0. What happens if you want ALL threads to run at CPL3 (using the IOPL in eflags to give access to hardware for device driver threads)? Do I have to create a "special" thread just so I can hlt the system? Is there another way??
Thanks!
I am under the impression that when you have an idle thread it should use the hlt instruction to "pause" the cpu.
Question 1:
If an idle thread gets halted, and an interrupt for the disk occurs (as an example), does cpu resume at the instruction after the hlt instruction, or does it jump to the irq code?
If it resumes the code after the hlt, isn't that an unserviced interrupt?
Question 2:
It seems that hlt can only be executed by code at CPL0. What happens if you want ALL threads to run at CPL3 (using the IOPL in eflags to give access to hardware for device driver threads)? Do I have to create a "special" thread just so I can hlt the system? Is there another way??
Thanks!