diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2013-02-19 01:02:50 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2013-02-19 21:56:59 -0500 |
commit | 6afc6f8fbbed5da90893da1865e003d911cc89eb (patch) | |
tree | 62030327e088a9a35e3c7920a42a1fa539159b45 /src/pmm.c | |
parent | 89a2f96de451d2dd4ea887b41c5425b051c93f8b (diff) | |
download | seabios-6afc6f8fbbed5da90893da1865e003d911cc89eb.tar.gz |
Don't relocate "varlow" variable references at runtime.
Since the final location of the "varlow" variables are known at build
time, link the final locations into the binary during the build. The
16bit code was already done at link time - update the build so the
32bit code is also done at link time.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/pmm.c')
-rw-r--r-- | src/pmm.c | 25 |
1 files changed, 13 insertions, 12 deletions
@@ -223,7 +223,7 @@ void malloc_preinit(void) { ASSERT32FLAT(); - dprintf(3, "malloc setup\n"); + dprintf(3, "malloc preinit\n"); dprintf(1, "Ram Size=0x%08x (0x%016llx high)\n", RamSize, RamSizeOver4G); @@ -288,25 +288,26 @@ csm_malloc_preinit(u32 low_pmm, u32 low_pmm_size, u32 hi_pmm, u32 hi_pmm_size) // Update pointers after code relocation. void -malloc_fixupreloc_init(void) +malloc_init(void) { ASSERT32FLAT(); - if (!CONFIG_RELOCATE_INIT) - return; - dprintf(3, "malloc fixup reloc\n"); - - int i; - for (i=0; i<ARRAY_SIZE(Zones); i++) { - struct zone_s *zone = Zones[i]; - if (zone->info) - zone->info->pprev = &zone->info; + dprintf(3, "malloc init\n"); + + if (CONFIG_RELOCATE_INIT) { + // Fixup malloc pointers after relocation + int i; + for (i=0; i<ARRAY_SIZE(Zones); i++) { + struct zone_s *zone = Zones[i]; + if (zone->info) + zone->info->pprev = &zone->info; + } } // Move low-memory initial variable content to new location. extern u8 varlow_start[], varlow_end[], final_varlow_start[]; memmove(final_varlow_start, varlow_start, varlow_end - varlow_start); - // Add space free'd during relocation in f-segment to ZoneFSeg + // Add space available in f-segment to ZoneFSeg extern u8 code32init_end[]; if ((u32)code32init_end > BUILD_BIOS_ADDR) { memset((void*)BUILD_BIOS_ADDR, 0, (u32)code32init_end - BUILD_BIOS_ADDR); |