about summary refs log tree commit diff stats
path: root/kernel.soso/boot.asm
diff options
context:
space:
mode:
Diffstat (limited to 'kernel.soso/boot.asm')
-rw-r--r--kernel.soso/boot.asm51
1 files changed, 51 insertions, 0 deletions
diff --git a/kernel.soso/boot.asm b/kernel.soso/boot.asm
new file mode 100644
index 00000000..773dd0f3
--- /dev/null
+++ b/kernel.soso/boot.asm
@@ -0,0 +1,51 @@
+MBOOT_PAGE_ALIGN    equ 1<<0
+MBOOT_MEM_INFO      equ 1<<1
+MBOOT_USE_GFX       equ 1<<2
+MBOOT_HEADER_MAGIC  equ 0x1BADB002
+MBOOT_HEADER_FLAGS  equ MBOOT_PAGE_ALIGN | MBOOT_MEM_INFO | MBOOT_USE_GFX
+MBOOT_CHECKSUM      equ -(MBOOT_HEADER_MAGIC + MBOOT_HEADER_FLAGS)
+
+
+[BITS 32]
+
+
+section .multiboot
+align 4
+    dd  MBOOT_HEADER_MAGIC
+    dd  MBOOT_HEADER_FLAGS
+    dd  MBOOT_CHECKSUM
+    dd 0x00000000 ; header_addr
+    dd 0x00000000 ; load_addr
+    dd 0x00000000 ; load_end_addr
+    dd 0x00000000 ; bss_end_addr
+    dd 0x00000000 ; entry_addr
+    ; Graphics requests
+    dd 0x00000000 ; 0 = linear graphics
+    dd 1024
+    dd 768
+    dd 32
+
+section .bss
+align 16
+stack_bottom:
+resb 16384 ; 16 KiB
+stack_top:
+
+[GLOBAL _start]  ; this is the entry point. we tell linker script to set start address of kernel elf file.
+[EXTERN kmain]
+
+section .text
+
+_start:
+    mov esp, stack_top
+
+    ; push multiboot parameter to kmain()
+    push ebx
+
+    ; ...and run!
+    cli
+    call kmain
+
+    ;never reach here
+    cli
+    hlt
1fa165e38d8ec893bc191a2bbe5ce961'>356592fa ^
871c502d ^


728fb838 ^
871c502d ^

3de15ddd ^
871c502d ^








356592fa ^
ef0ee843 ^
871c502d ^
fb275079 ^



871c502d ^













0c0b9489 ^
871c502d ^


0c0b9489 ^
871c502d ^
f6dc79db ^







871c502d ^
5c210a96 ^








b5493fe4 ^

5c210a96 ^
b5493fe4 ^





5c210a96 ^




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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102