40 #include "debug/Loader.hh"
49 using namespace MipsISA;
56 Addr stack_base = 0x7FFFFFFF;
58 Addr max_stack_size = 8 * 1024 * 1024;
61 Addr next_thread_stack_base = stack_base - max_stack_size;
69 Addr mmap_end = brk_point + 0x40000000
L;
71 memState = make_shared<MemState>(brk_point, stack_base, max_stack_size,
72 next_thread_stack_base, mmap_end);
83 template<
class IntType>
87 int intSize =
sizeof(IntType);
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;
136 int env_data_size = 0;
138 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 env_data_base = arg_data_base + arg_data_size;
165 IntType argc =
argv.size();
167 argc =
htog((IntType)argc);
178 (uint8_t*)&(auxv[
x].a_type), intSize);
180 (uint8_t*)&(auxv[
x].a_val), intSize);
184 for (
unsigned i = 0;
i < 2;
i++) {
185 const IntType zero = 0;
186 const Addr addr = auxv_array_base + 2 * intSize * (auxv.size() +
i);
Addr programHeaderTable()
void setSyscallArg(ThreadContext *tc, int i, MipsISA::IntReg val)
std::vector< ContextID > contextIds
void allocateMem(Addr vaddr, int64_t size, bool clobber=false)
SETranslatingPortProxy initVirtMem
void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value)
virtual void setIntReg(int reg_idx, uint64_t val)=0
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
virtual TheISA::PCState pcState()=0
T roundUp(const T &val, const U &align)
std::shared_ptr< MemState > memState
ThreadContext is the external interface to all thread state for anything outside of the CPU...
MipsISA::IntReg getSyscallArg(ThreadContext *tc, int &i)
virtual uint64_t readIntReg(int reg_idx)=0
int64_t returnValue() const
The return value.
int errnoValue() const
The errno value.
const RegIndex StackPointerReg
T roundDown(const T &val, const U &align)
std::vector< std::string > envp
ThreadContext * getThreadContext(ContextID tid)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
virtual bool loadSections(PortProxy &mem_proxy, Addr mask=maxAddr, Addr offset=0)
uint16_t programHeaderSize()
void copyStringArray(std::vector< std::string > &strings, AddrType array_ptr, AddrType data_ptr, SETranslatingPortProxy &memProxy)
Declarations of a non-full system Page Table.
MipsProcess(ProcessParams *params, ObjectFile *objFile)
uint16_t programHeaderCount()
static const int FirstArgumentReg
void argsInit(int pageSize)
void initState()
initState() is called on each SimObject when not restoring from a checkpoint.
const RegIndex ReturnValueReg
std::vector< std::string > argv
This class represents the return value from an emulated system call, including any errno setting...
bool successful() const
Was the system call successful?
const RegIndex SyscallSuccessReg
virtual void writeBlob(Addr addr, const uint8_t *p, int size) const
Write size bytes from p to address.