From 82e9f02aef1ea1a6588234ee58e3625e3561005f Mon Sep 17 00:00:00 2001 From: Aleksa Vuckovic Date: Thu, 8 Sep 2022 14:37:47 +0200 Subject: higher half in x86_64 kernel is now located at -2GB heap blocks are aligned on block size paging will allocate new page tables on heap --- kernel/src/boot/boot64.S | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'kernel/src/boot/boot64.S') 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 -- cgit v1.2.3