aboutsummaryrefslogtreecommitdiff
path: root/src/boot
diff options
context:
space:
mode:
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/boot.S29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/boot/boot.S b/src/boot/boot.S
index 676ace7..8391e70 100644
--- a/src/boot/boot.S
+++ b/src/boot/boot.S
@@ -1,6 +1,5 @@
.globl _start
.globl MB_INFO
-.extern boucane
.extern _bss_start
.extern _bss_end
.extern boucane
@@ -49,7 +48,16 @@ MB_INFO:
_start:
mov %ebx,(MB_INFO)
-
+# Zeroing the .bss section
+mov $_bss_start, %eax
+mov $_bss_end, %ebx
+start_zeroing:
+ movb $0x0, (%eax)
+ cmp %eax, %ebx
+ je end_zeroing
+ inc %eax
+ jmp start_zeroing
+end_zeroing:
# ----- Setup PAE Paging (identity on the first 10MB)
mov $8192, %ecx # 8*4096/4 (8 tables of 4096 byte each divide by 4 because of movl)
mov $0, %eax
@@ -104,7 +112,20 @@ lgdt (gdtr)
jmp $0x08, $new_cs
new_cs:
+mov $0x10, %ax
+mov %ax, %ds
+mov %ax, %es
+mov %ax, %fs
+mov %ax, %gs
+mov %ax, %ss
+
+# Pay attention here!
+# You are in long mode here
+# Thus if you want to add any instructions
+# You should use .code64 before
+
# Run boucane
+.code64
jmp boucane
# GDT
@@ -121,8 +142,8 @@ gdt64:
gdt64_ds:
.long 0
.byte 0
- .byte 0b10000000
+ .byte 0b10010010
.word 0
gdtr:
.word . - gdt64 - 1
- .quad gdt64 \ No newline at end of file
+ .quad gdt64