36 #include "debug/Loader.hh" 38 #include "params/Process.hh" 53 fatal_if(params->useArchPT,
"Arch page tables not implemented.");
56 Addr stack_base = 0x7FFFFFFF;
58 Addr max_stack_size = 8 * 1024 * 1024;
61 Addr next_thread_stack_base = stack_base - max_stack_size;
68 Addr mmap_end = brk_point + 0x40000000
L;
70 memState = make_shared<MemState>(
this, brk_point, stack_base,
71 max_stack_size, next_thread_stack_base,
83 template<
class IntType>
87 int intSize =
sizeof(IntType);
101 auxv.emplace_back(
M5_AT_PHDR, elfObject->programHeaderTable());
103 elfObject->programHeaderTable());
105 auxv.emplace_back(
M5_AT_PHENT, elfObject->programHeaderSize());
107 auxv.emplace_back(
M5_AT_PHNUM, elfObject->programHeaderCount());
123 int argv_array_size = intSize * (
argv.size() + 1);
124 int envp_array_size = intSize * (
envp.size() + 1);
125 int auxv_array_size = intSize * 2 * (auxv.size() + 1);
127 int arg_data_size = 0;
129 arg_data_size +=
argv[
i].size() + 1;
132 const int numRandomBytes = 16;
133 int aux_data_size = numRandomBytes;
135 int env_data_size = 0;
137 env_data_size +=
envp[
i].size() + 1;
158 IntType argv_array_base =
memState->getStackMin() + intSize;
159 IntType envp_array_base = argv_array_base + argv_array_size;
160 IntType auxv_array_base = envp_array_base + envp_array_size;
161 IntType arg_data_base = auxv_array_base + auxv_array_size;
162 IntType aux_data_base = arg_data_base - arg_data_size;
163 IntType env_data_base = aux_data_base + aux_data_size;
166 IntType argc =
argv.size();
168 argc =
htole((IntType)argc);
179 for (
auto &aux: auxv) {
181 aux.val = aux_data_base;
185 Addr auxv_array_end = auxv_array_base;
186 for (
const auto &aux: auxv) {
188 auxv_array_end +=
sizeof(aux);
194 auxv_array_end +=
sizeof(zero);
const std::string & name()
virtual TheISA::PCState pcState() const =0
std::unique_ptr< SETranslatingPortProxy > initVirtMem
std::vector< ContextID > contextIds
static const std::vector< int > ArgumentRegs
Overload hash function for BasicBlockRange type.
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
T roundUp(const T &val, const U &align)
This function is used to align addresses in memory.
std::shared_ptr< MemState > memState
ThreadContext is the external interface to all thread state for anything outside of the CPU...
ThreadContext * getThreadContext(ContextID tid) const
MipsProcess(ProcessParams *params, ::Loader::ObjectFile *objFile)
const int StackPointerReg
void copyStringArray(std::vector< std::string > &strings, AddrType array_ptr, AddrType data_ptr, const ByteOrder bo, PortProxy &memProxy)
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
T roundDown(const T &val, const U &align)
This function is used to align addresses in memory.
std::vector< std::string > envp
virtual void setIntReg(RegIndex reg_idx, RegVal val)=0
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
const int FirstArgumentReg
Declarations of a non-full system Page Table.
::Loader::MemoryImage image
void argsInit(int pageSize)
void initState()
initState() is called on each SimObject when not restoring from a checkpoint.
const ByteOrder GuestByteOrder
std::vector< std::string > argv
::Loader::ObjectFile * objFile