It now runs hello world binary.
Fixed the exec context proxy class to have a getMemPort function. arch/alpha/linux/process.cc: arch/alpha/tru64/process.cc: kern/tru64/tru64.hh: sim/syscall_emul.cc: sim/syscall_emul.hh: Fix to use new exec context proxy --HG-- extra : convert_revision : eaa05dfab3fdb77627f6cf404a2569a44232f604
This commit is contained in:
parent
d07115f972
commit
5ba4c8e96e
5 changed files with 65 additions and 65 deletions
|
@ -54,7 +54,7 @@ unameFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
|
strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
|
||||||
strcpy(name->machine, "alpha");
|
strcpy(name->machine, "alpha");
|
||||||
|
|
||||||
name.copyOut(xc->port);
|
name.copyOut(xc->getMemPort());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ osf_getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
TypedBufferArg<uint64_t> fpcr(xc->getSyscallArg(1));
|
TypedBufferArg<uint64_t> fpcr(xc->getSyscallArg(1));
|
||||||
// I don't think this exactly matches the HW FPCR
|
// I don't think this exactly matches the HW FPCR
|
||||||
*fpcr = 0;
|
*fpcr = 0;
|
||||||
fpcr.copyOut(xc->port);
|
fpcr.copyOut(xc->getMemPort());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ osf_setsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
case 14: { // SSI_IEEE_FP_CONTROL
|
case 14: { // SSI_IEEE_FP_CONTROL
|
||||||
TypedBufferArg<uint64_t> fpcr(xc->getSyscallArg(1));
|
TypedBufferArg<uint64_t> fpcr(xc->getSyscallArg(1));
|
||||||
// I don't think this exactly matches the HW FPCR
|
// I don't think this exactly matches the HW FPCR
|
||||||
fpcr.copyIn(xc->port);
|
fpcr.copyIn(xc->getMemPort());
|
||||||
DPRINTFR(SyscallVerbose, "osf_setsysinfo(SSI_IEEE_FP_CONTROL): "
|
DPRINTFR(SyscallVerbose, "osf_setsysinfo(SSI_IEEE_FP_CONTROL): "
|
||||||
" setting FPCR to 0x%x\n", gtoh(*(uint64_t*)fpcr));
|
" setting FPCR to 0x%x\n", gtoh(*(uint64_t*)fpcr));
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -50,7 +50,7 @@ unameFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
strcpy(name->version, "732");
|
strcpy(name->version, "732");
|
||||||
strcpy(name->machine, "alpha");
|
strcpy(name->machine, "alpha");
|
||||||
|
|
||||||
name.copyOut(xc->port);
|
name.copyOut(xc->getMemPort());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,21 +67,21 @@ getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
case Tru64::GSI_MAX_CPU: {
|
case Tru64::GSI_MAX_CPU: {
|
||||||
TypedBufferArg<uint32_t> max_cpu(xc->getSyscallArg(1));
|
TypedBufferArg<uint32_t> max_cpu(xc->getSyscallArg(1));
|
||||||
*max_cpu = htog((uint32_t)process->numCpus());
|
*max_cpu = htog((uint32_t)process->numCpus());
|
||||||
max_cpu.copyOut(xc->port);
|
max_cpu.copyOut(xc->getMemPort());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Tru64::GSI_CPUS_IN_BOX: {
|
case Tru64::GSI_CPUS_IN_BOX: {
|
||||||
TypedBufferArg<uint32_t> cpus_in_box(xc->getSyscallArg(1));
|
TypedBufferArg<uint32_t> cpus_in_box(xc->getSyscallArg(1));
|
||||||
*cpus_in_box = htog((uint32_t)process->numCpus());
|
*cpus_in_box = htog((uint32_t)process->numCpus());
|
||||||
cpus_in_box.copyOut(xc->port);
|
cpus_in_box.copyOut(xc->getMemPort());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Tru64::GSI_PHYSMEM: {
|
case Tru64::GSI_PHYSMEM: {
|
||||||
TypedBufferArg<uint64_t> physmem(xc->getSyscallArg(1));
|
TypedBufferArg<uint64_t> physmem(xc->getSyscallArg(1));
|
||||||
*physmem = htog((uint64_t)1024 * 1024); // physical memory in KB
|
*physmem = htog((uint64_t)1024 * 1024); // physical memory in KB
|
||||||
physmem.copyOut(xc->port);
|
physmem.copyOut(xc->getMemPort());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,14 +98,14 @@ getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
infop->cpu_ex_binding = htog(0);
|
infop->cpu_ex_binding = htog(0);
|
||||||
infop->mhz = htog(667);
|
infop->mhz = htog(667);
|
||||||
|
|
||||||
infop.copyOut(xc->port);
|
infop.copyOut(xc->getMemPort());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Tru64::GSI_PROC_TYPE: {
|
case Tru64::GSI_PROC_TYPE: {
|
||||||
TypedBufferArg<uint64_t> proc_type(xc->getSyscallArg(1));
|
TypedBufferArg<uint64_t> proc_type(xc->getSyscallArg(1));
|
||||||
*proc_type = htog((uint64_t)11);
|
*proc_type = htog((uint64_t)11);
|
||||||
proc_type.copyOut(xc->port);
|
proc_type.copyOut(xc->getMemPort());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,14 +114,14 @@ getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
strncpy((char *)bufArg.bufferPtr(),
|
strncpy((char *)bufArg.bufferPtr(),
|
||||||
"COMPAQ Professional Workstation XP1000",
|
"COMPAQ Professional Workstation XP1000",
|
||||||
nbytes);
|
nbytes);
|
||||||
bufArg.copyOut(xc->port);
|
bufArg.copyOut(xc->getMemPort());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Tru64::GSI_CLK_TCK: {
|
case Tru64::GSI_CLK_TCK: {
|
||||||
TypedBufferArg<uint64_t> clk_hz(xc->getSyscallArg(1));
|
TypedBufferArg<uint64_t> clk_hz(xc->getSyscallArg(1));
|
||||||
*clk_hz = htog((uint64_t)1024);
|
*clk_hz = htog((uint64_t)1024);
|
||||||
clk_hz.copyOut(xc->port);
|
clk_hz.copyOut(xc->getMemPort());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -668,7 +668,7 @@ class Tru64 {
|
||||||
|
|
||||||
// just pass basep through uninterpreted.
|
// just pass basep through uninterpreted.
|
||||||
TypedBufferArg<int64_t> basep(tgt_basep);
|
TypedBufferArg<int64_t> basep(tgt_basep);
|
||||||
basep.copyIn(xc->port);
|
basep.copyIn(xc->getMemPort());
|
||||||
long host_basep = (off_t)htog((int64_t)*basep);
|
long host_basep = (off_t)htog((int64_t)*basep);
|
||||||
int host_result = getdirentries(fd, host_buf, tgt_nbytes, &host_basep);
|
int host_result = getdirentries(fd, host_buf, tgt_nbytes, &host_basep);
|
||||||
|
|
||||||
|
@ -695,7 +695,7 @@ class Tru64 {
|
||||||
tgt_dp->d_reclen = tgt_bufsize;
|
tgt_dp->d_reclen = tgt_bufsize;
|
||||||
tgt_dp->d_namlen = namelen;
|
tgt_dp->d_namlen = namelen;
|
||||||
strcpy(tgt_dp->d_name, host_dp->d_name);
|
strcpy(tgt_dp->d_name, host_dp->d_name);
|
||||||
tgt_dp.copyOut(xc->port);
|
tgt_dp.copyOut(xc->getMemPort());
|
||||||
|
|
||||||
tgt_buf_ptr += tgt_bufsize;
|
tgt_buf_ptr += tgt_bufsize;
|
||||||
host_buf_ptr += host_dp->d_reclen;
|
host_buf_ptr += host_dp->d_reclen;
|
||||||
|
@ -704,7 +704,7 @@ class Tru64 {
|
||||||
delete [] host_buf;
|
delete [] host_buf;
|
||||||
|
|
||||||
*basep = htog((int64_t)host_basep);
|
*basep = htog((int64_t)host_basep);
|
||||||
basep.copyOut(xc->port);
|
basep.copyOut(xc->getMemPort());
|
||||||
|
|
||||||
return tgt_buf_ptr - tgt_buf;
|
return tgt_buf_ptr - tgt_buf;
|
||||||
#endif
|
#endif
|
||||||
|
@ -718,7 +718,7 @@ class Tru64 {
|
||||||
using TheISA::RegFile;
|
using TheISA::RegFile;
|
||||||
TypedBufferArg<Tru64::sigcontext> sc(xc->getSyscallArg(0));
|
TypedBufferArg<Tru64::sigcontext> sc(xc->getSyscallArg(0));
|
||||||
|
|
||||||
sc.copyIn(xc->port);
|
sc.copyIn(xc->getMemPort());
|
||||||
|
|
||||||
// Restore state from sigcontext structure.
|
// Restore state from sigcontext structure.
|
||||||
// Note that we'll advance PC <- NPC before the end of the cycle,
|
// Note that we'll advance PC <- NPC before the end of the cycle,
|
||||||
|
@ -763,7 +763,7 @@ class Tru64 {
|
||||||
elp->si_phz = htog(clk_hz);
|
elp->si_phz = htog(clk_hz);
|
||||||
elp->si_boottime = htog(seconds_since_epoch); // seconds since epoch?
|
elp->si_boottime = htog(seconds_since_epoch); // seconds since epoch?
|
||||||
elp->si_max_procs = htog(process->numCpus());
|
elp->si_max_procs = htog(process->numCpus());
|
||||||
elp.copyOut(xc->port);
|
elp.copyOut(xc->getMemPort());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -784,7 +784,7 @@ class Tru64 {
|
||||||
{
|
{
|
||||||
TypedBufferArg<Tru64::vm_stack> argp(xc->getSyscallArg(0));
|
TypedBufferArg<Tru64::vm_stack> argp(xc->getSyscallArg(0));
|
||||||
|
|
||||||
argp.copyIn(xc->port);
|
argp.copyIn(xc->getMemPort());
|
||||||
|
|
||||||
// if the user chose an address, just let them have it. Otherwise
|
// if the user chose an address, just let them have it. Otherwise
|
||||||
// pick one for them.
|
// pick one for them.
|
||||||
|
@ -793,7 +793,7 @@ class Tru64 {
|
||||||
int stack_size = (htog(argp->rsize) + htog(argp->ysize) +
|
int stack_size = (htog(argp->rsize) + htog(argp->ysize) +
|
||||||
htog(argp->gsize));
|
htog(argp->gsize));
|
||||||
process->next_thread_stack_base -= stack_size;
|
process->next_thread_stack_base -= stack_size;
|
||||||
argp.copyOut(xc->port);
|
argp.copyOut(xc->getMemPort());
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -813,7 +813,7 @@ class Tru64 {
|
||||||
TypedBufferArg<Tru64::nxm_task_attr> attrp(xc->getSyscallArg(0));
|
TypedBufferArg<Tru64::nxm_task_attr> attrp(xc->getSyscallArg(0));
|
||||||
TypedBufferArg<Addr> configptr_ptr(xc->getSyscallArg(1));
|
TypedBufferArg<Addr> configptr_ptr(xc->getSyscallArg(1));
|
||||||
|
|
||||||
attrp.copyIn(xc->port);
|
attrp.copyIn(xc->getMemPort());
|
||||||
|
|
||||||
if (gtoh(attrp->nxm_version) != NXM_LIB_VERSION) {
|
if (gtoh(attrp->nxm_version) != NXM_LIB_VERSION) {
|
||||||
cerr << "nxm_task_init: thread library version mismatch! "
|
cerr << "nxm_task_init: thread library version mismatch! "
|
||||||
|
@ -854,7 +854,7 @@ class Tru64 {
|
||||||
config->nxm_slot_state = htog(slot_state_addr);
|
config->nxm_slot_state = htog(slot_state_addr);
|
||||||
config->nxm_rad[0] = htog(rad_state_addr);
|
config->nxm_rad[0] = htog(rad_state_addr);
|
||||||
|
|
||||||
config.copyOut(xc->port);
|
config.copyOut(xc->getMemPort());
|
||||||
|
|
||||||
// initialize the slot_state array and copy it out
|
// initialize the slot_state array and copy it out
|
||||||
TypedBufferArg<Tru64::nxm_slot_state_t> slot_state(slot_state_addr,
|
TypedBufferArg<Tru64::nxm_slot_state_t> slot_state(slot_state_addr,
|
||||||
|
@ -867,7 +867,7 @@ class Tru64 {
|
||||||
(i == 0) ? Tru64::NXM_SLOT_BOUND : Tru64::NXM_SLOT_AVAIL;
|
(i == 0) ? Tru64::NXM_SLOT_BOUND : Tru64::NXM_SLOT_AVAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
slot_state.copyOut(xc->port);
|
slot_state.copyOut(xc->getMemPort());
|
||||||
|
|
||||||
// same for the per-RAD "shared" struct. Note that we need to
|
// same for the per-RAD "shared" struct. Note that we need to
|
||||||
// allocate extra bytes for the per-VP array which is embedded at
|
// allocate extra bytes for the per-VP array which is embedded at
|
||||||
|
@ -901,13 +901,13 @@ class Tru64 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rad_state.copyOut(xc->port);
|
rad_state.copyOut(xc->getMemPort());
|
||||||
|
|
||||||
//
|
//
|
||||||
// copy pointer to shared config area out to user
|
// copy pointer to shared config area out to user
|
||||||
//
|
//
|
||||||
*configptr_ptr = htog(config_addr);
|
*configptr_ptr = htog(config_addr);
|
||||||
configptr_ptr.copyOut(xc->port);
|
configptr_ptr.copyOut(xc->getMemPort());
|
||||||
|
|
||||||
// Register this as a valid address range with the process
|
// Register this as a valid address range with the process
|
||||||
process->nxm_start = base_addr;
|
process->nxm_start = base_addr;
|
||||||
|
@ -944,7 +944,7 @@ class Tru64 {
|
||||||
int thread_index = xc->getSyscallArg(2);
|
int thread_index = xc->getSyscallArg(2);
|
||||||
|
|
||||||
// get attribute args
|
// get attribute args
|
||||||
attrp.copyIn(xc->port);
|
attrp.copyIn(xc->getMemPort());
|
||||||
|
|
||||||
if (gtoh(attrp->version) != NXM_LIB_VERSION) {
|
if (gtoh(attrp->version) != NXM_LIB_VERSION) {
|
||||||
cerr << "nxm_thread_create: thread library version mismatch! "
|
cerr << "nxm_thread_create: thread library version mismatch! "
|
||||||
|
@ -969,7 +969,7 @@ class Tru64 {
|
||||||
|
|
||||||
TypedBufferArg<Tru64::nxm_shared> rad_state(0x14000,
|
TypedBufferArg<Tru64::nxm_shared> rad_state(0x14000,
|
||||||
rad_state_size);
|
rad_state_size);
|
||||||
rad_state.copyIn(xc->port);
|
rad_state.copyIn(xc->getMemPort());
|
||||||
|
|
||||||
uint64_t uniq_val = gtoh(attrp->pthid) - gtoh(rad_state->nxm_uniq_offset);
|
uint64_t uniq_val = gtoh(attrp->pthid) - gtoh(rad_state->nxm_uniq_offset);
|
||||||
|
|
||||||
|
@ -980,7 +980,7 @@ class Tru64 {
|
||||||
|
|
||||||
// This is supposed to be a port number. Make something up.
|
// This is supposed to be a port number. Make something up.
|
||||||
*kidp = htog(99);
|
*kidp = htog(99);
|
||||||
kidp.copyOut(xc->port);
|
kidp.copyOut(xc->getMemPort());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} else if (gtoh(attrp->type) == Tru64::NXM_TYPE_VP) {
|
} else if (gtoh(attrp->type) == Tru64::NXM_TYPE_VP) {
|
||||||
|
@ -994,7 +994,7 @@ class Tru64 {
|
||||||
ssp->nxm_u.pth_id = attrp->pthid;
|
ssp->nxm_u.pth_id = attrp->pthid;
|
||||||
ssp->nxm_u.nxm_active = htog(uniq_val | 1);
|
ssp->nxm_u.nxm_active = htog(uniq_val | 1);
|
||||||
|
|
||||||
rad_state.copyOut(xc->port);
|
rad_state.copyOut(xc->getMemPort());
|
||||||
|
|
||||||
Addr slot_state_addr = 0x12000 + sizeof(Tru64::nxm_config_info);
|
Addr slot_state_addr = 0x12000 + sizeof(Tru64::nxm_config_info);
|
||||||
int slot_state_size =
|
int slot_state_size =
|
||||||
|
@ -1004,7 +1004,7 @@ class Tru64 {
|
||||||
slot_state(slot_state_addr,
|
slot_state(slot_state_addr,
|
||||||
slot_state_size);
|
slot_state_size);
|
||||||
|
|
||||||
slot_state.copyIn(xc->port);
|
slot_state.copyIn(xc->getMemPort());
|
||||||
|
|
||||||
if (slot_state[thread_index] != Tru64::NXM_SLOT_AVAIL) {
|
if (slot_state[thread_index] != Tru64::NXM_SLOT_AVAIL) {
|
||||||
cerr << "nxm_thread_createFunc: requested VP slot "
|
cerr << "nxm_thread_createFunc: requested VP slot "
|
||||||
|
@ -1016,7 +1016,7 @@ class Tru64 {
|
||||||
// doesn't work anyway
|
// doesn't work anyway
|
||||||
slot_state[thread_index] = Tru64::NXM_SLOT_BOUND;
|
slot_state[thread_index] = Tru64::NXM_SLOT_BOUND;
|
||||||
|
|
||||||
slot_state.copyOut(xc->port);
|
slot_state.copyOut(xc->getMemPort());
|
||||||
|
|
||||||
// Find a free simulator execution context.
|
// Find a free simulator execution context.
|
||||||
for (int i = 0; i < process->numCpus(); ++i) {
|
for (int i = 0; i < process->numCpus(); ++i) {
|
||||||
|
@ -1030,7 +1030,7 @@ class Tru64 {
|
||||||
// and get away with just sticking the thread index
|
// and get away with just sticking the thread index
|
||||||
// here.
|
// here.
|
||||||
*kidp = htog(thread_index);
|
*kidp = htog(thread_index);
|
||||||
kidp.copyOut(xc->port);
|
kidp.copyOut(xc->getMemPort());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1159,12 +1159,12 @@ class Tru64 {
|
||||||
{
|
{
|
||||||
TypedBufferArg<uint64_t> lockp(uaddr);
|
TypedBufferArg<uint64_t> lockp(uaddr);
|
||||||
|
|
||||||
lockp.copyIn(xc->port);
|
lockp.copyIn(xc->getMemPort());
|
||||||
|
|
||||||
if (gtoh(*lockp) == 0) {
|
if (gtoh(*lockp) == 0) {
|
||||||
// lock is free: grab it
|
// lock is free: grab it
|
||||||
*lockp = htog(1);
|
*lockp = htog(1);
|
||||||
lockp.copyOut(xc->port);
|
lockp.copyOut(xc->getMemPort());
|
||||||
} else {
|
} else {
|
||||||
// lock is busy: disable until free
|
// lock is busy: disable until free
|
||||||
process->waitList.push_back(Process::WaitRec(uaddr, xc));
|
process->waitList.push_back(Process::WaitRec(uaddr, xc));
|
||||||
|
@ -1178,7 +1178,7 @@ class Tru64 {
|
||||||
{
|
{
|
||||||
TypedBufferArg<uint64_t> lockp(uaddr);
|
TypedBufferArg<uint64_t> lockp(uaddr);
|
||||||
|
|
||||||
lockp.copyIn(xc->port);
|
lockp.copyIn(xc->getMemPort());
|
||||||
assert(*lockp != 0);
|
assert(*lockp != 0);
|
||||||
|
|
||||||
// Check for a process waiting on the lock.
|
// Check for a process waiting on the lock.
|
||||||
|
@ -1187,7 +1187,7 @@ class Tru64 {
|
||||||
// clear lock field if no waiting context is taking over the lock
|
// clear lock field if no waiting context is taking over the lock
|
||||||
if (num_waiting == 0) {
|
if (num_waiting == 0) {
|
||||||
*lockp = 0;
|
*lockp = 0;
|
||||||
lockp.copyOut(xc->port);
|
lockp.copyOut(xc->getMemPort());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1214,12 +1214,12 @@ class Tru64 {
|
||||||
Addr uaddr = xc->getSyscallArg(0);
|
Addr uaddr = xc->getSyscallArg(0);
|
||||||
TypedBufferArg<uint64_t> lockp(uaddr);
|
TypedBufferArg<uint64_t> lockp(uaddr);
|
||||||
|
|
||||||
lockp.copyIn(xc->port);
|
lockp.copyIn(xc->getMemPort());
|
||||||
|
|
||||||
if (gtoh(*lockp) == 0) {
|
if (gtoh(*lockp) == 0) {
|
||||||
// lock is free: grab it
|
// lock is free: grab it
|
||||||
*lockp = htog(1);
|
*lockp = htog(1);
|
||||||
lockp.copyOut(xc->port);
|
lockp.copyOut(xc->getMemPort());
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1274,7 +1274,7 @@ class Tru64 {
|
||||||
TypedBufferArg<uint64_t> lockp(lock_addr);
|
TypedBufferArg<uint64_t> lockp(lock_addr);
|
||||||
|
|
||||||
// user is supposed to acquire lock before entering
|
// user is supposed to acquire lock before entering
|
||||||
lockp.copyIn(xc->port);
|
lockp.copyIn(xc->getMemPort());
|
||||||
assert(gtoh(*lockp) != 0);
|
assert(gtoh(*lockp) != 0);
|
||||||
|
|
||||||
m5_unlock_mutex(lock_addr, process, xc);
|
m5_unlock_mutex(lock_addr, process, xc);
|
||||||
|
|
|
@ -130,7 +130,7 @@ readFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
|
||||||
int bytes_read = read(fd, bufArg.bufferPtr(), nbytes);
|
int bytes_read = read(fd, bufArg.bufferPtr(), nbytes);
|
||||||
|
|
||||||
if (bytes_read != -1)
|
if (bytes_read != -1)
|
||||||
bufArg.copyOut(xc->port);
|
bufArg.copyOut(xc->getMemPort());
|
||||||
|
|
||||||
return bytes_read;
|
return bytes_read;
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ writeFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
|
||||||
int nbytes = xc->getSyscallArg(2);
|
int nbytes = xc->getSyscallArg(2);
|
||||||
BufferArg bufArg(xc->getSyscallArg(1), nbytes);
|
BufferArg bufArg(xc->getSyscallArg(1), nbytes);
|
||||||
|
|
||||||
bufArg.copyIn(xc->port);
|
bufArg.copyIn(xc->getMemPort());
|
||||||
|
|
||||||
int bytes_written = write(fd, bufArg.bufferPtr(), nbytes);
|
int bytes_written = write(fd, bufArg.bufferPtr(), nbytes);
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ gethostnameFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
|
||||||
|
|
||||||
strncpy((char *)name.bufferPtr(), hostname, name_len);
|
strncpy((char *)name.bufferPtr(), hostname, name_len);
|
||||||
|
|
||||||
name.copyOut(xc->port);
|
name.copyOut(xc->getMemPort());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ unlinkFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
|
||||||
{
|
{
|
||||||
string path;
|
string path;
|
||||||
|
|
||||||
if (xc->port->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
|
if (xc->getMemPort()->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
|
||||||
return (TheISA::IntReg)-EFAULT;
|
return (TheISA::IntReg)-EFAULT;
|
||||||
|
|
||||||
int result = unlink(path.c_str());
|
int result = unlink(path.c_str());
|
||||||
|
@ -205,12 +205,12 @@ renameFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
|
||||||
{
|
{
|
||||||
string old_name;
|
string old_name;
|
||||||
|
|
||||||
if (xc->port->readStringFunctional(old_name, xc->getSyscallArg(0)) != NoFault)
|
if (xc->getMemPort()->readStringFunctional(old_name, xc->getSyscallArg(0)) != NoFault)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
string new_name;
|
string new_name;
|
||||||
|
|
||||||
if (xc->port->readStringFunctional(new_name, xc->getSyscallArg(1)) != NoFault)
|
if (xc->getMemPort()->readStringFunctional(new_name, xc->getSyscallArg(1)) != NoFault)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
int64_t result = rename(old_name.c_str(), new_name.c_str());
|
int64_t result = rename(old_name.c_str(), new_name.c_str());
|
||||||
|
@ -222,7 +222,7 @@ truncateFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
|
||||||
{
|
{
|
||||||
string path;
|
string path;
|
||||||
|
|
||||||
if (xc->port->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
|
if (xc->getMemPort()->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
off_t length = xc->getSyscallArg(1);
|
off_t length = xc->getSyscallArg(1);
|
||||||
|
@ -250,7 +250,7 @@ chownFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
|
||||||
{
|
{
|
||||||
string path;
|
string path;
|
||||||
|
|
||||||
if (xc->port->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
|
if (xc->getMemPort()->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
/* XXX endianess */
|
/* XXX endianess */
|
||||||
|
|
|
@ -370,7 +370,7 @@ openFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
{
|
{
|
||||||
std::string path;
|
std::string path;
|
||||||
|
|
||||||
if (xc->port->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
|
if (xc->getMemPort()->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
if (path == "/dev/sysdev0") {
|
if (path == "/dev/sysdev0") {
|
||||||
|
@ -417,7 +417,7 @@ chmodFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
{
|
{
|
||||||
std::string path;
|
std::string path;
|
||||||
|
|
||||||
if (xc->port->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
|
if (xc->getMemPort()->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
uint32_t mode = xc->getSyscallArg(1);
|
uint32_t mode = xc->getSyscallArg(1);
|
||||||
|
@ -470,7 +470,7 @@ statFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
{
|
{
|
||||||
std::string path;
|
std::string path;
|
||||||
|
|
||||||
if (xc->port->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
|
if (xc->getMemPort()->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
struct stat hostBuf;
|
struct stat hostBuf;
|
||||||
|
@ -479,7 +479,7 @@ statFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
OS::copyOutStatBuf(xc->port, xc->getSyscallArg(1), &hostBuf);
|
OS::copyOutStatBuf(xc->getMemPort(), xc->getSyscallArg(1), &hostBuf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -508,7 +508,7 @@ fstat64Func(SyscallDesc *desc, int callnum, Process *process,
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
OS::copyOutStat64Buf(xc->port, fd, xc->getSyscallArg(1), &hostBuf);
|
OS::copyOutStat64Buf(xc->getMemPort(), fd, xc->getSyscallArg(1), &hostBuf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -522,7 +522,7 @@ lstatFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
{
|
{
|
||||||
std::string path;
|
std::string path;
|
||||||
|
|
||||||
if (xc->port->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
|
if (xc->getMemPort()->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
struct stat hostBuf;
|
struct stat hostBuf;
|
||||||
|
@ -531,7 +531,7 @@ lstatFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
OS::copyOutStatBuf(xc->port, xc->getSyscallArg(1), &hostBuf);
|
OS::copyOutStatBuf(xc->getMemPort(), xc->getSyscallArg(1), &hostBuf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -544,7 +544,7 @@ lstat64Func(SyscallDesc *desc, int callnum, Process *process,
|
||||||
{
|
{
|
||||||
std::string path;
|
std::string path;
|
||||||
|
|
||||||
if (xc->port->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
|
if (xc->getMemPort()->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
#if BSD_HOST
|
#if BSD_HOST
|
||||||
|
@ -558,7 +558,7 @@ lstat64Func(SyscallDesc *desc, int callnum, Process *process,
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
OS::copyOutStat64Buf(xc->port, -1, xc->getSyscallArg(1), &hostBuf);
|
OS::copyOutStat64Buf(xc->getMemPort(), -1, xc->getSyscallArg(1), &hostBuf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -582,7 +582,7 @@ fstatFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
OS::copyOutStatBuf(xc->port, xc->getSyscallArg(1), &hostBuf);
|
OS::copyOutStatBuf(xc->getMemPort(), xc->getSyscallArg(1), &hostBuf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -596,7 +596,7 @@ statfsFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
{
|
{
|
||||||
std::string path;
|
std::string path;
|
||||||
|
|
||||||
if (xc->port->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
|
if (xc->getMemPort()->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
struct statfs hostBuf;
|
struct statfs hostBuf;
|
||||||
|
@ -605,7 +605,7 @@ statfsFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
OS::copyOutStatfsBuf(xc->port, xc->getSyscallArg(1), &hostBuf);
|
OS::copyOutStatfsBuf(xc->getMemPort(), xc->getSyscallArg(1), &hostBuf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -628,7 +628,7 @@ fstatfsFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
OS::copyOutStatfsBuf(xc->port, xc->getSyscallArg(1), &hostBuf);
|
OS::copyOutStatfsBuf(xc->getMemPort(), xc->getSyscallArg(1), &hostBuf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -652,11 +652,11 @@ writevFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
typename OS::tgt_iovec tiov;
|
typename OS::tgt_iovec tiov;
|
||||||
xc->port->readBlobFunctional(tiov_base + i*sizeof(typename OS::tgt_iovec),(uint8_t*)
|
xc->getMemPort()->readBlobFunctional(tiov_base + i*sizeof(typename OS::tgt_iovec),(uint8_t*)
|
||||||
&tiov, sizeof(typename OS::tgt_iovec));
|
&tiov, sizeof(typename OS::tgt_iovec));
|
||||||
hiov[i].iov_len = gtoh(tiov.iov_len);
|
hiov[i].iov_len = gtoh(tiov.iov_len);
|
||||||
hiov[i].iov_base = new char [hiov[i].iov_len];
|
hiov[i].iov_base = new char [hiov[i].iov_len];
|
||||||
xc->port->readBlobFunctional(gtoh(tiov.iov_base),
|
xc->getMemPort()->readBlobFunctional(gtoh(tiov.iov_base),
|
||||||
(uint8_t *)hiov[i].iov_base, hiov[i].iov_len);
|
(uint8_t *)hiov[i].iov_base, hiov[i].iov_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -739,7 +739,7 @@ getrlimitFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rlp.copyOut(xc->port);
|
rlp.copyOut(xc->getMemPort());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -756,7 +756,7 @@ gettimeofdayFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
tp->tv_sec = htog(tp->tv_sec);
|
tp->tv_sec = htog(tp->tv_sec);
|
||||||
tp->tv_usec = htog(tp->tv_usec);
|
tp->tv_usec = htog(tp->tv_usec);
|
||||||
|
|
||||||
tp.copyOut(xc->port);
|
tp.copyOut(xc->getMemPort());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -770,11 +770,11 @@ utimesFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
{
|
{
|
||||||
std::string path;
|
std::string path;
|
||||||
|
|
||||||
if (xc->port->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
|
if (xc->getMemPort()->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
TypedBufferArg<typename OS::timeval [2]> tp(xc->getSyscallArg(1));
|
TypedBufferArg<typename OS::timeval [2]> tp(xc->getSyscallArg(1));
|
||||||
tp.copyIn(xc->port);
|
tp.copyIn(xc->getMemPort());
|
||||||
|
|
||||||
struct timeval hostTimeval[2];
|
struct timeval hostTimeval[2];
|
||||||
for (int i = 0; i < 2; ++i)
|
for (int i = 0; i < 2; ++i)
|
||||||
|
@ -826,7 +826,7 @@ getrusageFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
rup->ru_nvcsw = 0;
|
rup->ru_nvcsw = 0;
|
||||||
rup->ru_nivcsw = 0;
|
rup->ru_nivcsw = 0;
|
||||||
|
|
||||||
rup.copyOut(xc->port);
|
rup.copyOut(xc->getMemPort());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue