Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
772 views
in Technique[技术] by (71.8m points)

acpi - How to reboot in x86 assembly from 16 bit real mode?

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...