summaryrefslogtreecommitdiff
path: root/src/kernel/arch/i386/boot.s
blob: ea31aa1817891c9d16d8fcf54b83ed81b30ff8e2 (plain)
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
.section .text
.global _start
.type _start, @function
_start:
	mov $_bss_end, %esp // the stack is at the top of bss
	call sysenter_setup
	push %ebx // address of the Multiboot struct
	call kmain_early

.global cpu_shutdown
.type cpu_shutdown, @function
cpu_shutdown:
/* This quits QEMU. While I couldn't find this officially documented anywhere,
 * it is used by QEMU in tests/tcg/i386/system/boot.S (as of commit 40d6ee), so
 * I assume that this is safe-ish to use */
	mov $0x604, %edx
	mov $0x2000, %eax
	outw %ax, %dx

.global halt_cpu
.type halt_cpu, @function
halt_cpu:
	cli
1:	hlt
	jmp 1b