Page MenuHomeFreeBSD

Print an error message in efi_main.c if we can't allocate memory for the heap.

Authored by bcran on Nov 12 2018, 5:04 AM.
Referenced Files
Unknown Object (File)
Thu, Jun 27, 3:08 PM
Unknown Object (File)
Thu, Jun 27, 9:47 AM
Unknown Object (File)
Thu, Jun 27, 9:10 AM
Unknown Object (File)
Mon, Jun 24, 5:33 AM
Unknown Object (File)
Sun, Jun 23, 3:51 AM
Unknown Object (File)
Jun 15 2024, 9:46 AM
Unknown Object (File)
Jun 4 2024, 7:41 AM
Unknown Object (File)
May 31 2024, 11:40 AM



With the default Qemu parameters, only 128MB RAM gets given a VM. This causes
the loader to be unable to allocate the 64MB it needs for the heap. This change
makes the cause of the error more obvious.

Diff Detail

rS FreeBSD src repository - subversion
Lint Not Applicable
Tests Not Applicable

Event Timeline

On my build of Qemu and OVMF, the largest contiguous region left is 44MB. There's also a 40MB region, then smaller areas making up 97MB total free.

eadler added inline comments.
98 โ†—(On Diff #50301)

perhaps include the size in the error message. I've found that kind of thing useful before.

This revision is now accepted and ready to land.Nov 12 2018, 10:56 AM

+1 for including the size of the allocation. I wish we could also (cheaply) work out and print how much space we actually have to work with, but meh. I'm not proud of how many times qemu's bitten me because I didn't pay attention to the -m default and spent x amount of time working out again that I didn't give it enough memory to boot successfully.

98 โ†—(On Diff #50301)

I'd include the size here. I don't know if printf is up and running until before or after the setheap call, which is the only wrinkle I can see.

Good point about including the size: I'll add it. I'll also double check, but printf didn't work in that location when I tried it, but it's possible I messed up newlines and it got overwritten.

I've checked and printf isn't available in loader at that point, so there's really nothing we can do except display a static string like I have in my patch.

This revision was automatically updated to reflect the committed changes.
bcran marked 2 inline comments as done.