unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, 0));
+ int index = 0;
+ TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index));
strcpy(name->sysname, "Linux");
strcpy(name->nodename, "m5.eecs.umich.edu");
osf_getsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- unsigned op = process->getSyscallArg(tc, 0);
+ int index = 0;
+ unsigned op = process->getSyscallArg(tc, index);
+ Addr bufPtr = process->getSyscallArg(tc, index);
// unsigned nbytes = process->getSyscallArg(tc, 2);
switch (op) {
case 45: { // GSI_IEEE_FP_CONTROL
- TypedBufferArg<uint64_t> fpcr(process->getSyscallArg(tc, 1));
+ TypedBufferArg<uint64_t> fpcr(bufPtr);
// I don't think this exactly matches the HW FPCR
*fpcr = 0;
fpcr.copyOut(tc->getMemPort());
osf_setsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- unsigned op = process->getSyscallArg(tc, 0);
+ int index = 0;
+ unsigned op = process->getSyscallArg(tc, index);
+ Addr bufPtr = process->getSyscallArg(tc, index);
// unsigned nbytes = process->getSyscallArg(tc, 2);
switch (op) {
case 14: { // SSI_IEEE_FP_CONTROL
- TypedBufferArg<uint64_t> fpcr(process->getSyscallArg(tc, 1));
+ TypedBufferArg<uint64_t> fpcr(bufPtr);
// I don't think this exactly matches the HW FPCR
fpcr.copyIn(tc->getMemPort());
DPRINTFR(SyscallVerbose, "osf_setsysinfo(SSI_IEEE_FP_CONTROL): "
}
AlphaISA::IntReg
-AlphaLiveProcess::getSyscallArg(ThreadContext *tc, int i)
+AlphaLiveProcess::getSyscallArg(ThreadContext *tc, int &i)
{
assert(i < 6);
- return tc->readIntReg(FirstArgumentReg + i);
+ return tc->readIntReg(FirstArgumentReg + i++);
}
void
void argsInit(int intSize, int pageSize);
public:
- AlphaISA::IntReg getSyscallArg(ThreadContext *tc, int i);
+ AlphaISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
void setSyscallArg(ThreadContext *tc, int i, AlphaISA::IntReg val);
void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value);
};
unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- TypedBufferArg<AlphaTru64::utsname> name(process->getSyscallArg(tc, 0));
+ int index = 0;
+ TypedBufferArg<AlphaTru64::utsname> name(process->getSyscallArg(tc, index));
strcpy(name->sysname, "OSF1");
strcpy(name->nodename, "m5.eecs.umich.edu");
getsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- unsigned op = process->getSyscallArg(tc, 0);
- unsigned nbytes = process->getSyscallArg(tc, 2);
+ int index = 0;
+ unsigned op = process->getSyscallArg(tc, index);
+ Addr bufPtr = process->getSyscallArg(tc, index);
+ unsigned nbytes = process->getSyscallArg(tc, index);
switch (op) {
case AlphaTru64::GSI_MAX_CPU: {
- TypedBufferArg<uint32_t> max_cpu(process->getSyscallArg(tc, 1));
+ TypedBufferArg<uint32_t> max_cpu(bufPtr);
*max_cpu = htog((uint32_t)process->numCpus());
max_cpu.copyOut(tc->getMemPort());
return 1;
}
case AlphaTru64::GSI_CPUS_IN_BOX: {
- TypedBufferArg<uint32_t> cpus_in_box(process->getSyscallArg(tc, 1));
+ TypedBufferArg<uint32_t> cpus_in_box(bufPtr);
*cpus_in_box = htog((uint32_t)process->numCpus());
cpus_in_box.copyOut(tc->getMemPort());
return 1;
}
case AlphaTru64::GSI_PHYSMEM: {
- TypedBufferArg<uint64_t> physmem(process->getSyscallArg(tc, 1));
+ TypedBufferArg<uint64_t> physmem(bufPtr);
*physmem = htog((uint64_t)1024 * 1024); // physical memory in KB
physmem.copyOut(tc->getMemPort());
return 1;
}
case AlphaTru64::GSI_CPU_INFO: {
- TypedBufferArg<AlphaTru64::cpu_info>
- infop(process->getSyscallArg(tc, 1));
+ TypedBufferArg<AlphaTru64::cpu_info> infop(bufPtr);
infop->current_cpu = htog(0);
infop->cpus_in_box = htog(process->numCpus());
}
case AlphaTru64::GSI_PROC_TYPE: {
- TypedBufferArg<uint64_t> proc_type(process->getSyscallArg(tc, 1));
+ TypedBufferArg<uint64_t> proc_type(bufPtr);
*proc_type = htog((uint64_t)11);
proc_type.copyOut(tc->getMemPort());
return 1;
}
case AlphaTru64::GSI_PLATFORM_NAME: {
- BufferArg bufArg(process->getSyscallArg(tc, 1), nbytes);
+ BufferArg bufArg(bufPtr, nbytes);
strncpy((char *)bufArg.bufferPtr(),
"COMPAQ Professional Workstation XP1000",
nbytes);
}
case AlphaTru64::GSI_CLK_TCK: {
- TypedBufferArg<uint64_t> clk_hz(process->getSyscallArg(tc, 1));
+ TypedBufferArg<uint64_t> clk_hz(bufPtr);
*clk_hz = htog((uint64_t)1024);
clk_hz.copyOut(tc->getMemPort());
return 1;
setsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- unsigned op = process->getSyscallArg(tc, 0);
+ int index = 0;
+ unsigned op = process->getSyscallArg(tc, index);
switch (op) {
case AlphaTru64::SSI_IEEE_FP_CONTROL:
warn("setsysinfo: ignoring ieee_set_fp_control() arg 0x%x\n",
- process->getSyscallArg(tc, 1));
+ process->getSyscallArg(tc, index));
break;
default:
{
using namespace std;
- int id = process->getSyscallArg(tc, 0); // table ID
- int index = process->getSyscallArg(tc, 1); // index into table
+ int argIndex = 0;
+ int id = process->getSyscallArg(tc, argIndex); // table ID
+ int index = process->getSyscallArg(tc, argIndex); // index into table
+ Addr bufPtr = process->getSyscallArg(tc, argIndex);
// arg 2 is buffer pointer; type depends on table ID
- int nel = process->getSyscallArg(tc, 3); // number of elements
- int lel = process->getSyscallArg(tc, 4); // expected element size
+ int nel = process->getSyscallArg(tc, argIndex); // number of elements
+ int lel = process->getSyscallArg(tc, argIndex); // expected element size
switch (id) {
case AlphaTru64::TBL_SYSINFO: {
if (index != 0 || nel != 1 || lel != sizeof(Tru64::tbl_sysinfo))
return -EINVAL;
- TypedBufferArg<Tru64::tbl_sysinfo> elp(process->getSyscallArg(tc, 2));
+ TypedBufferArg<Tru64::tbl_sysinfo> elp(bufPtr);
const int clk_hz = one_million;
elp->si_user = htog(curTick / (Clock::Frequency / clk_hz));
unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, 0));
+ int index = 0;
+ TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index));
strcpy(name->sysname, "Linux");
strcpy(name->nodename, "m5.eecs.umich.edu");
setTLSFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- uint32_t tlsPtr = process->getSyscallArg(tc, 0);
+ int index = 0;
+ uint32_t tlsPtr = process->getSyscallArg(tc, index);
tc->getMemPort()->writeBlob(ArmLinuxProcess::commPage + 0x0ff0,
(uint8_t *)&tlsPtr, sizeof(tlsPtr));
}
ArmISA::IntReg
-ArmLinuxProcess::getSyscallArg(ThreadContext *tc, int i)
+ArmLinuxProcess::getSyscallArg(ThreadContext *tc, int &i)
{
// Linux apparently allows more parameter than the ABI says it should.
// This limit may need to be increased even further.
assert(i < 6);
- return tc->readIntReg(ArgumentReg0 + i);
+ return tc->readIntReg(ArgumentReg0 + i++);
}
void
void startup();
- ArmISA::IntReg getSyscallArg(ThreadContext *tc, int i);
+ ArmISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
void setSyscallArg(ThreadContext *tc, int i, ArmISA::IntReg val);
/// The target system's hostname.
}
ArmISA::IntReg
-ArmLiveProcess::getSyscallArg(ThreadContext *tc, int i)
+ArmLiveProcess::getSyscallArg(ThreadContext *tc, int &i)
{
assert(i < 4);
- return tc->readIntReg(ArgumentReg0 + i);
+ return tc->readIntReg(ArgumentReg0 + i++);
}
void
public:
void argsInit(int intSize, int pageSize);
- ArmISA::IntReg getSyscallArg(ThreadContext *tc, int i);
+ ArmISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
void setSyscallArg(ThreadContext *tc, int i, ArmISA::IntReg val);
void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value);
};
unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, 0));
+ int index = 0;
+ TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index));
strcpy(name->sysname, "Linux");
strcpy(name->nodename,"m5.eecs.umich.edu");
sys_getsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- unsigned op = process->getSyscallArg(tc, 0);
- // unsigned nbytes = process->getSyscallArg(tc, 2);
+ int index = 0;
+ unsigned op = process->getSyscallArg(tc, index);
+ unsigned bufPtr = process->getSyscallArg(tc, index);
+ // unsigned nbytes = process->getSyscallArg(tc, index);
switch (op) {
case 45:
{
// GSI_IEEE_FP_CONTROL
- TypedBufferArg<uint64_t> fpcr(process->getSyscallArg(tc, 1));
+ TypedBufferArg<uint64_t> fpcr(bufPtr);
// I don't think this exactly matches the HW FPCR
*fpcr = 0;
fpcr.copyOut(tc->getMemPort());
sys_setsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- unsigned op = process->getSyscallArg(tc, 0);
- // unsigned nbytes = process->getSyscallArg(tc, 2);
+ int index = 0;
+ unsigned op = process->getSyscallArg(tc, index);
+ Addr bufPtr = process->getSyscallArg(tc, index);
+ // unsigned nbytes = process->getSyscallArg(tc, index);
switch (op) {
case 14:
{
// SSI_IEEE_FP_CONTROL
- TypedBufferArg<uint64_t> fpcr(process->getSyscallArg(tc, 1));
+ TypedBufferArg<uint64_t> fpcr(bufPtr);
// I don't think this exactly matches the HW FPCR
fpcr.copyIn(tc->getMemPort());
DPRINTFR(SyscallVerbose, "sys_setsysinfo(SSI_IEEE_FP_CONTROL): "
MipsISA::IntReg
-MipsLiveProcess::getSyscallArg(ThreadContext *tc, int i)
+MipsLiveProcess::getSyscallArg(ThreadContext *tc, int &i)
{
assert(i < 6);
- return tc->readIntReg(FirstArgumentReg + i);
+ return tc->readIntReg(FirstArgumentReg + i++);
}
void
void argsInit(int intSize, int pageSize);
public:
- MipsISA::IntReg getSyscallArg(ThreadContext *tc, int i);
+ MipsISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
void setSyscallArg(ThreadContext *tc, int i, MipsISA::IntReg val);
void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value);
};
unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, 0));
+ int index = 0;
+ TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index));
strcpy(name->sysname, "Linux");
strcpy(name->nodename, "m5.eecs.umich.edu");
}
PowerISA::IntReg
-PowerLinuxProcess::getSyscallArg(ThreadContext *tc, int i)
+PowerLinuxProcess::getSyscallArg(ThreadContext *tc, int &i)
{
// Linux apparently allows more parameter than the ABI says it should.
// This limit may need to be increased even further.
assert(i < 6);
- return tc->readIntReg(ArgumentReg0 + i);
+ return tc->readIntReg(ArgumentReg0 + i++);
}
void
void startup();
- PowerISA::IntReg getSyscallArg(ThreadContext *tc, int i);
+ PowerISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
void setSyscallArg(ThreadContext *tc, int i, PowerISA::IntReg val);
/// Array of syscall descriptors, indexed by call number.
}
PowerISA::IntReg
-PowerLiveProcess::getSyscallArg(ThreadContext *tc, int i)
+PowerLiveProcess::getSyscallArg(ThreadContext *tc, int &i)
{
assert(i < 5);
- return tc->readIntReg(ArgumentReg0 + i);
+ return tc->readIntReg(ArgumentReg0 + i++);
}
void
public:
void argsInit(int intSize, int pageSize);
- PowerISA::IntReg getSyscallArg(ThreadContext *tc, int i);
+ PowerISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
void setSyscallArg(ThreadContext *tc, int i, PowerISA::IntReg val);
void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value);
};
unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, 0));
+ int index = 0;
+ TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index));
strcpy(name->sysname, "Linux");
strcpy(name->nodename, "m5.eecs.umich.edu");
LiveProcess *p, ThreadContext *tc)
{
const IntReg id = htog(100);
- Addr ruid = p->getSyscallArg(tc, 0);
- Addr euid = p->getSyscallArg(tc, 1);
- Addr suid = p->getSyscallArg(tc, 2);
+ int index = 0;
+ Addr ruid = p->getSyscallArg(tc, index);
+ Addr euid = p->getSyscallArg(tc, index);
+ Addr suid = p->getSyscallArg(tc, index);
//Handle the EFAULT case
//Set the ruid
if(ruid)
}
IntReg
-Sparc32LiveProcess::getSyscallArg(ThreadContext *tc, int i)
+Sparc32LiveProcess::getSyscallArg(ThreadContext *tc, int &i)
{
assert(i < 6);
- return bits(tc->readIntReg(FirstArgumentReg + i), 31, 0);
+ return bits(tc->readIntReg(FirstArgumentReg + i++), 31, 0);
}
void
}
IntReg
-Sparc64LiveProcess::getSyscallArg(ThreadContext *tc, int i)
+Sparc64LiveProcess::getSyscallArg(ThreadContext *tc, int &i)
{
assert(i < 6);
- return tc->readIntReg(FirstArgumentReg + i);
+ return tc->readIntReg(FirstArgumentReg + i++);
}
void
void flushWindows(ThreadContext *tc);
- SparcISA::IntReg getSyscallArg(ThreadContext *tc, int i);
+ SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val);
};
void flushWindows(ThreadContext *tc);
- SparcISA::IntReg getSyscallArg(ThreadContext *tc, int i);
+ SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val);
};
unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- TypedBufferArg<Solaris::utsname> name(process->getSyscallArg(tc, 0));
+ int index = 0;
+ TypedBufferArg<Solaris::utsname> name(process->getSyscallArg(tc, index));
strcpy(name->sysname, "SunOS");
strcpy(name->nodename, "m5.eecs.umich.edu");
unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, 0));
+ int index = 0;
+ TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index));
strcpy(name->sysname, "Linux");
strcpy(name->nodename, "m5.eecs.umich.edu");
};
//First argument is the code, second is the address
- int code = process->getSyscallArg(tc, 0);
- uint64_t addr = process->getSyscallArg(tc, 1);
+ int index = 0;
+ int code = process->getSyscallArg(tc, index);
+ uint64_t addr = process->getSyscallArg(tc, index);
uint64_t fsBase, gsBase;
TranslatingPort *p = tc->getMemPort();
switch(code)
assert((maxTLSEntry + 1) * sizeof(uint64_t) <= x86lp->gdtSize());
- TypedBufferArg<UserDesc32> userDesc(process->getSyscallArg(tc, 0));
+ int argIndex = 0;
+ TypedBufferArg<UserDesc32> userDesc(process->getSyscallArg(tc, argIndex));
TypedBufferArg<uint64_t>
gdt(x86lp->gdtStart() + minTLSEntry * sizeof(uint64_t),
numTLSEntries * sizeof(uint64_t));
}
X86ISA::IntReg
-X86_64LiveProcess::getSyscallArg(ThreadContext *tc, int i)
+X86_64LiveProcess::getSyscallArg(ThreadContext *tc, int &i)
{
assert(i < NumArgumentRegs);
- return tc->readIntReg(ArgumentReg[i]);
+ return tc->readIntReg(ArgumentReg[i++]);
}
void
}
X86ISA::IntReg
-I386LiveProcess::getSyscallArg(ThreadContext *tc, int i)
+I386LiveProcess::getSyscallArg(ThreadContext *tc, int &i)
{
assert(i < NumArgumentRegs32);
- return tc->readIntReg(ArgumentReg32[i]);
+ return tc->readIntReg(ArgumentReg32[i++]);
+}
+
+X86ISA::IntReg
+I386LiveProcess::getSyscallArg(ThreadContext *tc, int &i, int width)
+{
+ assert(width == 32 || width == 64);
+ assert(i < NumArgumentRegs);
+ uint64_t retVal = tc->readIntReg(ArgumentReg32[i++]) & mask(32);
+ if (width == 64)
+ retVal |= ((uint64_t)tc->readIntReg(ArgumentReg[i++]) << 32);
+ return retVal;
}
void
void argsInit(int intSize, int pageSize);
void startup();
- X86ISA::IntReg getSyscallArg(ThreadContext *tc, int i);
+ X86ISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
void setSyscallArg(ThreadContext *tc, int i, X86ISA::IntReg val);
};
void startup();
void syscall(int64_t callnum, ThreadContext *tc);
- X86ISA::IntReg getSyscallArg(ThreadContext *tc, int i);
+ X86ISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
+ X86ISA::IntReg getSyscallArg(ThreadContext *tc, int &i, int width);
void setSyscallArg(ThreadContext *tc, int i, X86ISA::IntReg val);
};
}
#ifdef __CYGWIN__
panic("getdirent not implemented on cygwin!");
#else
- int fd = process->sim_fd(process->getSyscallArg(tc, 0));
- Addr tgt_buf = process->getSyscallArg(tc, 1);
- int tgt_nbytes = process->getSyscallArg(tc, 2);
- Addr tgt_basep = process->getSyscallArg(tc, 3);
+ int index = 0;
+ int fd = process->sim_fd(process->getSyscallArg(tc, index));
+ Addr tgt_buf = process->getSyscallArg(tc, index);
+ int tgt_nbytes = process->getSyscallArg(tc, index);
+ Addr tgt_basep = process->getSyscallArg(tc, index);
char * const host_buf = new char[tgt_nbytes];
{
using namespace TheISA;
- TypedBufferArg<Tru64::sigcontext> sc(process->getSyscallArg(tc, 0));
+ int index = 0;
+ TypedBufferArg<Tru64::sigcontext> sc(process->getSyscallArg(tc, index));
sc.copyIn(tc->getMemPort());
{
using namespace TheISA;
- TypedBufferArg<Tru64::vm_stack> argp(process->getSyscallArg(tc, 0));
+ int index = 0;
+ TypedBufferArg<Tru64::vm_stack> argp(process->getSyscallArg(tc, index));
argp.copyIn(tc->getMemPort());
using namespace std;
using namespace TheISA;
+ int index = 0;
TypedBufferArg<Tru64::nxm_task_attr>
- attrp(process->getSyscallArg(tc, 0));
- TypedBufferArg<Addr> configptr_ptr(process->getSyscallArg(tc, 1));
+ attrp(process->getSyscallArg(tc, index));
+ TypedBufferArg<Addr> configptr_ptr(process->getSyscallArg(tc, index));
attrp.copyIn(tc->getMemPort());
using namespace std;
using namespace TheISA;
+ int index = 0;
TypedBufferArg<Tru64::nxm_thread_attr>
- attrp(process->getSyscallArg(tc, 0));
- TypedBufferArg<uint64_t> kidp(process->getSyscallArg(tc, 1));
- int thread_index = process->getSyscallArg(tc, 2);
+ attrp(process->getSyscallArg(tc, index));
+ TypedBufferArg<uint64_t> kidp(process->getSyscallArg(tc, index));
+ int thread_index = process->getSyscallArg(tc, index);
// get attribute args
attrp.copyIn(tc->getMemPort());
{
using namespace std;
- uint64_t tid = process->getSyscallArg(tc, 0);
- uint64_t secs = process->getSyscallArg(tc, 1);
- uint64_t flags = process->getSyscallArg(tc, 2);
- uint64_t action = process->getSyscallArg(tc, 3);
- uint64_t usecs = process->getSyscallArg(tc, 4);
+ int index = 0;
+ uint64_t tid = process->getSyscallArg(tc, index);
+ uint64_t secs = process->getSyscallArg(tc, index);
+ uint64_t flags = process->getSyscallArg(tc, index);
+ uint64_t action = process->getSyscallArg(tc, index);
+ uint64_t usecs = process->getSyscallArg(tc, index);
cout << tc->getCpuPtr()->name() << ": nxm_thread_block " << tid << " "
<< secs << " " << flags << " " << action << " " << usecs << endl;
{
using namespace std;
- Addr uaddr = process->getSyscallArg(tc, 0);
- uint64_t val = process->getSyscallArg(tc, 1);
- uint64_t secs = process->getSyscallArg(tc, 2);
- uint64_t usecs = process->getSyscallArg(tc, 3);
- uint64_t flags = process->getSyscallArg(tc, 4);
+ int index = 0;
+ Addr uaddr = process->getSyscallArg(tc, index);
+ uint64_t val = process->getSyscallArg(tc, index);
+ uint64_t secs = process->getSyscallArg(tc, index);
+ uint64_t usecs = process->getSyscallArg(tc, index);
+ uint64_t flags = process->getSyscallArg(tc, index);
BaseCPU *cpu = tc->getCpuPtr();
{
using namespace std;
- Addr uaddr = process->getSyscallArg(tc, 0);
+ int index = 0;
+ Addr uaddr = process->getSyscallArg(tc, index);
cout << tc->getCpuPtr()->name() << ": nxm_unblock "
<< hex << uaddr << dec << endl;
m5_mutex_lockFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- Addr uaddr = process->getSyscallArg(tc, 0);
+ int index = 0;
+ Addr uaddr = process->getSyscallArg(tc, index);
m5_lock_mutex(uaddr, process, tc);
{
using namespace TheISA;
- Addr uaddr = process->getSyscallArg(tc, 0);
+ int index = 0;
+ Addr uaddr = process->getSyscallArg(tc, index);
TypedBufferArg<uint64_t> lockp(uaddr);
lockp.copyIn(tc->getMemPort());
m5_mutex_unlockFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- Addr uaddr = process->getSyscallArg(tc, 0);
+ int index = 0;
+ Addr uaddr = process->getSyscallArg(tc, index);
m5_unlock_mutex(uaddr, process, tc);
m5_cond_signalFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- Addr cond_addr = process->getSyscallArg(tc, 0);
+ int index = 0;
+ Addr cond_addr = process->getSyscallArg(tc, index);
// Wake up one process waiting on the condition variable.
activate_waiting_context(cond_addr, process);
m5_cond_broadcastFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- Addr cond_addr = process->getSyscallArg(tc, 0);
+ int index = 0;
+ Addr cond_addr = process->getSyscallArg(tc, index);
activate_waiting_context(cond_addr, process, true);
{
using namespace TheISA;
- Addr cond_addr = process->getSyscallArg(tc, 0);
- Addr lock_addr = process->getSyscallArg(tc, 1);
+ int index = 0;
+ Addr cond_addr = process->getSyscallArg(tc, index);
+ Addr lock_addr = process->getSyscallArg(tc, index);
TypedBufferArg<uint64_t> condp(cond_addr);
TypedBufferArg<uint64_t> lockp(lock_addr);
indirectSyscallFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- int new_callnum = process->getSyscallArg(tc, 0);
+ int index = 0;
+ int new_callnum = process->getSyscallArg(tc, index);
for (int i = 0; i < 5; ++i)
- process->setSyscallArg(tc, i, process->getSyscallArg(tc, i+1));
+ process->setSyscallArg(tc, i, process->getSyscallArg(tc, index));
SyscallDesc *new_desc = process->getDesc(new_callnum);
desc->doSyscall(callnum, this, tc);
}
+IntReg
+LiveProcess::getSyscallArg(ThreadContext *tc, int &i, int width)
+{
+ return getSyscallArg(tc, i);
+}
+
LiveProcess *
LiveProcess::create(LiveProcessParams * params)
{
std::string getcwd() const { return cwd; }
virtual void syscall(int64_t callnum, ThreadContext *tc);
- virtual TheISA::IntReg getSyscallArg(ThreadContext *tc, int i) = 0;
+
+ virtual TheISA::IntReg getSyscallArg(ThreadContext *tc, int &i) = 0;
+ virtual TheISA::IntReg getSyscallArg(ThreadContext *tc, int &i, int width);
virtual void setSyscallArg(ThreadContext *tc,
int i, TheISA::IntReg val) = 0;
virtual void setSyscallReturn(ThreadContext *tc,
void
SyscallDesc::doSyscall(int callnum, LiveProcess *process, ThreadContext *tc)
{
+ int index = 0;
DPRINTFR(SyscallVerbose,
"%d: %s: syscall %s called w/arguments %d,%d,%d,%d\n",
curTick, tc->getCpuPtr()->name(), name,
- process->getSyscallArg(tc, 0), process->getSyscallArg(tc, 1),
- process->getSyscallArg(tc, 2), process->getSyscallArg(tc, 3));
+ process->getSyscallArg(tc, index),
+ process->getSyscallArg(tc, index),
+ process->getSyscallArg(tc, index),
+ process->getSyscallArg(tc, index));
SyscallReturn retval = (*funcPtr)(this, callnum, process, tc);
ignoreFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
+ int index = 0;
warn("ignoring syscall %s(%d, %d, ...)", desc->name,
- process->getSyscallArg(tc, 0), process->getSyscallArg(tc, 1));
+ process->getSyscallArg(tc, index), process->getSyscallArg(tc, index));
return 0;
}
{
if (process->system->numRunningContexts() == 1) {
// Last running context... exit simulator
+ int index = 0;
exitSimLoop("target called exit()",
- process->getSyscallArg(tc, 0) & 0xff);
+ process->getSyscallArg(tc, index) & 0xff);
} else {
// other running threads... just halt this one
tc->halt();
{
// really should just halt all thread contexts belonging to this
// process in case there's another process running...
+ int index = 0;
exitSimLoop("target called exit()",
- process->getSyscallArg(tc, 0) & 0xff);
+ process->getSyscallArg(tc, index) & 0xff);
return 1;
}
brkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
{
// change brk addr to first arg
- Addr new_brk = p->getSyscallArg(tc, 0);
+ int index = 0;
+ Addr new_brk = p->getSyscallArg(tc, index);
// in Linux at least, brk(0) returns the current break value
// (note that the syscall and the glibc function have different behavior)
SyscallReturn
closeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
{
- int target_fd = p->getSyscallArg(tc, 0);
+ int index = 0;
+ int target_fd = p->getSyscallArg(tc, index);
int status = close(p->sim_fd(target_fd));
if (status >= 0)
p->free_fd(target_fd);
SyscallReturn
readFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
{
- int fd = p->sim_fd(p->getSyscallArg(tc, 0));
- int nbytes = p->getSyscallArg(tc, 2);
- BufferArg bufArg(p->getSyscallArg(tc, 1), nbytes);
+ int index = 0;
+ int fd = p->sim_fd(p->getSyscallArg(tc, index));
+ Addr bufPtr = p->getSyscallArg(tc, index);
+ int nbytes = p->getSyscallArg(tc, index);
+ BufferArg bufArg(bufPtr, nbytes);
int bytes_read = read(fd, bufArg.bufferPtr(), nbytes);
SyscallReturn
writeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
{
- int fd = p->sim_fd(p->getSyscallArg(tc, 0));
- int nbytes = p->getSyscallArg(tc, 2);
- BufferArg bufArg(p->getSyscallArg(tc, 1), nbytes);
+ int index = 0;
+ int fd = p->sim_fd(p->getSyscallArg(tc, index));
+ Addr bufPtr = p->getSyscallArg(tc, index);
+ int nbytes = p->getSyscallArg(tc, index);
+ BufferArg bufArg(bufPtr, nbytes);
bufArg.copyIn(tc->getMemPort());
SyscallReturn
lseekFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
{
- int fd = p->sim_fd(p->getSyscallArg(tc, 0));
- uint64_t offs = p->getSyscallArg(tc, 1);
- int whence = p->getSyscallArg(tc, 2);
+ int index = 0;
+ int fd = p->sim_fd(p->getSyscallArg(tc, index));
+ uint64_t offs = p->getSyscallArg(tc, index);
+ int whence = p->getSyscallArg(tc, index);
off_t result = lseek(fd, offs, whence);
SyscallReturn
_llseekFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
{
- int fd = p->sim_fd(p->getSyscallArg(tc, 0));
- uint64_t offset_high = p->getSyscallArg(tc, 1);
- uint32_t offset_low = p->getSyscallArg(tc, 2);
- Addr result_ptr = p->getSyscallArg(tc, 3);
- int whence = p->getSyscallArg(tc, 4);
+ int index = 0;
+ int fd = p->sim_fd(p->getSyscallArg(tc, index));
+ uint64_t offset_high = p->getSyscallArg(tc, index);
+ uint32_t offset_low = p->getSyscallArg(tc, index);
+ Addr result_ptr = p->getSyscallArg(tc, index);
+ int whence = p->getSyscallArg(tc, index);
uint64_t offset = (offset_high << 32) | offset_low;
SyscallReturn
gethostnameFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
{
- int name_len = p->getSyscallArg(tc, 1);
- BufferArg name(p->getSyscallArg(tc, 0), name_len);
+ int index = 0;
+ Addr bufPtr = p->getSyscallArg(tc, index);
+ int name_len = p->getSyscallArg(tc, index);
+ BufferArg name(bufPtr, name_len);
strncpy((char *)name.bufferPtr(), hostname, name_len);
getcwdFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
{
int result = 0;
- unsigned long size = p->getSyscallArg(tc, 1);
- BufferArg buf(p->getSyscallArg(tc, 0), size);
+ int index;
+ Addr bufPtr = p->getSyscallArg(tc, index);
+ unsigned long size = p->getSyscallArg(tc, index);
+ BufferArg buf(bufPtr, size);
// Is current working directory defined?
string cwd = p->getcwd();
{
string path;
- if (!tc->getMemPort()->tryReadString(path, p->getSyscallArg(tc, 0)))
+ int index = 0;
+ if (!tc->getMemPort()->tryReadString(path, p->getSyscallArg(tc, index)))
return (TheISA::IntReg)-EFAULT;
// Adjust path for current working directory
path = p->fullPath(path);
- size_t bufsiz = p->getSyscallArg(tc, 2);
- BufferArg buf(p->getSyscallArg(tc, 1), bufsiz);
+ Addr bufPtr = p->getSyscallArg(tc, index);
+ size_t bufsiz = p->getSyscallArg(tc, index);
+
+ BufferArg buf(bufPtr, bufsiz);
int result = readlink(path.c_str(), (char *)buf.bufferPtr(), bufsiz);
{
string path;
- if (!tc->getMemPort()->tryReadString(path, p->getSyscallArg(tc, 0)))
+ int index = 0;
+ if (!tc->getMemPort()->tryReadString(path, p->getSyscallArg(tc, index)))
return (TheISA::IntReg)-EFAULT;
// Adjust path for current working directory
{
string path;
- if (!tc->getMemPort()->tryReadString(path, p->getSyscallArg(tc, 0)))
+ int index = 0;
+ if (!tc->getMemPort()->tryReadString(path, p->getSyscallArg(tc, index)))
return (TheISA::IntReg)-EFAULT;
// Adjust path for current working directory
path = p->fullPath(path);
- mode_t mode = p->getSyscallArg(tc, 1);
+ mode_t mode = p->getSyscallArg(tc, index);
int result = mkdir(path.c_str(), mode);
return (result == -1) ? -errno : result;
{
string old_name;
- if (!tc->getMemPort()->tryReadString(old_name, p->getSyscallArg(tc, 0)))
+ int index = 0;
+ if (!tc->getMemPort()->tryReadString(old_name, p->getSyscallArg(tc, index)))
return -EFAULT;
string new_name;
- if (!tc->getMemPort()->tryReadString(new_name, p->getSyscallArg(tc, 1)))
+ if (!tc->getMemPort()->tryReadString(new_name, p->getSyscallArg(tc, index)))
return -EFAULT;
// Adjust path for current working directory
{
string path;
- if (!tc->getMemPort()->tryReadString(path, p->getSyscallArg(tc, 0)))
+ int index = 0;
+ if (!tc->getMemPort()->tryReadString(path, p->getSyscallArg(tc, index)))
return -EFAULT;
- off_t length = p->getSyscallArg(tc, 1);
+ off_t length = p->getSyscallArg(tc, index);
// Adjust path for current working directory
path = p->fullPath(path);
ftruncateFunc(SyscallDesc *desc, int num,
LiveProcess *process, ThreadContext *tc)
{
- int fd = process->sim_fd(process->getSyscallArg(tc, 0));
+ int index = 0;
+ int fd = process->sim_fd(process->getSyscallArg(tc, index));
if (fd < 0)
return -EBADF;
- off_t length = process->getSyscallArg(tc, 1);
+ off_t length = process->getSyscallArg(tc, index);
int result = ftruncate(fd, length);
return (result == -1) ? -errno : result;
ftruncate64Func(SyscallDesc *desc, int num,
LiveProcess *process, ThreadContext *tc)
{
- int fd = process->sim_fd(process->getSyscallArg(tc, 0));
+ int index = 0;
+ int fd = process->sim_fd(process->getSyscallArg(tc, index));
if (fd < 0)
return -EBADF;
- // I'm not sure why, but the length argument is in arg reg 3
- loff_t length = process->getSyscallArg(tc, 3);
+ loff_t length = process->getSyscallArg(tc, index, 64);
int result = ftruncate64(fd, length);
return (result == -1) ? -errno : result;
{
string path;
- if (!tc->getMemPort()->tryReadString(path, p->getSyscallArg(tc, 0)))
+ int index = 0;
+ if (!tc->getMemPort()->tryReadString(path, p->getSyscallArg(tc, index)))
return -EFAULT;
/* XXX endianess */
- uint32_t owner = p->getSyscallArg(tc, 1);
+ uint32_t owner = p->getSyscallArg(tc, index);
uid_t hostOwner = owner;
- uint32_t group = p->getSyscallArg(tc, 2);
+ uint32_t group = p->getSyscallArg(tc, index);
gid_t hostGroup = group;
// Adjust path for current working directory
SyscallReturn
fchownFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
{
- int fd = process->sim_fd(process->getSyscallArg(tc, 0));
+ int index = 0;
+ int fd = process->sim_fd(process->getSyscallArg(tc, index));
if (fd < 0)
return -EBADF;
/* XXX endianess */
- uint32_t owner = process->getSyscallArg(tc, 1);
+ uint32_t owner = process->getSyscallArg(tc, index);
uid_t hostOwner = owner;
- uint32_t group = process->getSyscallArg(tc, 2);
+ uint32_t group = process->getSyscallArg(tc, index);
gid_t hostGroup = group;
int result = fchown(fd, hostOwner, hostGroup);
SyscallReturn
dupFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
{
- int fd = process->sim_fd(process->getSyscallArg(tc, 0));
+ int index = 0;
+ int fd = process->sim_fd(process->getSyscallArg(tc, index));
if (fd < 0)
return -EBADF;
- Process::FdMap *fdo = process->sim_fd_obj(process->getSyscallArg(tc, 0));
+ Process::FdMap *fdo = process->sim_fd_obj(fd);
int result = dup(fd);
return (result == -1) ? -errno :
fcntlFunc(SyscallDesc *desc, int num, LiveProcess *process,
ThreadContext *tc)
{
- int fd = process->getSyscallArg(tc, 0);
+ int index = 0;
+ int fd = process->getSyscallArg(tc, index);
if (fd < 0 || process->sim_fd(fd) < 0)
return -EBADF;
- int cmd = process->getSyscallArg(tc, 1);
+ int cmd = process->getSyscallArg(tc, index);
switch (cmd) {
case 0: // F_DUPFD
// if we really wanted to support this, we'd need to do it
fcntl64Func(SyscallDesc *desc, int num, LiveProcess *process,
ThreadContext *tc)
{
- int fd = process->getSyscallArg(tc, 0);
+ int index = 0;
+ int fd = process->getSyscallArg(tc, index);
if (fd < 0 || process->sim_fd(fd) < 0)
return -EBADF;
- int cmd = process->getSyscallArg(tc, 1);
+ int cmd = process->getSyscallArg(tc, index);
switch (cmd) {
case 33: //F_GETLK64
warn("fcntl64(%d, F_GETLK64) not supported, error returned\n", fd);
ThreadContext *tc)
{
// can't fathom why a benchmark would call this.
- warn("Ignoring call to setuid(%d)\n", process->getSyscallArg(tc, 0));
+ int index = 0;
+ warn("Ignoring call to setuid(%d)\n", process->getSyscallArg(tc, index));
return 0;
}
cloneFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
+ int index = 0;
+ IntReg flags = process->getSyscallArg(tc, index);
+ IntReg newStack = process->getSyscallArg(tc, index);
+
DPRINTF(SyscallVerbose, "In sys_clone:\n");
- DPRINTF(SyscallVerbose, " Flags=%llx\n", process->getSyscallArg(tc, 0));
- DPRINTF(SyscallVerbose, " Child stack=%llx\n",
- process->getSyscallArg(tc, 1));
+ DPRINTF(SyscallVerbose, " Flags=%llx\n", flags);
+ DPRINTF(SyscallVerbose, " Child stack=%llx\n", newStack);
- if (process->getSyscallArg(tc, 0) != 0x10f00) {
+ if (flags != 0x10f00) {
warn("This sys_clone implementation assumes flags "
"CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD "
"(0x10f00), and may not work correctly with given flags "
- "0x%llx\n", process->getSyscallArg(tc, 0));
+ "0x%llx\n", flags);
}
ThreadContext* ctc; // child thread context
#endif
// Set up stack register
- ctc->setIntReg(TheISA::StackPointerReg, process->getSyscallArg(tc, 1));
+ ctc->setIntReg(TheISA::StackPointerReg, newStack);
// Set up syscall return values in parent and child
ctc->setIntReg(ReturnValueReg, 0); // return value, child
ioctlFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- int fd = process->getSyscallArg(tc, 0);
- unsigned req = process->getSyscallArg(tc, 1);
+ int index = 0;
+ int fd = process->getSyscallArg(tc, index);
+ unsigned req = process->getSyscallArg(tc, index);
DPRINTF(SyscallVerbose, "ioctl(%d, 0x%x, ...)\n", fd, req);
{
std::string path;
- if (!tc->getMemPort()->tryReadString(path, process->getSyscallArg(tc, 0)))
+ int index = 0;
+ if (!tc->getMemPort()->tryReadString(path,
+ process->getSyscallArg(tc, index)))
return -EFAULT;
if (path == "/dev/sysdev0") {
return -ENOENT;
}
- int tgtFlags = process->getSyscallArg(tc, 1);
- int mode = process->getSyscallArg(tc, 2);
+ int tgtFlags = process->getSyscallArg(tc, index);
+ int mode = process->getSyscallArg(tc, index);
int hostFlags = 0;
// translate open flags
ThreadContext *tc)
{
- TypedBufferArg<typename OS::tgt_sysinfo> sysinfo(process->getSyscallArg(tc, 0));
+ int index = 0;
+ TypedBufferArg<typename OS::tgt_sysinfo>
+ sysinfo(process->getSyscallArg(tc, index));
- sysinfo->uptime=seconds_since_epoch;
- sysinfo->totalram=process->system->memSize();
+ sysinfo->uptime=seconds_since_epoch;
+ sysinfo->totalram=process->system->memSize();
- sysinfo.copyOut(tc->getMemPort());
+ sysinfo.copyOut(tc->getMemPort());
- return 0;
+ return 0;
}
/// Target chmod() handler.
{
std::string path;
- if (!tc->getMemPort()->tryReadString(path, process->getSyscallArg(tc, 0)))
+ int index = 0;
+ if (!tc->getMemPort()->tryReadString(path,
+ process->getSyscallArg(tc, index))) {
return -EFAULT;
+ }
- uint32_t mode = process->getSyscallArg(tc, 1);
+ uint32_t mode = process->getSyscallArg(tc, index);
mode_t hostMode = 0;
// XXX translate mode flags via OS::something???
fchmodFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- int fd = process->getSyscallArg(tc, 0);
+ int index = 0;
+ int fd = process->getSyscallArg(tc, index);
if (fd < 0 || process->sim_fd(fd) < 0) {
// doesn't map to any simulator fd: not a valid target fd
return -EBADF;
}
- uint32_t mode = process->getSyscallArg(tc, 1);
+ uint32_t mode = process->getSyscallArg(tc, index);
mode_t hostMode = 0;
// XXX translate mode flags via OS::someting???
SyscallReturn
mremapFunc(SyscallDesc *desc, int callnum, LiveProcess *process, ThreadContext *tc)
{
- Addr start = process->getSyscallArg(tc, 0);
- uint64_t old_length = process->getSyscallArg(tc, 1);
- uint64_t new_length = process->getSyscallArg(tc, 2);
- uint64_t flags = process->getSyscallArg(tc, 3);
+ int index = 0;
+ Addr start = process->getSyscallArg(tc, index);
+ uint64_t old_length = process->getSyscallArg(tc, index);
+ uint64_t new_length = process->getSyscallArg(tc, index);
+ uint64_t flags = process->getSyscallArg(tc, index);
if ((start % TheISA::VMPageSize != 0) ||
(new_length % TheISA::VMPageSize != 0)) {
{
std::string path;
- if (!tc->getMemPort()->tryReadString(path, process->getSyscallArg(tc, 0)))
- return -EFAULT;
+ int index = 0;
+ if (!tc->getMemPort()->tryReadString(path,
+ process->getSyscallArg(tc, index))) {
+ return -EFAULT;
+ }
+ Addr bufPtr = process->getSyscallArg(tc, index);
// Adjust path for current working directory
path = process->fullPath(path);
if (result < 0)
return -errno;
- copyOutStatBuf<OS>(tc->getMemPort(), process->getSyscallArg(tc, 1),
- &hostBuf);
+ copyOutStatBuf<OS>(tc->getMemPort(), bufPtr, &hostBuf);
return 0;
}
{
std::string path;
- if (!tc->getMemPort()->tryReadString(path, process->getSyscallArg(tc, 0)))
+ int index = 0;
+ if (!tc->getMemPort()->tryReadString(path,
+ process->getSyscallArg(tc, index)))
return -EFAULT;
+ Addr bufPtr = process->getSyscallArg(tc, index);
// Adjust path for current working directory
path = process->fullPath(path);
if (result < 0)
return -errno;
- copyOutStat64Buf<OS>(tc->getMemPort(), process->getSyscallArg(tc, 1),
- &hostBuf);
+ copyOutStat64Buf<OS>(tc->getMemPort(), bufPtr, &hostBuf);
return 0;
}
fstat64Func(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- int fd = process->getSyscallArg(tc, 0);
+ int index = 0;
+ int fd = process->getSyscallArg(tc, index);
+ Addr bufPtr = process->getSyscallArg(tc, index);
if (fd < 0 || process->sim_fd(fd) < 0) {
// doesn't map to any simulator fd: not a valid target fd
return -EBADF;
if (result < 0)
return -errno;
- copyOutStat64Buf<OS>(tc->getMemPort(), process->getSyscallArg(tc, 1),
- &hostBuf, (fd == 1));
+ copyOutStat64Buf<OS>(tc->getMemPort(), bufPtr, &hostBuf, (fd == 1));
return 0;
}
{
std::string path;
- if (!tc->getMemPort()->tryReadString(path, process->getSyscallArg(tc, 0)))
- return -EFAULT;
+ int index = 0;
+ if (!tc->getMemPort()->tryReadString(path,
+ process->getSyscallArg(tc, index))) {
+ return -EFAULT;
+ }
+ Addr bufPtr = process->getSyscallArg(tc, index);
// Adjust path for current working directory
path = process->fullPath(path);
if (result < 0)
return -errno;
- copyOutStatBuf<OS>(tc->getMemPort(), process->getSyscallArg(tc, 1),
- &hostBuf);
+ copyOutStatBuf<OS>(tc->getMemPort(), bufPtr, &hostBuf);
return 0;
}
{
std::string path;
- if (!tc->getMemPort()->tryReadString(path, process->getSyscallArg(tc, 0)))
- return -EFAULT;
+ int index = 0;
+ if (!tc->getMemPort()->tryReadString(path,
+ process->getSyscallArg(tc, index))) {
+ return -EFAULT;
+ }
+ Addr bufPtr = process->getSyscallArg(tc, index);
// Adjust path for current working directory
path = process->fullPath(path);
if (result < 0)
return -errno;
- copyOutStat64Buf<OS>(tc->getMemPort(), process->getSyscallArg(tc, 1),
- &hostBuf);
+ copyOutStat64Buf<OS>(tc->getMemPort(), bufPtr, &hostBuf);
return 0;
}
fstatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- int fd = process->sim_fd(process->getSyscallArg(tc, 0));
+ int index = 0;
+ int fd = process->sim_fd(process->getSyscallArg(tc, index));
+ Addr bufPtr = process->getSyscallArg(tc, index);
DPRINTF(SyscallVerbose, "fstat(%d, ...)\n", fd);
if (result < 0)
return -errno;
- copyOutStatBuf<OS>(tc->getMemPort(), process->getSyscallArg(tc, 1),
- &hostBuf, (fd == 1));
+ copyOutStatBuf<OS>(tc->getMemPort(), bufPtr, &hostBuf, (fd == 1));
return 0;
}
{
std::string path;
- if (!tc->getMemPort()->tryReadString(path, process->getSyscallArg(tc, 0)))
- return -EFAULT;
+ int index = 0;
+ if (!tc->getMemPort()->tryReadString(path,
+ process->getSyscallArg(tc, index))) {
+ return -EFAULT;
+ }
+ Addr bufPtr = process->getSyscallArg(tc, index);
// Adjust path for current working directory
path = process->fullPath(path);
if (result < 0)
return -errno;
- OS::copyOutStatfsBuf(tc->getMemPort(),
- (Addr)(process->getSyscallArg(tc, 1)), &hostBuf);
+ OS::copyOutStatfsBuf(tc->getMemPort(), bufPtr, &hostBuf);
return 0;
}
fstatfsFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- int fd = process->sim_fd(process->getSyscallArg(tc, 0));
+ int index = 0;
+ int fd = process->sim_fd(process->getSyscallArg(tc, index));
+ Addr bufPtr = process->getSyscallArg(tc, index);
if (fd < 0)
return -EBADF;
if (result < 0)
return -errno;
- OS::copyOutStatfsBuf(tc->getMemPort(), process->getSyscallArg(tc, 1),
- &hostBuf);
+ OS::copyOutStatfsBuf(tc->getMemPort(), bufPtr, &hostBuf);
return 0;
}
writevFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- int fd = process->getSyscallArg(tc, 0);
+ int index = 0;
+ int fd = process->getSyscallArg(tc, index);
if (fd < 0 || process->sim_fd(fd) < 0) {
// doesn't map to any simulator fd: not a valid target fd
return -EBADF;
}
TranslatingPort *p = tc->getMemPort();
- uint64_t tiov_base = process->getSyscallArg(tc, 1);
- size_t count = process->getSyscallArg(tc, 2);
+ uint64_t tiov_base = process->getSyscallArg(tc, index);
+ size_t count = process->getSyscallArg(tc, index);
struct iovec hiov[count];
for (size_t i = 0; i < count; ++i) {
typename OS::tgt_iovec tiov;
SyscallReturn
mmapFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
{
- Addr start = p->getSyscallArg(tc, 0);
- uint64_t length = p->getSyscallArg(tc, 1);
- // int prot = p->getSyscallArg(tc, 2);
- int flags = p->getSyscallArg(tc, 3);
- // int fd = p->sim_fd(p->getSyscallArg(tc, 4));
- // int offset = p->getSyscallArg(tc, 5);
+ int index = 0;
+ Addr start = p->getSyscallArg(tc, index);
+ uint64_t length = p->getSyscallArg(tc, index);
+ index++; // int prot = p->getSyscallArg(tc, index);
+ int flags = p->getSyscallArg(tc, index);
+ int fd = p->sim_fd(p->getSyscallArg(tc, index));
+ // int offset = p->getSyscallArg(tc, index);
if ((start % TheISA::VMPageSize) != 0 ||
if (!(flags & OS::TGT_MAP_ANONYMOUS)) {
warn("allowing mmap of file @ fd %d. "
- "This will break if not /dev/zero.", p->getSyscallArg(tc, 4));
+ "This will break if not /dev/zero.", fd);
}
return start;
getrlimitFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- unsigned resource = process->getSyscallArg(tc, 0);
- TypedBufferArg<typename OS::rlimit> rlp(process->getSyscallArg(tc, 1));
+ int index = 0;
+ unsigned resource = process->getSyscallArg(tc, index);
+ TypedBufferArg<typename OS::rlimit> rlp(process->getSyscallArg(tc, index));
switch (resource) {
case OS::TGT_RLIMIT_STACK:
gettimeofdayFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- TypedBufferArg<typename OS::timeval> tp(process->getSyscallArg(tc, 0));
+ int index = 0;
+ TypedBufferArg<typename OS::timeval> tp(process->getSyscallArg(tc, index));
getElapsedTime(tp->tv_sec, tp->tv_usec);
tp->tv_sec += seconds_since_epoch;
{
std::string path;
- if (!tc->getMemPort()->tryReadString(path, process->getSyscallArg(tc, 0)))
- return -EFAULT;
+ int index = 0;
+ if (!tc->getMemPort()->tryReadString(path,
+ process->getSyscallArg(tc, index))) {
+ return -EFAULT;
+ }
- TypedBufferArg<typename OS::timeval [2]> tp(process->getSyscallArg(tc, 1));
+ TypedBufferArg<typename OS::timeval [2]>
+ tp(process->getSyscallArg(tc, index));
tp.copyIn(tc->getMemPort());
struct timeval hostTimeval[2];
getrusageFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- int who = process->getSyscallArg(tc, 0); // THREAD, SELF, or CHILDREN
- TypedBufferArg<typename OS::rusage> rup(process->getSyscallArg(tc, 1));
+ int index = 0;
+ int who = process->getSyscallArg(tc, index); // THREAD, SELF, or CHILDREN
+ TypedBufferArg<typename OS::rusage> rup(process->getSyscallArg(tc, index));
rup->ru_utime.tv_sec = 0;
rup->ru_utime.tv_usec = 0;
timesFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- TypedBufferArg<typename OS::tms> bufp(process->getSyscallArg(tc, 0));
+ int index = 0;
+ TypedBufferArg<typename OS::tms> bufp(process->getSyscallArg(tc, index));
// Fill in the time structure (in clocks)
int64_t clocks = curTick * OS::_SC_CLK_TCK / Clock::Int::s;
getElapsedTime(sec, usec);
sec += seconds_since_epoch;
- Addr taddr = (Addr)process->getSyscallArg(tc, 0);
+ int index = 0;
+ Addr taddr = (Addr)process->getSyscallArg(tc, index);
if(taddr != 0) {
typename OS::time_t t = sec;
t = htog(t);