On Sat, Nov 24, 2018 at 11:46:53PM +0300, Mike Banon wrote:
Please could you tell me, why the memory allocation functions like malloc_tmphigh() are failing at do_boot() stage? (boot.c) . Because of this "VARVERIFY32INIT" problem described in my letter above - https://mail.coreboot.org/pipermail/seabios/2018-November/012575.html
- I rewrote all my code to allocate the RAM for one floppy only (space
equal to max floppy size, which could be used by any selected floppy) . But when I'm trying to boot that selected floppy - it is failing, because these floppies are LZMA compressed inside CBFS and to decompress them another malloc_tmphigh() is needed (from cbfs_copyfile() / coreboot.c) / Although this code compiles fine (no VARVERIFY32INIT problem) - this malloc_tmphigh() function is always failing and SeaBIOS is freezing.
Spent all my weekend debugging this problem and really stuck, any help will be highly appreciated
Only the "post" stage is able to allocate ram. Once the "boot" phase starts executing, areas of memory are locked down, and it's possible for 3rd party software to become resident in various areas of ram. SeaBIOS thus can't touch those areas of ram or modify the e820 map. The VARVERIFY32INIT flag is there to catch this type of common error.
There's some info on this in the docs at: https://www.seabios.org/Memory_Model#Memory_available_during_initialization and: https://www.seabios.org/Execution_and_code_flow
So, any type of allocation would have to occur before the boot stage. It should be possible (though not necessarily easy) to perform the allocation in the map_floppy_drive() phase of the code.