Kernel: Fix shadow 12GiB reserved entry when running QEMU without KVM on
All checks were successful
continuous-integration/drone/push Build is passing

Fix inspired by: https://github.com/serenityos/serenity/pull/16345
This commit is contained in:
apio 2023-01-07 20:58:12 +01:00
parent c97f588d44
commit 0c73d69a70
Signed by: apio
GPG Key ID: B8A7D06E42258954
2 changed files with 11 additions and 3 deletions

View File

@ -70,8 +70,6 @@ You can choose between 3 run scripts:
`tools/debug.sh` will run Luna in QEMU with a port open for GDB to connect to. (run `tools/build-debug.sh`, `tools/gdb.sh`, and then `tools/debug.sh` in a separate terminal for an optimal debugging experience) `tools/debug.sh` will run Luna in QEMU with a port open for GDB to connect to. (run `tools/build-debug.sh`, `tools/gdb.sh`, and then `tools/debug.sh` in a separate terminal for an optimal debugging experience)
Beware that running without hardware acceleration does some weird stuff with the memory map, which is why I don't use it that often.
Essentially, since `run.sh` builds the toolchain if it hasn't been built, builds Luna if it hasn't been built, and runs it, you could just checkout this repo, run `run.sh`, and you're done. No need for the other scripts. Those are included for more fine-grained control/building step-by-step. Essentially, since `run.sh` builds the toolchain if it hasn't been built, builds Luna if it hasn't been built, and runs it, you could just checkout this repo, run `run.sh`, and you're done. No need for the other scripts. Those are included for more fine-grained control/building step-by-step.
You can pass any arguments you want to the run scripts, and those will be forwarded to QEMU. Example: `tools/run.sh -m 512M -net none -machine q35`. You can pass any arguments you want to the run scripts, and those will be forwarded to QEMU. Example: `tools/run.sh -m 512M -net none -machine q35`.

View File

@ -43,7 +43,17 @@ Option<MemoryMapEntry> MemoryMapIterator::at(usize index) const
Option<MemoryMapEntry> MemoryMapIterator::next() Option<MemoryMapEntry> MemoryMapIterator::next()
{ {
return at(m_cur_ent++); auto entry = TRY(at(m_cur_ent++));
#ifdef ARCH_X86_64
// Workaround for https://gitlab.com/qemu-project/qemu/-/commit/8504f129450b909c88e199ca44facd35d38ba4de
// This invalid 12GiB reserved entry is made up by QEMU (doesn't appear on any real hardware), so we can simply
// ignore it and move on to the next entry.
if (entry.address() == 0x000000fd00000000 && entry.size() == (0x000000ffffffffff - 0x000000fd00000000) + 1)
return at(m_cur_ent++);
#endif
return entry;
} }
MemoryMapEntry MemoryMapIterator::largest_free() MemoryMapEntry MemoryMapIterator::largest_free()