Harvey-OS / harvey

A distributed operating system
https://harvey-os.org/
MIT License
1.44k stars 106 forks source link

harvey won't boot with initrd on real hardware #1096

Closed gmacd closed 3 years ago

gmacd commented 3 years ago

Repro steps:

If you have the same problem I had, it'll pagefault on boot.

The initrd memory area is recognised by multiboot, and identified as PamMODULE as expected. It's placed after the kernel heap, but not immediately after - there's nearly 6Mi (5976064 bytes) of PamMEMORY in between the kernel heap and the module.

The problem seems to be in umeminit - when it's setting up the memory available for user space, it pagefaults when initialising the PamMEMORY area in between the kernel heap and the initrd module (in the plop function).

On real hardware, without the initrd module it boots fine. Qemu boots fine with or without the initrd.

gmacd commented 3 years ago

So I've got some ideas about the page fault with initrd on real hardware:

A quick fix would be to not call physinit for any memory section before the module sections (if there is one). In this case you'd lose 4Mi of available ram (the actual size is just under 6Mi).