summaryrefslogtreecommitdiff
path: root/kernel/src/boot/boot64.S
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/src/boot/boot64.S')
-rw-r--r--kernel/src/boot/boot64.S25
1 files changed, 17 insertions, 8 deletions
diff --git a/kernel/src/boot/boot64.S b/kernel/src/boot/boot64.S
index cc79c36..e95f55b 100644
--- a/kernel/src/boot/boot64.S
+++ b/kernel/src/boot/boot64.S
@@ -1,16 +1,25 @@
-.section .text
.code64
+.set KERNEL_VMA, 0xffffffff80000000
+
+.section .boot64.text, "a"
+
.global begin_long_mode
begin_long_mode:
- // reload segment registers
- mov $0x10, %ax
- mov %ax, %ds
- mov %ax, %es
- mov %ax, %ss
- mov %ax, %fs
- mov %ax, %gs
+// xchgw %bx, %bx
+// mov $0x10, %ax
+// mov %ax, %ds
+// mov %ax, %es
+// mov %ax, %ss
+// mov %ax, %fs
+// mov %ax, %gs
+ add $KERNEL_VMA, %rsp
+ movabs $jump_main, %rax
+ jmp *%rax
+
+.section .text
+jump_main:
popq %rdi
popq %rsi
call kernel_main