Live data from Hacker News

5 ways to reboot a PC. None of them reliable.

mjg59.livejournal.com

21–30 of 35 posts

Re: 5 ways to reboot a PC. None of them reliable.

#21
post #18

Earlier quoted context omitted.

An actual IBM-PC could reliably be rebooted using the keyboard controller (as mentioned in the article). The issues come with IBM-PC "compatible" machines. I'm sure commodore would have the same problem if anyone had bothered to clone them.

To be more precise, an IBM PC-AT. It is closely related to the A20 line enable.

Why should anyone need to mess with the A20 line and the keyboard controller to simply reset a computer?

Re: 5 ways to reboot a PC. None of them reliable.

#22
post #5

Method 6: return to 16-bit mode, call interrupt 0x19 (not if you're on efi). Method 7: return to 16-bit mode, set cs to 0xf000 and jump to 0xfff0. Linux used to use method 6, but it wasn't reliable either. Something tells me returning to 16-bit mode might not be possible for some hardware / driver combinations.

Could you explain in more detail how these trigger a reboot? From writing a 32-bit kernel I understand how the triple fault method is supposed to work, for example, but would love to know a little more about these methods.

int 19 should just execute code in the BIOS that triggers a reboot. Setting CS and jumping is re-entering the BIOS at the same entry point as at power-on. The BIOS should then reinit all the hardware.

Re: 5 ways to reboot a PC. None of them reliable.

#23
post #5

Method 6: return to 16-bit mode, call interrupt 0x19 (not if you're on efi). Method 7: return to 16-bit mode, set cs to 0xf000 and jump to 0xfff0. Linux used to use method 6, but it wasn't reliable either. Something tells me returning to 16-bit mode might not be possible for some hardware / driver combinations.

Jumping to the BIOS is not a reliable reboot method either (method 7). Because the BIOS assumes hardware in a hardware-reset state, and the OS left it in some other state.

Tried to get an OS on a PC to soft-reboot, failed, because it is not actually possible to return all hardware to the reset state in some cases - they have an initial power-on state and once programmed can never return there unless hard-reset.

And why does the BIOS require hardware in the hard-reset state? Because a BIOS is never tested in a soft-reset scenarios, because Windows doesn't require it. And "if you haven't tried it, it doesn't work".

Re: 5 ways to reboot a PC. None of them reliable.

#24
post #21
post #18

Earlier quoted context omitted.

To be more precise, an IBM PC-AT. It is closely related to the A20 line enable.

Why should anyone need to mess with the A20 line and the keyboard controller to simply reset a computer?

Well, you do need to turn on A20 so it will jump to right address, but if you are in protected mode it should already be on.

Re: 5 ways to reboot a PC. None of them reliable.

#25
post #24
post #21

Earlier quoted context omitted.

Why should anyone need to mess with the A20 line and the keyboard controller to simply reset a computer?

Well, you do need to turn on A20 so it will jump to right address, but if you are in protected mode it should already be on.

Isn't that kludgy? I mean, using a keyboard controller (in effect, a second computer) to reset the one you can't?

Re: 5 ways to reboot a PC. None of them reliable.

#26
post #5

Method 6: return to 16-bit mode, call interrupt 0x19 (not if you're on efi). Method 7: return to 16-bit mode, set cs to 0xf000 and jump to 0xfff0. Linux used to use method 6, but it wasn't reliable either. Something tells me returning to 16-bit mode might not be possible for some hardware / driver combinations.

Jumping to the BIOS is not a reliable reboot method either (method 7). Because the BIOS assumes hardware in a hardware-reset state, and the OS left it in some other state. Tried to get an OS on a PC to soft-reboot, failed, because it is not actually possible to return all hardware to the reset state in some cases - they have an initial power-on state and once programmed can never return there unless hard-reset. And w…

Note that this way of rebooting was common in DOS though.

Re: 5 ways to reboot a PC. None of them reliable.

#27

I don't know if anyone else remembers, but I think it was either Windows 95 or Windows 98 which, after selecting shut down, the eventual result would be a message that said, "It is now safe to turn off your computer." I remember thinking it was magic when the computer would actually turn itself off at this point. This article provides a good explanation for why that behavior was necessary.

Yup, I remember that. IIRC when this screen was displayed, the system was actually at a DOS prompt, just not in character mode. You could type "win" to restart windows for instance, and I think there was some magic command to reset the display adapter and get a working DOS prompt.

Re: 5 ways to reboot a PC. None of them reliable.

#29
post #19

I don't know if anyone else remembers, but I think it was either Windows 95 or Windows 98 which, after selecting shut down, the eventual result would be a message that said, "It is now safe to turn off your computer." I remember thinking it was magic when the computer would actually turn itself off at this point. This article provides a good explanation for why that behavior was necessary.

Power off uses APM or ACPI and is not related.

"How to shut down a PC" no mention of Linux, but apparently that is the topic.

But since it's not mentioned in the topic, it's going to come up. Personally I use a batch file and SysInternals to shutdown (after forcing bad-behavior apps to exit).

Sounds like you need a SysInternals for Linux??

Re: 5 ways to reboot a PC. None of them reliable.

#30
post #25
post #24

Earlier quoted context omitted.

Well, you do need to turn on A20 so it will jump to right address, but if you are in protected mode it should already be on.

Isn't that kludgy? I mean, using a keyboard controller (in effect, a second computer) to reset the one you can't?

The reason was that IBM bought the rest of the chips "as they were" from Intel, so all the logic that they made themselves ended in the in-house keyboard controller. x86 had an external interrupt line for reset, and an io pin in the keyboard controller was tied to this. That was a reasonable way to get true hard reset back then.
Post reply on HN