summaryrefslogtreecommitdiff
path: root/builtin_reboot.asm
blob: 54d6f8a401183e5a317f91bd70b0c13880ee4e4a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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