diff options
author | Marvin Borner | 2019-09-14 17:05:06 +0200 |
---|---|---|
committer | Marvin Borner | 2019-09-14 17:05:06 +0200 |
commit | 36bbfd9184426576d38841bcabfa5ba2b59f726c (patch) | |
tree | 5f21ffd8181bdaf873fb0ed0787784392c2f8af6 /src/boot.s | |
parent | 119d15393abe1bd0d31e7c9864799063b9b5dc28 (diff) |
Added very basic kernel and vga driver
Diffstat (limited to 'src/boot.s')
-rw-r--r-- | src/boot.s | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/boot.s b/src/boot.s new file mode 100644 index 0000000..6cb2f7c --- /dev/null +++ b/src/boot.s @@ -0,0 +1,41 @@ +// Constants for the multiboot header +.set ALIGN, 1<<0 +.set MEMINFO, 1<<1 +.set FLAGS, ALIGN | MEMINFO +.set MAGIC, 0x1BADB002 +.set CHECKSUM, -(MAGIC + FLAGS) + +// Header marking the program as kernel +.section .multiboot +.align 4 +.long MAGIC +.long FLAGS +.long CHECKSUM + +// Initialize a small stack +.section .bss +.align 16 +stack_bottom: +.skip 16384 // 16 KiB +stack_top: + +// Use _start from linker as starting point +.section .text +.global _start +.type _start, @function +_start: + // Set up stack by setting esp to top of stack + mov $stack_top, %esp + + // TODO: Initialize processor, load GDT, enable paging + + // Call the kernel + call kernel_main + + // Put the system in an infinite loop + cli +1: hlt + jmp 1b + +// Set the size of the _start symbol to the current location '.' minus its start +.size _start, . - _start |