summaryrefslogtreecommitdiffhomepage
path: root/src/loader/ent.asm
diff options
context:
space:
mode:
Diffstat (limited to 'src/loader/ent.asm')
-rw-r--r--src/loader/ent.asm33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/loader/ent.asm b/src/loader/ent.asm
new file mode 100644
index 0000000..47cf49b
--- /dev/null
+++ b/src/loader/ent.asm
@@ -0,0 +1,33 @@
+; MIT License, Copyright (c) 2021 Marvin Borner
+
+extern bss_begin
+extern bss_end
+extern start
+extern gdt
+
+section .entry
+
+global _start
+_start:
+ cld
+
+ ; Clear bss section
+ xor al, al
+ mov edi, bss_begin
+ mov ecx, bss_end
+ sub ecx, bss_begin
+ rep stosb
+
+ lgdt [gdt]
+ jmp 0x18:.reload_cs
+
+.reload_cs:
+ mov eax, 0x20
+ mov ds, ax
+ mov es, ax
+ mov fs, ax
+ mov gs, ax
+ mov ss, ax
+
+ cli
+ jmp start