Deleted Added
sdiff udiff text old ( 11970:98a9b0f154f6 ) new ( 12039:e2608d6696d7 )
full compact
1/*
2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
3 * Copyright (c) 2016 The University of Virginia
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright

--- 74 unchanged lines hidden (view full) ---

83{
84 updateBias();
85 objFile->loadSections(initVirtMem);
86 ElfObject* elfObject = dynamic_cast<ElfObject*>(objFile);
87 memState->setStackMin(memState->getStackBase());
88
89 // Determine stack size and populate auxv
90 Addr stack_top = memState->getStackMin();
91 for (const string& arg: argv)
92 stack_top -= arg.size() + 1;
93 for (const string& env: envp)
94 stack_top -= env.size() + 1;
95 stack_top &= -sizeof(Addr);
96
97 vector<AuxVector<IntType>> auxv;
98 if (elfObject != nullptr) {

--- 9 unchanged lines hidden (view full) ---

108 stack_top -= (1 + argv.size()) * sizeof(Addr) +
109 (1 + envp.size()) * sizeof(Addr) +
110 sizeof(Addr) + 2 * sizeof(IntType) * auxv.size();
111 stack_top &= -2*sizeof(Addr);
112 memState->setStackSize(memState->getStackBase() - stack_top);
113 allocateMem(roundDown(stack_top, pageSize),
114 roundUp(memState->getStackSize(), pageSize));
115
116 // Copy argv to stack
117 vector<Addr> argPointers;
118 for (const string& arg: argv) {
119 memState->setStackMin(memState->getStackMin() - (arg.size() + 1));
120 initVirtMem.writeString(memState->getStackMin(), arg.c_str());
121 argPointers.push_back(memState->getStackMin());
122 if (DTRACE(Stack)) {
123 string wrote;

--- 108 unchanged lines hidden ---