From 912d2e3c7eb1baa71dda2c0a28aa5809eaa96f27 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sat, 16 Jul 2022 13:33:00 +0200 Subject: amd64: barely boot into kernel code --- src/kernel/arch/amd64/boot64.s | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/kernel/arch/amd64/boot64.s (limited to 'src/kernel/arch/amd64/boot64.s') diff --git a/src/kernel/arch/amd64/boot64.s b/src/kernel/arch/amd64/boot64.s new file mode 100644 index 0000000..1dca0ca --- /dev/null +++ b/src/kernel/arch/amd64/boot64.s @@ -0,0 +1,13 @@ +.global boot64 +boot64: + lgdt (lgdt_arg) // try reloading gdt again + mov $(5 << 3 | 3), %ax // SEG_TSS + ltr %ax + + xchgw %bx, %bx + push %rdi // preserve multiboot struct + call sysenter_setup + pop %rdi + + // multiboot struct in %rdi + jmp kmain_early -- cgit v1.2.3