apm_shutdown.S 574 B

12345678910111213141516171819202122232425262728
  1. /*
  2. http://wiki.osdev.org/Shutdown
  3. http://stackoverflow.com/questions/21463908/x86-instructions-to-power-off-computer-in-real-mode
  4. http://stackoverflow.com/questions/678458/shutdown-the-computer-using-assembly
  5. http://stackoverflow.com/questions/3145569/how-to-power-down-the-computer-from-a-freestanding-environment
  6. */
  7. #include "common.h"
  8. BEGIN
  9. mov $0x5301, %ax
  10. xor %bx, %bx
  11. int $0x15
  12. /* Try to set apm version (to 1.2). */
  13. mov $0x530e, %ax
  14. xor %bx, %bx
  15. mov $0x0102, %cx
  16. int $0x15
  17. /* Turn off the system. */
  18. mov $0x5307, %ax
  19. mov $0x0001, %bx
  20. mov $0x0003, %cx
  21. int $0x15