summaryrefslogtreecommitdiff
path: root/builtin_reboot.asm
diff options
context:
space:
mode:
Diffstat (limited to 'builtin_reboot.asm')
-rw-r--r--builtin_reboot.asm29
1 files changed, 29 insertions, 0 deletions
diff --git a/builtin_reboot.asm b/builtin_reboot.asm
new file mode 100644
index 0000000..54d6f8a
--- /dev/null
+++ b/builtin_reboot.asm
@@ -0,0 +1,29 @@
+%ifndef _BUILTIN_REBOOT_ASM
+%define _BUILTIN_REBOOT_ASM
+
+builtin_reboot:
+ mov bx, 3 ; number of seconds
+ .countdown:
+ push bx
+ push .msg_reboot_count
+ call printf
+ add sp, 2 * 2
+
+ mov ah, 86h
+ mov cx, 0fh
+ mov dx, 4240h
+ int 15h
+
+ dec bx
+ jne .countdown
+
+ push .msg_reboot
+ call printf
+ add sp, 2 * 1
+
+ jmp 0FFFFh:0000h ; issue reboot
+ .msg_reboot_count db 'rebooting in %d seconds...\r', 0
+ .msg_reboot db '\nreboot...\n', 0
+ ; no return, and the stack is irrelevant here
+
+%endif