-
Notifications
You must be signed in to change notification settings - Fork 0
/
boot.s
48 lines (40 loc) · 1.09 KB
/
boot.s
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
.set ALIGN, 1<<0 // align loaded modules on page boundaries
.set MEMINFO, 1<<1 // provide memory map
.set FLAGS, ALIGN | MEMINFO // this is the Multiboot 'flag' field
.set MAGIC, 0x1BADB002 // 'magic number' lets bootloader find the header
.set CHECKSUM, -(MAGIC + FLAGS) /* checksum of above, prevents code from accidentally
being loaded as kernel */
/*
* Implements the multiboot standard
* GRUB looks for this when bootloading.
*/
.section .multiboot
.align 4
.long MAGIC
.long FLAGS
.long CHECKSUM
// Stack
.section .bss
.align 16
stack_bottom:
.skip 16384 # 16 KiB
stack_top:
.text
.globl _start
/*
* _start is the designated function signature
* for starting the kernel via GRUB.
*/
_start:
/*
* GRUB does not initialize the stack, must
* be done manually.
*/
mov $stack_top, %esp
call kernel_entry
/*
* Do nothing.Prevents the kernel from stopping
* abruptly.
*/
l: jmp l
.size _start, . - _start