// Maximum number of map entries in the e820 map
#define CONFIG_MAX_E820 32
-// Space to reserve in f-segment for dynamic allocations
-#define CONFIG_MAX_BIOSTABLE 2048
// Space to reserve in high-memory for tables
#define CONFIG_MAX_HIGHTABLE (64*1024)
// Largest supported externaly facing drive id
* Setup
****************************************************************/
-// Space for bios tables built an run-time.
-char BiosTableSpace[CONFIG_MAX_BIOSTABLE] __aligned(MALLOC_MIN_ALIGN) VARFSEG;
-
void
malloc_preinit(void)
{
RomBase = findLast(&ZoneLow);
// Add space available in f-segment to ZoneFSeg
- addSpace(&ZoneFSeg, BiosTableSpace, &BiosTableSpace[CONFIG_MAX_BIOSTABLE]);
- extern u8 code32init_end[];
- if ((u32)code32init_end > BUILD_BIOS_ADDR) {
- memset((void*)BUILD_BIOS_ADDR, 0, (u32)code32init_end - BUILD_BIOS_ADDR);
- addSpace(&ZoneFSeg, (void*)BUILD_BIOS_ADDR, code32init_end);
- }
+ extern u8 zonefseg_start[], zonefseg_end[];
+ memset(zonefseg_start, 0, zonefseg_end - zonefseg_start);
+ addSpace(&ZoneFSeg, zonefseg_start, zonefseg_end);
calcRamSize();
}
BUILD_BIOS_ADDR = 0xf0000
BUILD_BIOS_SIZE = 0x10000
BUILD_ROM_START = 0xc0000
+# Space to reserve in f-segment for dynamic allocations
+BUILD_MIN_BIOSTABLE = 2048
# Layout the 16bit code. This ensures sections with fixed offset
# requirements are placed in the correct location. It also places the
sections32init = sec32init_start = sec32init_align = None
sections32low = sec32low_start = sec32low_align = None
sections32fseg = sec32fseg_start = sec32fseg_align = None
+ zonefseg_start = zonefseg_end = None
zonelow_base = final_sec32low_start = None
exportsyms = varlowsyms = None
li.sec32flat_start, li.sec32flat_align = setSectionsStart(
textsections + rodatasections + datasections + bsssections
, li.sec32fseg_start, 16)
+ li.zonefseg_end = li.sec32flat_start
+ li.zonefseg_start = BUILD_BIOS_ADDR
+ if li.zonefseg_start + BUILD_MIN_BIOSTABLE > li.zonefseg_end:
+ # Not enough ZoneFSeg space - force a minimum space.
+ li.zonefseg_end = li.sec32fseg_start
+ li.zonefseg_start = li.zonefseg_end - BUILD_MIN_BIOSTABLE
+ li.sec32flat_start, li.sec32flat_align = setSectionsStart(
+ textsections + rodatasections + datasections + bsssections
+ , li.zonefseg_start, 16)
# Determine 32flat init positions
li.sections32init = getSectionsCategory(sections, '32init')
, forcedelta=li.final_sec32low_start-li.sec32low_start)
out += outXRefs(sections32all, exportsyms=li.exportsyms) + """
_reloc_min_align = 0x%x ;
+ zonefseg_start = 0x%x ;
+ zonefseg_end = 0x%x ;
zonelow_base = 0x%x ;
final_varlow_start = 0x%x ;
code32flat_end = ABSOLUTE(.) ;
} :text
""" % (li.sec32init_align,
+ li.zonefseg_start,
+ li.zonefseg_end,
li.zonelow_base,
li.final_sec32low_start,
sec32all_start,