about summary refs log tree commit diff
path: root/src/bootloader
diff options
context:
space:
mode:
Diffstat (limited to 'src/bootloader')
-rw-r--r--src/bootloader/boot.s33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/bootloader/boot.s b/src/bootloader/boot.s
new file mode 100644
index 0000000..0bb10d5
--- /dev/null
+++ b/src/bootloader/boot.s
@@ -0,0 +1,33 @@
+; Multiboot header
+MBALIGN  equ  1 << 0
+MEMINFO  equ  1 << 1
+FLAGS    equ  MBALIGN | MEMINFO
+MAGIC    equ  0x1BADB002
+CHECKSUM equ -(MAGIC + FLAGS)
+ 
+section .multiboot
+align 4
+	dd MAGIC
+	dd FLAGS
+	dd CHECKSUM
+ 
+; Setup stack
+section .bss
+align 16
+stack_bottom:
+resb 16384 ; 16 KiB
+stack_top:
+ 
+section .text
+global _start:function (_start.end - _start)
+_start:
+	; Initialize stack
+	mov esp, stack_top
+ 
+	extern kmain
+	call kmain
+ 
+	cli
+.inf:	hlt
+	jmp .inf
+.end: