summaryrefslogtreecommitdiff
path: root/src/arch/mips
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/mips')
-rw-r--r--src/arch/mips/process.cc45
1 files changed, 21 insertions, 24 deletions
diff --git a/src/arch/mips/process.cc b/src/arch/mips/process.cc
index 9b4b5bb3c..d8378725c 100644
--- a/src/arch/mips/process.cc
+++ b/src/arch/mips/process.cc
@@ -96,36 +96,36 @@ MipsProcess::argsInit(int pageSize)
// load object file into target memory
objFile->loadSections(initVirtMem);
- typedef AuxVector<IntType> auxv_t;
- std::vector<auxv_t> auxv;
+ std::vector<AuxVector<IntType>> auxv;
ElfObject * elfObject = dynamic_cast<ElfObject *>(objFile);
if (elfObject)
{
// Set the system page size
- auxv.push_back(auxv_t(M5_AT_PAGESZ, MipsISA::PageBytes));
+ auxv.emplace_back(M5_AT_PAGESZ, MipsISA::PageBytes);
// Set the frequency at which time() increments
- auxv.push_back(auxv_t(M5_AT_CLKTCK, 100));
+ auxv.emplace_back(M5_AT_CLKTCK, 100);
// For statically linked executables, this is the virtual
// address of the program header tables if they appear in the
// executable image.
- auxv.push_back(auxv_t(M5_AT_PHDR, elfObject->programHeaderTable()));
- DPRINTF(Loader, "auxv at PHDR %08p\n", elfObject->programHeaderTable());
+ auxv.emplace_back(M5_AT_PHDR, elfObject->programHeaderTable());
+ DPRINTF(Loader, "auxv at PHDR %08p\n",
+ elfObject->programHeaderTable());
// This is the size of a program header entry from the elf file.
- auxv.push_back(auxv_t(M5_AT_PHENT, elfObject->programHeaderSize()));
+ auxv.emplace_back(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()));
+ auxv.emplace_back(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()));
+ auxv.emplace_back(M5_AT_BASE, getBias());
//The entry point to the program
- auxv.push_back(auxv_t(M5_AT_ENTRY, objFile->entryPoint()));
+ auxv.emplace_back(M5_AT_ENTRY, objFile->entryPoint());
//Different user and group IDs
- auxv.push_back(auxv_t(M5_AT_UID, uid()));
- auxv.push_back(auxv_t(M5_AT_EUID, euid()));
- auxv.push_back(auxv_t(M5_AT_GID, gid()));
- auxv.push_back(auxv_t(M5_AT_EGID, egid()));
+ auxv.emplace_back(M5_AT_UID, uid());
+ auxv.emplace_back(M5_AT_EUID, euid());
+ auxv.emplace_back(M5_AT_GID, gid());
+ auxv.emplace_back(M5_AT_EGID, egid());
}
// Calculate how much space we need for arg & env & auxv arrays.
@@ -177,19 +177,16 @@ MipsProcess::argsInit(int pageSize)
copyStringArray(envp, envp_array_base, env_data_base, initVirtMem);
// Copy the aux vector
- for (typename vector<auxv_t>::size_type x = 0; x < auxv.size(); x++) {
- initVirtMem.writeBlob(auxv_array_base + x * 2 * intSize,
- (uint8_t*)&(auxv[x].getAuxType()), intSize);
- initVirtMem.writeBlob(auxv_array_base + (x * 2 + 1) * intSize,
- (uint8_t*)&(auxv[x].getAuxVal()), intSize);
+ Addr auxv_array_end = auxv_array_base;
+ for (const auto &aux: auxv) {
+ initVirtMem.write(auxv_array_end, aux, GuestByteOrder);
+ auxv_array_end += sizeof(aux);
}
// Write out the terminating zeroed auxilliary vector
- for (unsigned i = 0; i < 2; i++) {
- const IntType zero = 0;
- const Addr addr = auxv_array_base + 2 * intSize * (auxv.size() + i);
- initVirtMem.writeBlob(addr, (uint8_t*)&zero, intSize);
- }
+ const AuxVector<IntType> zero(0, 0);
+ initVirtMem.write(auxv_array_end, zero);
+ auxv_array_end += sizeof(zero);
ThreadContext *tc = system->getThreadContext(contextIds[0]);