summaryrefslogtreecommitdiffstats
path: root/kernel/entry.asm
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-11-03 00:15:58 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-11-03 00:15:58 +0100
commita71fe5ed5d709ef0a3caefb744a99c575fb9dd29 (patch)
tree9a33e76614e7f51a4c255d8b59068e1dd289b35c /kernel/entry.asm
downloadjeyzuos-a71fe5ed5d709ef0a3caefb744a99c575fb9dd29.zip
jeyzuos-a71fe5ed5d709ef0a3caefb744a99c575fb9dd29.tar.gz
initial commit
Diffstat (limited to 'kernel/entry.asm')
-rw-r--r--kernel/entry.asm43
1 files changed, 43 insertions, 0 deletions
diff --git a/kernel/entry.asm b/kernel/entry.asm
new file mode 100644
index 0000000..28e491a
--- /dev/null
+++ b/kernel/entry.asm
@@ -0,0 +1,43 @@
+global _start
+global stack_ptr
+
+extern kernel_main
+
+; declare some constants
+MODULEALIGN equ 1<<0 ; align loaded modules on page boundaries
+MEMINFO equ 1<<1 ; provide memory map
+FLAGS equ MODULEALIGN | MEMINFO ; this is the Multiboot 'flag' field
+MAGIC equ 0x1BADB002 ; 'magic number' lets bootloader find the header
+CHECKSUM equ -(MAGIC + FLAGS) ; checksum of above, to prove we are multiboot
+
+; the bootloader will search for this magic sequence
+; and recognize us as a multiboot kernel
+section .multiboot
+align 4
+MultiBootHeader:
+ dd MAGIC
+ dd FLAGS
+ dd CHECKSUM
+
+section .code
+; setup the stack
+STACKSIZE equ 0x16384
+
+_start:
+ mov esp, stack+STACKSIZE
+ push eax
+ push ebx
+
+ call kernel_main
+
+ cli
+
+hang:
+ hlt
+ jmp hang
+
+section .bss
+align 4
+stack:
+ resb STACKSIZE
+stack_ptr: