Unable to enable 5 level paging
Host environment
- Operating system: Arch Linux
- OS/kernel version: Linux depp 5.14.9-arch2-1 #1 SMP PREEMPT Fri, 01 Oct 2021 19:03:20 +0000 x86_64 GNU/Linux
- Architecture: x86
- QEMU flavor: qemu-system-x86_64
- QEMU version: QEMU emulator version 6.1.0
- QEMU command line:
./qemu-system-x86_64 -m 4G -serial stdio -smp 4 -drive id=disk,file=rock.img,if=none -device ahci,id=ahci -device ide-hd,drive=disk,bus=ahci.0 -cpu qemu64,+la57
Emulated/Virtualized environment
- Operating system: https://github.com/ethan4984/rock https://github.com/limine-bootloader/limine
- OS/kernel version: https://github.com/ethan4984/rock https://github.com/limine-bootloader/limine
- Architecture: x86
Description of problem
When attempting to set cr4.LA57, qemu just freezes on that instruction. When I say freeze I mean literally freeze, no exceptions, nothing, it just halts forever on that instruction. When this happened, the first thing I did was
(qemu) info registers
EAX=00001000 EBX=00000001 ECX=80224f08 EDX=00000000
ESI=8034a3a0 EDI=00026520 EBP=000079f8 ESP=000079c8
EIP=00019648 EFL=00000002 [-------] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =0020 00000000 ffffffff 00c09300 DPL=0 DS [-WA]
CS =0018 00000000 ffffffff 00c09a00 DPL=0 CS32 [-R-]
SS =0020 00000000 ffffffff 00c09300 DPL=0 DS [-WA]
DS =0020 00000000 ffffffff 00c09300 DPL=0 DS [-WA]
FS =0020 00000000 ffffffff 00cf9300 DPL=0 DS [-WA]
GS =0020 00000000 ffffffff 00cf9300 DPL=0 DS [-WA]
LDT=0000 00000000 00000000 00008200 DPL=0 LDT
TR =0000 00000000 0000ffff 00008b00 DPL=0 TSS32-busy
GDT= 0000e120 00000037
IDT= 00000000 00000000
CR0=00000011 CR2=00000000 CR3=00000000 CR4=00000000
DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000
DR6=00000000ffff0ff0 DR7=0000000000000400
EFER=0000000000000000
...
then using gdb to figure out what instruction it is hanging on, I set a breakpoint at 0x19648 at and ran
(gdb) x/1 0x19648
=> 0x19648: mov %rax,%cr4
(gdb)
This instruction corresponds to this LOC within limine https://github.com/limine-bootloader/limine/blob/trunk/stage23/protos/stivale.32.c#L33
Steps to reproduce
- Try to enable 5 level paging
- qemu freezes when trying to set cr4.LA57
- cry
Additional information
This never happened prior to version 6.1, I test this on multiple different machines and a few of my friends experienced the same issue
I have not tested this on linux, however I assume it will do the same on anything else. Either way, qemu should not be just halting
Edited by Ethan Miller