39 #include "debug/Loader.hh" 41 #include "params/Process.hh" 56 fatal_if(params->useArchPT,
"Arch page tables not implemented.");
63 Addr mmap_end = 0x10000;
65 Addr max_stack_size = 8 * 1024 * 1024;
68 Addr next_thread_stack_base = stack_base - max_stack_size;
70 memState = make_shared<MemState>(brk_point, stack_base, max_stack_size,
71 next_thread_stack_base, mmap_end);
109 int argv_array_size = intSize * (
argv.size() + 1);
110 int envp_array_size = intSize * (
envp.size() + 1);
111 int auxv_array_size = intSize * 2 * (auxv.size() + 1);
113 int arg_data_size = 0;
115 arg_data_size +=
argv[
i].size() + 1;
117 int env_data_size = 0;
119 env_data_size +=
envp[
i].size() + 1;
129 if (space_needed < 32*1024)
130 space_needed = 32*1024;
142 Addr argv_array_base =
memState->getStackMin() + intSize;
143 Addr envp_array_base = argv_array_base + argv_array_size;
144 Addr auxv_array_base = envp_array_base + envp_array_size;
145 Addr arg_data_base = auxv_array_base + auxv_array_size;
146 Addr env_data_base = arg_data_base + arg_data_size;
149 uint64_t argc =
argv.size();
151 argc =
htole((uint64_t)argc);
152 else if (intSize == 4)
153 argc =
htole((uint32_t)argc);
155 panic(
"Unknown int size");
165 Addr auxv_array_end = auxv_array_base;
166 for (
const auto &aux: auxv) {
168 auxv_array_end +=
sizeof(aux);
#define panic(...)
This implements a cprintf based panic() function.
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
virtual void setMiscRegNoEffect(RegIndex misc_reg, RegVal val)=0
void allocateMem(Addr vaddr, int64_t size, bool clobber=false)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
SETranslatingPortProxy initVirtMem
RegVal getSyscallArg(ThreadContext *tc, int &i) override
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 unserialize(CheckpointIn &cp) override
Unserialize an object.
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.
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.
AlphaProcess(ProcessParams *params, ObjectFile *objFile)
Declarations of a non-full system Page Table.
uint16_t programHeaderCount()
static const int FirstArgumentReg
void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value) override
void argsInit(int intSize, int pageSize)
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 GlobalPointerReg
const RegIndex SyscallSuccessReg
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.