In x86 Real Mode rebooting is very simple. You can either use the BIOS or:
jmp 0xFFFF:0000
But how should one reboot when in Protected Mode?
In x86 Real Mode rebooting is very simple. You can either use the BIOS or:
jmp 0xFFFF:0000
But how should one reboot when in Protected Mode?
Although I can't find a direct reference, the guys over on the OSDev forums suggested the following (apparently pulled from Linux code):
;Forcing reboot with keyb controller ;)
_reboot:
WKC:
XOR AL, AL
IN AL, 0x64
TEST AL, 0x02
JNZ WKC
MOV AL, 0xFC
OUT 0x64, AL
Information on PORT 0xCF9.
In order to write to it, one needs access to kernel mode (Meaning from a kernel driver).
0xCF9 port can get three values for three types of reset:
Writing 4 to 0xCF9:(INIT) Will INIT the CPU. Meaning it will jump to the initial location of booting but it will keep many CPU elements untouched. Most internal tables, chaches etc will remain unchanged by the Init call (but may change during it).
Writing 6 to 0xCF9:(RESET) Will RESET the CPU with all internal tables caches etc cleared to initial state.
Writing 0xE to 0xCF9:(RESTART) Will power cycle the mother board with everything that comes with it.
Example in a windows driver:
__outbyte(0xCF9, 0xE);
The proper way to reboot on protected mode (x86 or x86_64) is to use the power management functions (if available)
The quick and dirty way is to do triple fault.
I used to write 6 to port 0xcf9, but here is a bigger list: http://smackerelofopinion.blogspot.nl/2009/06/rebooting-pc.html?m=1
Although I can't find a direct reference, the guys over on the OSDev forums suggested the following (apparently pulled from Linux code):
;Forcing reboot with keyb controller ;)
_reboot:
WKC:
XOR AL, AL
IN AL, 0x64
TEST AL, 0x02
JNZ WKC
MOV AL, 0xFC
OUT 0x64, AL
© 2022 - 2024 — McMap. All rights reserved.