summaryrefslogtreecommitdiffhomepage
path: root/src/loader/ent.asm
diff options
context:
space:
mode:
authorMarvin Borner2021-07-10 15:51:54 +0200
committerMarvin Borner2021-07-10 15:51:54 +0200
commitad56eb28f0614db4b7656ade390f1c79b446cbc9 (patch)
tree7d42ab3c9f36c188dbf54a25b1db1c3db5acb1bd /src/loader/ent.asm
parent176b6eb808f4d02d871c30f6ec19daa179f374d1 (diff)
A20, E820h, Real Mode Emulation
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