diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2012-06-08 21:14:19 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2012-06-08 21:26:26 -0400 |
commit | c91da7a8a49451700d48396840447400e2255926 (patch) | |
tree | 742a35cfe0333d6dbe385c0d21d7929a9f443083 /src/pmm.c | |
parent | 2062f2bab81915c5c1f7af12a49ad8d4b3fd23fb (diff) | |
download | seabios-c91da7a8a49451700d48396840447400e2255926.tar.gz |
Avoid runtime relocation of 16bit "low" mem - calculate at build instead.
Some 16bit accesses to "low" mem variables use 16bit relocations
instead of the normal 32bit relocations. This causes build problems
if the "low" mem sections move more than 64K during relocation.
The final location of the "low" memory can be determined during the
build, so link the 16bit code with the final post-reloc location of
the "low" mem variables instead. This eliminates the need to do these
runtime relocations on the 16bit code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/pmm.c')
-rw-r--r-- | src/pmm.c | 14 |
1 files changed, 4 insertions, 10 deletions
@@ -170,13 +170,6 @@ static struct allocinfo_s *RomBase; #define OPROM_HEADER_RESERVE 16 -// Return maximum address of read/writable "low mem" space. -static inline u32 lowmemend(void) { - extern u8 code32flat_start[], code32init_end[]; - u32 end = CONFIG_RELOCATE_INIT ? (u32)code32init_end : (u32)code32flat_start; - return end > BUILD_BIOS_ADDR ? BUILD_BIOS_ADDR : end; -} - // Return the memory position up to which roms may be located. u32 rom_get_top(void) @@ -199,8 +192,8 @@ rom_reserve(u32 size) u32 newend = ALIGN(RomEnd + size, OPTION_ROM_ALIGN) + OPROM_HEADER_RESERVE; if (newend > (u32)RomBase->allocend) return NULL; - if (newend < (u32)_datalow_base + OPROM_HEADER_RESERVE) - newend = (u32)_datalow_base + OPROM_HEADER_RESERVE; + if (newend < (u32)datalow_base + OPROM_HEADER_RESERVE) + newend = (u32)datalow_base + OPROM_HEADER_RESERVE; RomBase->data = RomBase->dataend = (void*)newend; return (void*)RomEnd; } @@ -253,7 +246,8 @@ malloc_setup(void) // Populate other regions addSpace(&ZoneTmpLow, (void*)BUILD_STACK_ADDR, (void*)BUILD_EBDA_MINIMUM); addSpace(&ZoneFSeg, BiosTableSpace, &BiosTableSpace[CONFIG_MAX_BIOSTABLE]); - addSpace(&ZoneLow, _datalow_base + OPROM_HEADER_RESERVE, (void*)lowmemend()); + extern u8 final_datalow_start[]; + addSpace(&ZoneLow, datalow_base + OPROM_HEADER_RESERVE, final_datalow_start); RomBase = findLast(&ZoneLow); if (highram) { addSpace(&ZoneHigh, (void*)highram |