Page MenuHomeFreeBSD

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

Authored by bcran on Nov 12 2018, 5:04 AM.
Tags
None
Referenced Files
F80133139: D17958.id50301.diff
Thu, Mar 28, 8:47 AM
Unknown Object (File)
Fri, Mar 8, 10:04 PM
Unknown Object (File)
Feb 18 2024, 8:17 AM
Unknown Object (File)
Feb 13 2024, 4:52 PM
Unknown Object (File)
Feb 9 2024, 8:31 PM
Unknown Object (File)
Jan 28 2024, 10:42 AM
Unknown Object (File)
Dec 20 2023, 11:02 AM
Unknown Object (File)
Dec 20 2023, 1:00 AM
Subscribers
None

Details

Summary

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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
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.
stand/efi/loader/efi_main.c
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.

stand/efi/loader/efi_main.c
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.