From 6ee86bf497ea87a585fe8e4651760e71244fa2fb Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Tue, 1 Oct 2019 21:15:06 -0700 Subject: arch,base: Separate the idea of a memory image and object file. A memory image can be described by an object file, but an object file is more than a memory image. Also, it makes sense to manipulate a memory image to, for instance, change how it's loaded into memory. That takes on larger implications (relocations, the entry point, symbols, etc.) when talking about the whole object file, and also modifies aspects which may not need to change. For instance if an image needs to be loaded into memory at addresses different from what's in the object file, but other things like symbols need to stay unmodified. Change-Id: Ia360405ffb2c1c48e0cc201ac0a0764357996a54 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/21466 Tested-by: kokoro Reviewed-by: Brandon Potter Maintainer: Gabe Black --- src/arch/alpha/process.cc | 11 ++--------- src/arch/alpha/system.cc | 6 ++---- 2 files changed, 4 insertions(+), 13 deletions(-) (limited to 'src/arch/alpha') diff --git a/src/arch/alpha/process.cc b/src/arch/alpha/process.cc index e266b92b2..9311a6415 100644 --- a/src/arch/alpha/process.cc +++ b/src/arch/alpha/process.cc @@ -54,10 +54,10 @@ AlphaProcess::AlphaProcess(ProcessParams *params, ObjectFile *objFile) objFile) { fatal_if(params->useArchPT, "Arch page tables not implemented."); - Addr brk_point = roundUp(objFile->maxSegmentAddr(), PageBytes); + Addr brk_point = roundUp(image.maxAddr(), PageBytes); // Set up stack. On Alpha, stack goes below the image. - Addr stack_base = objFile->minSegmentAddr() - (409600 + 4096); + Addr stack_base = image.minAddr() - (409600 + 4096); // Set up region for mmaps. Addr mmap_end = 0x10000; @@ -74,13 +74,6 @@ AlphaProcess::AlphaProcess(ProcessParams *params, ObjectFile *objFile) void AlphaProcess::argsInit(int intSize, int pageSize) { - // Patch the ld_bias for dynamic executables. - updateBias(); - - objFile->loadSegments(initVirtMem); - if (objFile->getInterpreter()) - objFile->getInterpreter()->loadSegments(initVirtMem); - std::vector> auxv; ElfObject * elfObject = dynamic_cast(objFile); diff --git a/src/arch/alpha/system.cc b/src/arch/alpha/system.cc index 31e7aa062..a7a47036a 100644 --- a/src/arch/alpha/system.cc +++ b/src/arch/alpha/system.cc @@ -57,13 +57,11 @@ AlphaSystem::AlphaSystem(Params *p) */ // Load Console Code console = createObjectFile(params()->console); - console->setLoadMask(loadAddrMask); if (console == NULL) fatal("Could not load console file %s", params()->console); // Load pal file pal = createObjectFile(params()->pal); - pal->setLoadMask(loadAddrMask); if (pal == NULL) fatal("Could not load PALcode file %s", params()->pal); @@ -111,8 +109,8 @@ AlphaSystem::initState() System::initState(); // Load program sections into memory - pal->loadSegments(physProxy); - console->loadSegments(physProxy); + pal->buildImage().mask(loadAddrMask).write(physProxy); + console->buildImage().mask(loadAddrMask).write(physProxy); /** * Copy the osflags (kernel arguments) into the consoles -- cgit v1.2.3