summaryrefslogtreecommitdiff
path: root/asm/multiboot.s
diff options
context:
space:
mode:
Diffstat (limited to 'asm/multiboot.s')
-rw-r--r--asm/multiboot.s18
1 files changed, 18 insertions, 0 deletions
diff --git a/asm/multiboot.s b/asm/multiboot.s
index a497e18..21df7bb 100644
--- a/asm/multiboot.s
+++ b/asm/multiboot.s
@@ -45,6 +45,8 @@ stack_top:
# doesn't make sense to return from this function as the bootloader is gone.
.section .text
.global _start
+.global stack_top
+.global stack_bottom
.type _start, @function
_start:
# Welcome to kernel mode! We now have sufficient code for the bootloader to
@@ -67,6 +69,8 @@ _start:
# a stack. Note that the processor is not fully initialized yet and stuff
# such as floating point instructions are not available yet.
+ lgdt gdt_descriptor #load descriptor table!
+
# To set up a stack, we simply set the esp register to point to the top of
# our stack (as it grows downwards).
movl $stack_top, %esp
@@ -77,6 +81,20 @@ _start:
push %ebx #pass address of the multiboot information data structure
push %eax #pass eax, so kernel can check for magic number
+
+
+ reloadSegments:
+ #Reload CS register containing code selector:
+ jmp $0x08,$reload_CS # 0x08 points at the new code selector
+
+ reload_CS:
+ mov $0x10, %ax
+ mov %ax, %ds
+ mov %ax, %es
+ mov %ax, %fs
+ mov %ax, %gs
+ mov %ax, %ss
+
call kernel_main
# In case the function returns, we'll want to put the computer into an