APM shutdown has been covered at X86 instructions to power off computer in real mode?
How to reboot instead of shutting down the computer? Please quote and explain the relevant documentation / standard in your answer.
I've understood that APM and ACPI are the two main methods, and I'm interested in both. Let me know if there are others.
I have found the ACPI spec is at http://uefi.org/specifications but it's taking too much brainpower to parse it that I found it worthy of a question.
I could not find the URL for the APM spec, only a Google cache of a Microsoft RTF here.
If you need a way to test your answer, this minimal APM shutdown boot sector example may be a good starting point. The goal is to convert it to a reboot example instead.
I have read the Linux kernel 4.2 code at arch/x86/realmode/rm/reboot.S but I don't understand how it works, since I can't find the difference between those commands and my working shutdown example.
Related more generic on superuser: https://superuser.com/questions/294681/how-does-a-computer-restart-itself
Related question for protected mode: Rebooting in Protected Mode
I use the following code in a floppy-disk boot image to reset the pc if the kernel files aren't present on the boot media.
Reboot:
db 0x0ea
dw 0x0000
dw 0xffff
Which essentially assembles to the following instruction:
jmp far ptr 0FFFFh:0
I think it's a warm-reboot, i.e equivalent to hitting Ctrl-Alt-Delete, as opposed to hitting the reset button on the front of the machine.
Works on my old pc 8086:
mov ds, ax
mov ax,0000
mov [0472], ax
jmp FFFF:000
来源:https://stackoverflow.com/questions/32682152/how-to-reboot-in-x86-assembly-from-16-bit-real-mode