There were two thinkos in commit 937e239 ("x86: use alloc_phys", 2017-11-02). First, alloc_phys is not initialized if there are no multiboot modules, as is the case when invoking QEMU directly with a test kernel. Second, one "&" was missing, so the topmost memory address was passed as the size to phys_alloc_init. Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> --- lib/x86/setup.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/x86/setup.c b/lib/x86/setup.c index f6a8ea8..ff7c8d3 100644 --- a/lib/x86/setup.c +++ b/lib/x86/setup.c @@ -46,6 +46,10 @@ void setup_multiboot(struct mbi_bootinfo *bootinfo) { struct mbi_module *mods; + /* TODO: use e820 */ + u64 end_of_memory = bootinfo->mem_upper * 1024ull; + phys_alloc_init((uintptr_t) &edata, end_of_memory - (uintptr_t) &edata); + if (bootinfo->mods_count != 1) return; @@ -53,10 +57,6 @@ void setup_multiboot(struct mbi_bootinfo *bootinfo) initrd = (char *)(uintptr_t) mods->start; initrd_size = mods->end - mods->start; - - /* TODO: use e820 */ - u64 end_of_memory = bootinfo->mem_upper * 1024ull; - phys_alloc_init((uintptr_t) &edata, end_of_memory - (uintptr_t)edata); } void setup_libcflat(void) -- 2.14.3