40 #include "debug/Loader.hh" 42 #include "params/Process.hh" 57 fatal_if(params->useArchPT,
"Arch page tables not implemented.");
60 Addr stack_base = 0x7FFFFFFF;
62 Addr max_stack_size = 8 * 1024 * 1024;
65 Addr next_thread_stack_base = stack_base - max_stack_size;
72 Addr mmap_end = brk_point + 0x40000000
L;
74 memState = make_shared<MemState>(brk_point, stack_base, max_stack_size,
75 next_thread_stack_base, mmap_end);
86 template<
class IntType>
90 int intSize =
sizeof(IntType);
125 int argv_array_size = intSize * (
argv.size() + 1);
126 int envp_array_size = intSize * (
envp.size() + 1);
127 int auxv_array_size = intSize * 2 * (auxv.size() + 1);
129 int arg_data_size = 0;
131 arg_data_size +=
argv[
i].size() + 1;
133 int env_data_size = 0;
135 env_data_size +=
envp[
i].size() + 1;
155 IntType argv_array_base =
memState->getStackMin() + intSize;
156 IntType envp_array_base = argv_array_base + argv_array_size;
157 IntType auxv_array_base = envp_array_base + envp_array_size;
158 IntType arg_data_base = auxv_array_base + auxv_array_size;
159 IntType env_data_base = arg_data_base + arg_data_size;
162 IntType argc =
argv.size();
164 argc =
htole((IntType)argc);
175 Addr auxv_array_end = auxv_array_base;
176 for (
const auto &aux: auxv) {
178 auxv_array_end +=
sizeof(aux);
184 auxv_array_end +=
sizeof(zero);
Addr programHeaderTable()
const std::string & name()
virtual TheISA::PCState pcState() const =0
virtual RegVal readIntReg(RegIndex reg_idx) const =0
bool successful() const
Was the system call successful?
std::vector< ContextID > contextIds
void allocateMem(Addr vaddr, int64_t size, bool clobber=false)
SETranslatingPortProxy initVirtMem
void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value)
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...
int errnoValue() const
The errno value.
const ByteOrder GuestByteOrder
ThreadContext * getThreadContext(ContextID tid) const
void writeBlob(Addr addr, const void *p, int size) const
Same as tryWriteBlob, but insists on success.
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...
const RegIndex StackPointerReg
T roundDown(const T &val, const U &align)
This function is used to align addresses in memory.
RegVal getSyscallArg(ThreadContext *tc, int &i)
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.
int64_t returnValue() const
The return value.
uint16_t programHeaderSize()
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.
void write(Addr address, const T &data) const
Write object T to address.
const RegIndex ReturnValueReg
std::vector< std::string > argv
This class represents the return value from an emulated system call, including any errno setting...
Each instance of a Loader subclass will have a chance to try to load an object file when tryLoaders i...
const RegIndex SyscallSuccessReg