-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathboot.S
51 lines (32 loc) · 926 Bytes
/
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
49
50
51
# set magic number to 0x1BADB002 to identified by bootloader
.set MAGIC, 0x1BADB002
# set flags to 0
.set FLAGS, 0
# set the checksum
.set CHECKSUM, -(MAGIC + FLAGS)
# set multiboot enabled
.section .multiboot
# define type to long for each data defined as above
.long MAGIC
.long FLAGS
.long CHECKSUM
# set the stack bottom
stackBottom:
# define the maximum size of stack to 512 bytes
.skip 512
# set the stack top which grows from higher to lower
stackTop:
.section .text
.global _start
.type _start, @function
_start:
# assign current stack pointer location to stackTop
mov $stackTop, %esp
# call the kernel main source
call KERNEL_MAIN
cli
# put system in infinite loop
hltLoop:
hlt
jmp hltLoop
.size _start, . - _start