aboutsummaryrefslogtreecommitdiffstats
path: root/src/malloc.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix high memory zone initialization in CSM modeJosé Martínez2023-06-131-3/+3
| | | | | | | | | | | | | malloc_high() cannot allocate any memory in CSM mode due to an empty ZoneHigh. SeaBIOS cannot find any disk to boot from because device initialization fails. The bug was introduced in 1.16.1 (commit dc88f9b) when the meaning of BUILD_MAX_HIGHTABLE changed but CSM code was not updated. This patch reverts to the previous behavior by using BUILD_MIN_HIGHTABLE in CSM methods. Signed-off-by: José Martínez <xose@google.com>
* malloc: use large ZoneHigh when there is enough memoryGerd Hoffmann2022-04-271-5/+9
| | | | | | In case there is enough memory installed use a large ZoneHigh. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* malloc: use variable for ZoneHigh sizeGerd Hoffmann2022-04-271-7/+8
| | | | | | | | | | | Use the variable highram_size instead of the BUILD_MAX_HIGHTABLE #define for the ZoneHigh size. Initialize the new variable with the old #define, so behavior does not change. This allows to easily adjust the ZoneHigh size at runtime in a followup patch. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* malloc: Rename csm_malloc_preinit() to malloc_csm_preinit()Kevin O'Connor2015-10-151-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* memmap: Introduce SYMBOL() macro to access linker script symbolsKevin O'Connor2015-10-151-13/+12
| | | | | | | Use a macro to define and obtain the value of a symbol introduced by the linker scripts (scripts/layoutrom.py). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* malloc: Don't mix virtual and physical addressesKevin O'Connor2015-10-151-78/+86
| | | | | | | | | Consistently use 'u32' for physical addresses and pointers for virtual addresses in the malloc code. Introduce and use memremap() where a physical address needs to be converted to a virtual address. Use virt_to_phys() for the inverse. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* malloc: Add warning if free() called on invalid memoryKevin O'Connor2015-10-151-0/+10
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* malloc: Introduce common helper alloc_new_detail()Kevin O'Connor2015-10-151-35/+37
| | | | | | | Introduce helper for finding temp space to hold an "allocation detail struct" and use it in both alloc_add() and _malloc(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* malloc: Use consistent naming for internal low-level "alloc" functionsKevin O'Connor2015-10-151-51/+51
| | | | | | | Use the "alloc_" prefix for all the low-level allocation functions and avoid camelCase naming. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* e820: Rename memmap.c to e820map.c and use consistent "e820_" prefixKevin O'Connor2015-10-151-5/+6
| | | | | | | | | Rename memmap.c to e820map.c as the code in that file only deals with maintaining the e820 map. Move all the e820 definitions to new file e820map.h and use a consistent "e820_" prefix on all exported functions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* e820: Introduce e820_remove() and avoid exporting E820_HOLEKevin O'Connor2015-10-151-1/+1
| | | | | | | | | The E820_HOLE definition is used internally in the e820 manipulation code to remove entries from the e820 map. Introduce the e820_remove() function so that the E820_HOLE definition does not need to be exported from the memmap.c code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Remove the pmm handle argument from _malloc().Kevin O'Connor2013-12-271-5/+18
| | | | | | | | | The PMM handle argument will almost always be 0xffffffff. Use separate code for the few rare cases where it may not be the default value. Gcc produces better code if _malloc() only requires three parameters. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Separate out sec32init sections even when not doing code relocation.Kevin O'Connor2013-12-071-3/+2
| | | | | | | | | | | | | | | | The current code does not boot on QEMU with 256K roms when code relocation is disabled, because QEMU only maps the last 128K of the rom to low memory. The seabios make_bios_writable() call copies the full rom to low memory. This patch separates out the init sections even if code relocations are disabled. This effectively ensures that make_bios_writable() code is in the last 128K of the rom. This also introduces a new build symbol (final_readonly_start) which stores the address of where the final runtime read-only memory begins. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Minor - update file comments in src/malloc.c.Kevin O'Connor2013-09-281-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move optionroms.h to std/optionrom.h and util.h.Kevin O'Connor2013-09-181-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move function definitions for output.c from util.h to new file output.h.Kevin O'Connor2013-09-181-4/+4
| | | | | | Also, sort the order of include files in the c files. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move malloc code from pmm.c to new files malloc.c and malloc.h.Kevin O'Connor2013-09-181-0/+529
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>