summaryrefslogtreecommitdiff
path: root/src/arch/mips
diff options
context:
space:
mode:
authorBrandon Potter <brandon.potter@amd.com>2016-03-17 10:31:03 -0700
committerBrandon Potter <brandon.potter@amd.com>2016-03-17 10:31:03 -0700
commit9b4249410ec18cac9df2c7e9c0a4a6ce5459233d (patch)
treec3260ef4f23b9eca7d835ab1e0dfc8ce1173b17c /src/arch/mips
parent4fc69db8f89049a881a5f4aa68545840818b124c (diff)
downloadgem5-9b4249410ec18cac9df2c7e9c0a4a6ce5459233d.tar.xz
base: support dynamic loading of Linux ELF objects in SE mode
Diffstat (limited to 'src/arch/mips')
-rw-r--r--src/arch/mips/process.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/arch/mips/process.cc b/src/arch/mips/process.cc
index 8754191fa..6947eeafd 100644
--- a/src/arch/mips/process.cc
+++ b/src/arch/mips/process.cc
@@ -78,6 +78,9 @@ MipsLiveProcess::argsInit(int pageSize)
{
int intSize = sizeof(IntType);
+ // Patch the ld_bias for dynamic executables.
+ updateBias();
+
// load object file into target memory
objFile->loadSections(initVirtMem);
@@ -100,6 +103,10 @@ MipsLiveProcess::argsInit(int pageSize)
auxv.push_back(auxv_t(M5_AT_PHENT, elfObject->programHeaderSize()));
// This is the number of program headers from the original elf file.
auxv.push_back(auxv_t(M5_AT_PHNUM, elfObject->programHeaderCount()));
+ // This is the base address of the ELF interpreter; it should be
+ // zero for static executables or contain the base address for
+ // dynamic executables.
+ auxv.push_back(auxv_t(M5_AT_BASE, getBias()));
//The entry point to the program
auxv.push_back(auxv_t(M5_AT_ENTRY, objFile->entryPoint()));
//Different user and group IDs
@@ -177,7 +184,7 @@ MipsLiveProcess::argsInit(int pageSize)
setSyscallArg(tc, 1, argv_array_base);
tc->setIntReg(StackPointerReg, stack_min);
- tc->pcState(objFile->entryPoint());
+ tc->pcState(getStartPC());
}