|This article was nominated for deletion on 13 August 2018. The result of the discussion was no consensus.|
|WikiProject Computing / Hardware||(Rated Start-class, Mid-importance)|
- HaLT. --Android Mouse 07:07, 24 July 2007 (UTC)
HLT/HALT on other processorsEdit
Other CPUs, such as the Z80, PDP-7, etc. have HLT instructions. The VAX, M68k, MIPS, etc. have HALT instructions. Since this article is titled HLT, not HLT (x86) or HLT (Intel), it should describe the uses of HALT instructions on CPUs besides the x86. 22.214.171.124 (talk) 03:56, 28 September 2010 (UTC)
On many processors it is expected that HLT will be used outside of Ring 0. However no additional silicon is required to implement that.
The convention in many operating systems is that HLT marks the end of the execution of the user's program. Upon that HLT instruction the processor would raise a software interrupt, returning control from the user's job back to the operating system.
However it is a simple optimisation to note that no special implementation is needed for HLT to operate outside Ring 0 to mark the end of the job. In this case, when the HLT instruction is run a software interrupt will be raised to mark an unauthorised use of an instruction, and control returned to the operating system. The operating system can then inspect the instruction at fault, note that it is HLT, and treat that as marking the ordinary end of the user's job.
This optimisation means that from reading the datasheet alone people are misled into thinking that HLT only has a use inside Ring 0. Whereas that isn't the case at all.
The original convention that HLT marks the end of a user program comes from computers with no operating systems. On these computers the job would end with a HLT instruction. That instruction would light the "HLT" light on the console: this light was readily apparent and often accompanied by a buzzer. The operator could then prepare the next job to be run. Gdt (talk) 04:33, 19 May 2016 (UTC)
Also of interest is the binary value of the HLT instruction. Many instruction sets ensure that the HLT instruction is a word in length with value 0. Thus a program which starts running in uninitialised memory strikes a HLT instruction and the program ends. This protection is less useful if the computer has virtual memory (where an errant program will eventually strike an invalid address). On older console computers having HLT with a value of zero would also lead to the computer immediately returning to the halted state should the operator flick the "Halt/Run" switch to "Run" with no program loaded. Gdt (talk) 04:46, 19 May 2016 (UTC)