2

In the x86 computer architecture, HLT (halt) pauses the CPU until the next hardware interrupt occurs. So HLT doesn't really halt the computer; it pauses it.

Was there ever a true x86 (or even /64) halt instruction, Which I guess I'd have to define as a state in which it does no processing at all and blanks the display until the system is restarted?

I think about how our old TV set never turned off; it just blanks the screen. To turn off the TV you have to unplug it.

I want to distinguish it from a screen lock.

11
  • 1
    Not exactly an instruction, but telling the AHCI Chipset to go to the G1/G2 states is about the closest. Since why do that if you aren't also going to shutdown the rest of the PC. Commented Oct 25 at 14:00
  • 2
    Disabling all interrupts and then executing HLT does what you describe. What else are you looking for? What would be the point of doing anything more than that?
    – Dave Tweed
    Commented Oct 25 at 14:40
  • 7
    It's hard to see how you could have a CPU instruction which was defined to blank the display, as the display hardware is independent of the CPU and there's no way for the CPU to know its hardware interface. The machine might not even have one. That seems clearly like something for software to do. Commented Oct 25 at 14:59
  • 3
    From the CPU perspective, G2 is fully shutdown. All the wake on LAN stuff is handled by the AHCI chipset, and from the CPUs perspective, a wake on LAN is the same as being started with the power button. You'll need to clarify what you mean by 'shutdown'. Commented Oct 25 at 15:13
  • 1
    To clarify, if you just plug an AHCI computer in and don't turn it on, G2 is the state its sitting in. Commented Oct 25 at 17:03

1 Answer 1

8

The x86 CPUs has had a HLT instruction ever since 8088. So it's the CPU tha halts, not a PC or anything else around the CPU, be it in a PC or any other type of computer.

It simply makes the CPU to pause or stop execution, until the CPU is reset or there is an interrupt request - which of course requires that interrupts are left enabled on the CPU and interrupt controller, and some peripheral is actually requesting an interrupt (such as system timer). So if you disable interrupts with CLI before running HLT, the CPU will never come out of halt state unless you push the reset button or turn it off.

Having a CPU instruction to halt display generation is impossible, PC video adapters keep doing what they were doing unless they are programmed to do something else like not to generate video, but that won't be a single CPU instruction, simply IO register writes like you normally would write video card registers.

In short, there cannot be a single x86 CPU instruction that would blank a display in a PC. It's not the job of CPU to have anything to do with display generation on PCs, it's the job of the video adapter and the program code that executes on the CPU can affect the display generation with standard IO and memory accesses.

If you wanted, you could make some program code that controls the display adapter to disable itself somehow, such as output blank screen without cursor or anything, or even stop outputing sync pulses to the display. That's actually how DPMS monitors know when to sleep and in which mode, depending on if H or V sync or both are missing. The next thing your program could do is to run CLI and HLT to halt CPU until powered off or reset.

TVs also did really turn off instead of just going blank. When turned off, or in standby, there will be no power on CRT driving circuits, i.e. the electron gun and deflection coils. It would make no sense to keep scanning the display with black lines when it is supposed to be off.

Edit to be crystal clear on this : there is no single CPU instruction that will make a whole PC computer with all it's subsystems halt. The HLT instruction is just for the CPU like any other instruction and it just halts the CPU. Other parts of the PC such as timers, interrupt controllers, DMA controllers, real-time clocks, video adapter, sound card, etc keep doing what they where programmed to do by the CPU, so these subsystems don't care if the CPU is executing calculations, running an idle loop, or halted.

Therefore, if you execute a CLI and HLT in the middle of a DOS game loading from floppy, you will get frozen video showing a static frame buffer, maybe looping audio sample buffer or sample playback stops after the current buffer depending on sound card and how it was set up play with DMA, stuck FM or MIDI notes that continue to play forever, floppy drive motor left turned on as there is no CPU counting timer interrupts and controlling the floppy motor to turn off after a few seconds of idling.

4
  • 1
    If you look at all the HALT instructions that exist, it really means "do nothing until something happens". In some cases this can be accompanied by a low power state, but there will always be somewhere a state machine which monitors the interrupts, so that the CPU can continue again, guided by the respective interrupt vectors.
    – chthon
    Commented Oct 26 at 6:57
  • 2
    @chthon I agree. But it's strictly about the CPU that halts with HLT instruction. Not the whole device where the CPU happens to be in, a PC computer, other non-PC computer, or embedded into some appliance like an oscilloscope or smart fridge. And the scope of this question was PCs, not other devices.
    – Justme
    Commented Oct 26 at 7:49
  • A "total halt" instruction was present in PDP-11. It was deliberately given code 0. This was seconded in VAX. But I donʼt remember a later archirecture with repeating of this technique.
    – Netch
    Commented Oct 29 at 5:56
  • And this is why rather than a Halt instruction, this need (controlled shutdown), was addressed by a combination of firmware APIs and chipset control interfaces. Because that then allows all of these extra things to be be instructed to shutdown. Commented Oct 29 at 11:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .