61 Addr stack_base = 0x7FFFFFFF;
63 Addr max_stack_size = 8 * 1024 * 1024;
66 Addr next_thread_stack_base = stack_base - max_stack_size;
73 Addr mmap_end = brk_point + 0x40000000L;
75 memState = std::make_shared<MemState>(
76 this, brk_point, stack_base, max_stack_size,
77 next_thread_stack_base, mmap_end);
92 int intSize =
sizeof(IntType);
108 elfObject->programHeaderTable());
128 int argv_array_size = intSize * (
argv.size() + 1);
129 int envp_array_size = intSize * (
envp.size() + 1);
130 int auxv_array_size = intSize * 2 * (auxv.size() + 1);
132 int arg_data_size = 0;
134 arg_data_size +=
argv[
i].size() + 1;
137 const int numRandomBytes = 16;
138 int aux_data_size = numRandomBytes;
140 int env_data_size = 0;
142 env_data_size +=
envp[
i].size() + 1;
163 IntType argv_array_base =
memState->getStackMin() + intSize;
164 IntType envp_array_base = argv_array_base + argv_array_size;
165 IntType auxv_array_base = envp_array_base + envp_array_size;
166 IntType arg_data_base = auxv_array_base + auxv_array_size;
167 IntType aux_data_base = arg_data_base - arg_data_size;
168 IntType env_data_base = aux_data_base + aux_data_size;
171 IntType argc =
argv.size();
173 argc =
htole((IntType)argc);
184 for (
auto &aux: auxv) {
186 aux.val = aux_data_base;
190 Addr auxv_array_end = auxv_array_base;
191 for (
const auto &aux: auxv) {
192 initVirtMem->write(auxv_array_end, aux, ByteOrder::little);
193 auxv_array_end +=
sizeof(aux);
199 auxv_array_end +=
sizeof(zero);
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual void setReg(const RegId ®, RegVal val)
virtual const PCStateBase & pcState() const =0
Declarations of a non-full system Page Table.