1
0

shutdown.asm 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. ;; This file is part of asmc, a bootstrapping OS with minimal seed
  2. ;; Copyright (C) 2018 Giovanni Mascellani <gio@debian.org>
  3. ;; https://gitlab.com/giomasce/asmc
  4. ;; This program is free software: you can redistribute it and/or modify
  5. ;; it under the terms of the GNU General Public License as published by
  6. ;; the Free Software Foundation, either version 3 of the License, or
  7. ;; (at your option) any later version.
  8. ;; This program is distributed in the hope that it will be useful,
  9. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. ;; GNU General Public License for more details.
  12. ;; You should have received a copy of the GNU General Public License
  13. ;; along with this program. If not, see <https://www.gnu.org/licenses/>.
  14. section .text
  15. qemu_shutdown:
  16. ;; mov edx, 0x501 ; QEMU debug shutdown (requires "-device isa-debug-exit")
  17. ;; out dx, al
  18. mov edx, 0x604 ; QEMU ACPI shutdown (see https://wiki.osdev.org/Shutdown)
  19. mov eax, 0x2000
  20. out dx, ax
  21. ret
  22. shutdown:
  23. call qemu_shutdown
  24. hlt
  25. jmp shutdown