mem/memory.cc
mem/page_table.cc
mem/physical.cc
- mem/proxy.cc
+ mem/translating_port.cc
python/pyconfig.cc
python/embedded_py.cc
arch/alpha/alpha_common_syscall_emul.cc
arch/alpha/alpha_linux_process.cc
arch/alpha/alpha_tru64_process.cc
- cpu/memtest/memtest.cc
- encumbered/eio/eio.cc
+
encumbered/eio/exolex.cc
encumbered/eio/libexo.cc
sim/process.cc
sim/syscall_emul.cc
''')
+eio_sources = Split('''
+ encumbered/eio/eio.cc
+ ''')
+
+memtest_sources = Split('''
+ cpu/memtest/memtest.cc
+ ''')
+
targetarch_files = Split('''
alpha_common_syscall_emul.hh
alpha_linux_process.hh
#include "cpu/base.hh"
#include "cpu/exec_context.hh"
-#include "mem/port.hh"
+#include "mem/translating_port.hh"
#include "sim/fake_syscall.hh"
#include "sim/host.hh"
#include "sim/process.hh"
/// buffer. Also copies the target buffer out to the simulated
/// memory space. Used by stat(), fstat(), and lstat().
static void
- copyOutStatBuf(Port *memPort, Addr addr, struct stat *host)
+ copyOutStatBuf(TranslatingPort *memPort, Addr addr, struct stat *host)
{
TypedBufferArg<Linux::tgt_stat> tgt(addr);
// Same for stat64
static void
- copyOutStat64Buf(Port *memPort, Addr addr, struct stat64 *host)
+ copyOutStat64Buf(TranslatingPort *memPort, Addr addr, struct stat64 *host)
{
TypedBufferArg<Linux::tgt_stat64> tgt(addr);
strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
strcpy(name->machine, "alpha");
- name.copyOut(xc->cpu->memPort);
+ name.copyOut(xc->port);
return 0;
}
TypedBufferArg<uint64_t> fpcr(xc->getSyscallArg(1));
// I don't think this exactly matches the HW FPCR
*fpcr = 0;
- fpcr.copyOut(xc->cpu->memPort);
+ fpcr.copyOut(xc->port);
return 0;
}
case 14: { // SSI_IEEE_FP_CONTROL
TypedBufferArg<uint64_t> fpcr(xc->getSyscallArg(1));
// I don't think this exactly matches the HW FPCR
- fpcr.copyIn(xc->cpu->memPort);
+ fpcr.copyIn(xc->port);
DPRINTFR(SyscallVerbose, "osf_setsysinfo(SSI_IEEE_FP_CONTROL): "
" setting FPCR to 0x%x\n", *(uint64_t*)fpcr);
return 0;
#include "base/trace.hh"
#include "cpu/base.hh"
#include "cpu/exec_context.hh"
-#include "mem/functional/functional.hh"
+#include "mem/translating_port.hh"
#include "sim/fake_syscall.hh"
#include "sim/host.hh"
#include "sim/process.hh"
/// memory space. Used by stat(), fstat(), and lstat().
template <class T>
static void
- copyOutStatBuf(FunctionalMemory *mem, Addr addr, global_stat *host)
+ copyOutStatBuf(TranslatingPort *memPort, Addr addr, global_stat *host)
{
TypedBufferArg<T> tgt(addr);
tgt->st_blksize = host->st_blksize;
tgt->st_blocks = host->st_blocks;
- tgt.copyOut(mem);
+ tgt.copyOut(memPort);
}
/// Helper function to convert a host statfs buffer to a target statfs
/// memory space. Used by statfs() and fstatfs().
template <class T>
static void
- copyOutStatfsBuf(FunctionalMemory *mem, Addr addr, global_statfs *host)
+ copyOutStatfsBuf(TranslatingPort *memPort, Addr addr, global_statfs *host)
{
TypedBufferArg<T> tgt(addr);
tgt->f_ffree = host->f_ffree;
memcpy(&tgt->f_fsid, &host->f_fsid, sizeof(host->f_fsid));
- tgt.copyOut(mem);
+ tgt.copyOut(memPort);
}
class F64 {
public:
- static void copyOutStatBuf(FunctionalMemory *mem, Addr addr,
+ static void copyOutStatBuf(TranslatingPort *memPort, Addr addr,
global_stat *host)
{
- Tru64::copyOutStatBuf<Tru64::F64_stat>(mem, addr, host);
+ Tru64::copyOutStatBuf<Tru64::F64_stat>(memPort, addr, host);
}
- static void copyOutStatfsBuf(FunctionalMemory *mem, Addr addr,
+ static void copyOutStatfsBuf(TranslatingPort *memPort, Addr addr,
global_statfs *host)
{
- Tru64::copyOutStatfsBuf<Tru64::F64_statfs>(mem, addr, host);
+ Tru64::copyOutStatfsBuf<Tru64::F64_statfs>(memPort, addr, host);
}
};
class PreF64 {
public:
- static void copyOutStatBuf(FunctionalMemory *mem, Addr addr,
+ static void copyOutStatBuf(TranslatingPort *memPort, Addr addr,
global_stat *host)
{
- Tru64::copyOutStatBuf<Tru64::pre_F64_stat>(mem, addr, host);
+ Tru64::copyOutStatBuf<Tru64::pre_F64_stat>(memPort, addr, host);
}
- static void copyOutStatfsBuf(FunctionalMemory *mem, Addr addr,
+ static void copyOutStatfsBuf(TranslatingPort *memPort, Addr addr,
global_statfs *host)
{
- Tru64::copyOutStatfsBuf<Tru64::pre_F64_statfs>(mem, addr, host);
+ Tru64::copyOutStatfsBuf<Tru64::pre_F64_statfs>(memPort, addr, host);
}
};
/// the simulated memory space. Used by pre_F64_stat(),
/// pre_F64_fstat(), and pre_F64_lstat().
static void
- copyOutPreF64StatBuf(FunctionalMemory *mem, Addr addr, struct stat *host)
+ copyOutPreF64StatBuf(TranslatingPort *memPort, Addr addr, struct stat *host)
{
TypedBufferArg<Tru64::pre_F64_stat> tgt(addr);
tgt->st_blksize = host->st_blksize;
tgt->st_blocks = host->st_blocks;
- tgt.copyOut(mem);
+ tgt.copyOut(memPort);
}
strcpy(name->version, "732");
strcpy(name->machine, "alpha");
- name.copyOut(xc->mem);
+ name.copyOut(xc->port);
return 0;
}
case Tru64::GSI_MAX_CPU: {
TypedBufferArg<uint32_t> max_cpu(xc->getSyscallArg(1));
*max_cpu = process->numCpus();
- max_cpu.copyOut(xc->mem);
+ max_cpu.copyOut(xc->port);
return 1;
}
case Tru64::GSI_CPUS_IN_BOX: {
TypedBufferArg<uint32_t> cpus_in_box(xc->getSyscallArg(1));
*cpus_in_box = process->numCpus();
- cpus_in_box.copyOut(xc->mem);
+ cpus_in_box.copyOut(xc->port);
return 1;
}
case Tru64::GSI_PHYSMEM: {
TypedBufferArg<uint64_t> physmem(xc->getSyscallArg(1));
*physmem = 1024 * 1024; // physical memory in KB
- physmem.copyOut(xc->mem);
+ physmem.copyOut(xc->port);
return 1;
}
infop->cpu_ex_binding = 0;
infop->mhz = 667;
- infop.copyOut(xc->mem);
+ infop.copyOut(xc->port);
return 1;
}
case Tru64::GSI_PROC_TYPE: {
TypedBufferArg<uint64_t> proc_type(xc->getSyscallArg(1));
*proc_type = 11;
- proc_type.copyOut(xc->mem);
+ proc_type.copyOut(xc->port);
return 1;
}
strncpy((char *)bufArg.bufferPtr(),
"COMPAQ Professional Workstation XP1000",
nbytes);
- bufArg.copyOut(xc->mem);
+ bufArg.copyOut(xc->port);
return 1;
}
case Tru64::GSI_CLK_TCK: {
TypedBufferArg<uint64_t> clk_hz(xc->getSyscallArg(1));
*clk_hz = 1024;
- clk_hz.copyOut(xc->mem);
+ clk_hz.copyOut(xc->port);
return 1;
}
// just pass basep through uninterpreted.
TypedBufferArg<int64_t> basep(tgt_basep);
- basep.copyIn(xc->mem);
+ basep.copyIn(xc->port);
long host_basep = (off_t)*basep;
int host_result = getdirentries(fd, host_buf, tgt_nbytes, &host_basep);
tgt_dp->d_reclen = tgt_bufsize;
tgt_dp->d_namlen = namelen;
strcpy(tgt_dp->d_name, host_dp->d_name);
- tgt_dp.copyOut(xc->mem);
+ tgt_dp.copyOut(xc->port);
tgt_buf_ptr += tgt_bufsize;
host_buf_ptr += host_dp->d_reclen;
delete [] host_buf;
*basep = host_basep;
- basep.copyOut(xc->mem);
+ basep.copyOut(xc->port);
return tgt_buf_ptr - tgt_buf;
#endif
RegFile *regs = &xc->regs;
TypedBufferArg<Tru64::sigcontext> sc(xc->getSyscallArg(0));
- sc.copyIn(xc->mem);
+ sc.copyIn(xc->port);
// Restore state from sigcontext structure.
// Note that we'll advance PC <- NPC before the end of the cycle,
elp->si_phz = clk_hz;
elp->si_boottime = seconds_since_epoch; // seconds since epoch?
elp->si_max_procs = process->numCpus();
- elp.copyOut(xc->mem);
+ elp.copyOut(xc->port);
return 0;
}
{
TypedBufferArg<Tru64::vm_stack> argp(xc->getSyscallArg(0));
- argp.copyIn(xc->mem);
+ argp.copyIn(xc->port);
// if the user chose an address, just let them have it. Otherwise
// pick one for them.
argp->address = process->next_thread_stack_base;
int stack_size = (argp->rsize + argp->ysize + argp->gsize);
process->next_thread_stack_base -= stack_size;
- argp.copyOut(xc->mem);
+ argp.copyOut(xc->port);
}
return 0;
TypedBufferArg<Tru64::nxm_task_attr> attrp(xc->getSyscallArg(0));
TypedBufferArg<Addr> configptr_ptr(xc->getSyscallArg(1));
- attrp.copyIn(xc->mem);
+ attrp.copyIn(xc->port);
if (attrp->nxm_version != NXM_LIB_VERSION) {
cerr << "nxm_task_init: thread library version mismatch! "
config->nxm_slot_state = slot_state_addr;
config->nxm_rad[0] = rad_state_addr;
- config.copyOut(xc->mem);
+ config.copyOut(xc->port);
// initialize the slot_state array and copy it out
TypedBufferArg<Tru64::nxm_slot_state_t> slot_state(slot_state_addr,
(i == 0) ? Tru64::NXM_SLOT_BOUND : Tru64::NXM_SLOT_AVAIL;
}
- slot_state.copyOut(xc->mem);
+ slot_state.copyOut(xc->port);
// same for the per-RAD "shared" struct. Note that we need to
// allocate extra bytes for the per-VP array which is embedded at
}
}
- rad_state.copyOut(xc->mem);
+ rad_state.copyOut(xc->port);
//
// copy pointer to shared config area out to user
//
*configptr_ptr = config_addr;
- configptr_ptr.copyOut(xc->mem);
+ configptr_ptr.copyOut(xc->port);
// Register this as a valid address range with the process
process->nxm_start = base_addr;
int thread_index = xc->getSyscallArg(2);
// get attribute args
- attrp.copyIn(xc->mem);
+ attrp.copyIn(xc->port);
if (attrp->version != NXM_LIB_VERSION) {
cerr << "nxm_thread_create: thread library version mismatch! "
TypedBufferArg<Tru64::nxm_shared> rad_state(0x14000,
rad_state_size);
- rad_state.copyIn(xc->mem);
+ rad_state.copyIn(xc->port);
uint64_t uniq_val = attrp->pthid - rad_state->nxm_uniq_offset;
// This is supposed to be a port number. Make something up.
*kidp = 99;
- kidp.copyOut(xc->mem);
+ kidp.copyOut(xc->port);
return 0;
} else if (attrp->type == Tru64::NXM_TYPE_VP) {
ssp->nxm_u.pth_id = attrp->pthid;
ssp->nxm_u.nxm_active = uniq_val | 1;
- rad_state.copyOut(xc->mem);
+ rad_state.copyOut(xc->port);
Addr slot_state_addr = 0x12000 + sizeof(Tru64::nxm_config_info);
int slot_state_size =
slot_state(slot_state_addr,
slot_state_size);
- slot_state.copyIn(xc->mem);
+ slot_state.copyIn(xc->port);
if (slot_state[thread_index] != Tru64::NXM_SLOT_AVAIL) {
cerr << "nxm_thread_createFunc: requested VP slot "
slot_state[thread_index] = Tru64::NXM_SLOT_BOUND;
- slot_state.copyOut(xc->mem);
+ slot_state.copyOut(xc->port);
// Find a free simulator execution context.
for (int i = 0; i < process->numCpus(); ++i) {
// and get away with just sticking the thread index
// here.
*kidp = thread_index;
- kidp.copyOut(xc->mem);
+ kidp.copyOut(xc->port);
return 0;
}
{
TypedBufferArg<uint64_t> lockp(uaddr);
- lockp.copyIn(xc->mem);
+ lockp.copyIn(xc->port);
if (*lockp == 0) {
// lock is free: grab it
*lockp = 1;
- lockp.copyOut(xc->mem);
+ lockp.copyOut(xc->port);
} else {
// lock is busy: disable until free
process->waitList.push_back(Process::WaitRec(uaddr, xc));
{
TypedBufferArg<uint64_t> lockp(uaddr);
- lockp.copyIn(xc->mem);
+ lockp.copyIn(xc->port);
assert(*lockp != 0);
// Check for a process waiting on the lock.
// clear lock field if no waiting context is taking over the lock
if (num_waiting == 0) {
*lockp = 0;
- lockp.copyOut(xc->mem);
+ lockp.copyOut(xc->port);
}
}
Addr uaddr = xc->getSyscallArg(0);
TypedBufferArg<uint64_t> lockp(uaddr);
- lockp.copyIn(xc->mem);
+ lockp.copyIn(xc->port);
if (*lockp == 0) {
// lock is free: grab it
*lockp = 1;
- lockp.copyOut(xc->mem);
+ lockp.copyOut(xc->port);
return 0;
} else {
return 1;
TypedBufferArg<uint64_t> lockp(lock_addr);
// user is supposed to acquire lock before entering
- lockp.copyIn(xc->mem);
+ lockp.copyIn(xc->port);
assert(*lockp != 0);
m5_unlock_mutex(lock_addr, process, xc);
#include "base/output.hh"
#include "cpu/profile.hh"
#include "kern/kernel_stats.hh"
+#include "mem/translating_port.hh"
#include "sim/serialize.hh"
#include "sim/sim_exit.hh"
#include "sim/system.hh"
asid(_asid),
func_exe_inst(0), storeCondFailures(0)
{
+ port = new TranslatingPort(cpu->memPort, process->pTable);
memset(®s, 0, sizeof(RegFile));
}
#endif
#include "sim/host.hh"
#include "sim/serialize.hh"
#include "targetarch/byte_swap.hh"
+#include "mem/translating_port.hh"
-class Memory;
class BaseCPU;
#if FULL_SYSTEM
int cpu_id;
System *system;
+
+ /// Port that syscalls can use to access memory (provides translation step).
+ TranslatingPort *port;
// Memory *mem;
#if FULL_SYSTEM
--- /dev/null
+/*
+ * Copyright (c) 2001-2005 The Regents of The University of Michigan
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string>
+#include "mem/port.hh"
+#include "mem/translating_port.hh"
+#include "mem/page_table.hh"
+
+TranslatingPort::TranslatingPort(Port *_port, PageTable *p_table)
+ : port(_port), pTable(p_table)
+{ }
+
+TranslatingPort::~TranslatingPort()
+{ }
+
+Fault
+TranslatingPort::readBlobFunctional(Addr addr, uint8_t *p, int size)
+{
+ Addr paddr;
+
+ //@todo Break up things larger than a page size
+ pTable->page_check(addr, size);
+
+
+ if (!pTable->translate(addr,paddr))
+ return Machine_Check_Fault;
+
+ port->readBlobFunctional(paddr, p, size);
+ return No_Fault;
+}
+
+Fault
+TranslatingPort::writeBlobFunctional(Addr addr, const uint8_t *p, int size)
+{
+ Addr paddr;
+
+ //@todo Break up things larger than a page size
+ pTable->page_check(addr, size);
+
+ if (!pTable->translate(addr,paddr))
+ return Machine_Check_Fault;
+
+ port->writeBlobFunctional(paddr, p, size);
+ return No_Fault;
+}
+
+Fault
+TranslatingPort::memsetBlobFunctional(Addr addr, uint8_t val, int size)
+{
+ Addr paddr;
+
+ //@todo Break up things larger than a page size
+ pTable->page_check(addr, size);
+
+ if (!pTable->translate(addr,paddr))
+ return Machine_Check_Fault;
+
+ port->memsetBlobFunctional(paddr, val, size);
+ return No_Fault;
+}
+
+Fault
+TranslatingPort::writeStringFunctional(Addr addr, const char *str)
+{
+ //@todo Break up things larger than a page size
+ //pTable->page_check(addr, size);
+ //Need to check string length???
+
+ Addr paddr;
+
+ if (!pTable->translate(addr,paddr))
+ return Machine_Check_Fault;
+
+ port->writeStringFunctional(paddr, str);
+ return No_Fault;
+}
+
+Fault
+TranslatingPort::readStringFunctional(std::string &str, Addr addr)
+{
+ //@todo Break up things larger than a page size
+ //pTable->page_check(addr, size);
+ //Need to check string length???
+
+ Addr paddr;
+
+ if (!pTable->translate(addr,paddr))
+ return Machine_Check_Fault;
+
+ //@todo Break this up into readBlobs
+ port->readStringFunctional(str, paddr);
+ return No_Fault;
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2001-2005 The Regents of The University of Michigan
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __MEM_TRANSLATING_PROT_HH__
+#define __MEM_TRANSLATING_PROT_HH__
+
+#include "mem/memory.hh"
+
+class Port;
+class PageTable;
+
+class TranslatingPort
+{
+ private:
+ Port *port;
+ PageTable *pTable;
+
+ TranslatingPort(const TranslatingPort &specmem);
+ const TranslatingPort &operator=(const TranslatingPort &specmem);
+
+ public:
+ TranslatingPort(Port *_port, PageTable *p_table);
+ virtual ~TranslatingPort();
+
+ public:
+ Fault readBlobFunctional(Addr addr, uint8_t *p, int size);
+ Fault writeBlobFunctional(Addr addr, const uint8_t *p, int size);
+ Fault memsetBlobFunctional(Addr addr, uint8_t val, int size);
+ Fault writeStringFunctional(Addr addr, const char *str);
+ Fault readStringFunctional(std::string &str, Addr addr);
+
+};
+
+#endif
if (execContexts.empty())
fatal("Process %s is not associated with any CPUs!\n", name());
- initVirtMem = new ProxyMemory<Memory>(system->physmem, pTable);
+ initVirtMem = new ProxyMemory(system->physmem, pTable);
// first exec context for this process... initialize & enable
ExecContext *xc = execContexts[0];
{
for (int i = 0; i < strings.size(); ++i) {
func->prot_write(array_ptr, (uint8_t*)&data_ptr, sizeof(Addr));
- func->writeString(data_ptr, strings[i].c_str());
+ func->writeStringFunctional(data_ptr, strings[i].c_str());
array_ptr += sizeof(Addr);
data_ptr += strings[i].size() + 1;
}
int bytes_read = read(fd, bufArg.bufferPtr(), nbytes);
if (bytes_read != -1)
- bufArg.copyOut(xc->cpu->memPort);
+ bufArg.copyOut(xc->port);
return bytes_read;
}
int nbytes = xc->getSyscallArg(2);
BufferArg bufArg(xc->getSyscallArg(1), nbytes);
- bufArg.copyIn(xc->cpu->memPort);
+ bufArg.copyIn(xc->port);
int bytes_written = write(fd, bufArg.bufferPtr(), nbytes);
strncpy((char *)name.bufferPtr(), hostname, name_len);
- name.copyOut(xc->cpu->memPort);
+ name.copyOut(xc->port);
return 0;
}
{
string path;
- if (xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
+ if (xc->port->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
return (TheISA::IntReg)-EFAULT;
int result = unlink(path.c_str());
{
string old_name;
- if (xc->cpu->memPort->readStringFunctional(old_name, xc->getSyscallArg(0)) != No_Fault)
+ if (xc->port->readStringFunctional(old_name, xc->getSyscallArg(0)) != No_Fault)
return -EFAULT;
string new_name;
- if (xc->cpu->memPort->readStringFunctional(new_name, xc->getSyscallArg(1)) != No_Fault)
+ if (xc->port->readStringFunctional(new_name, xc->getSyscallArg(1)) != No_Fault)
return -EFAULT;
int64_t result = rename(old_name.c_str(), new_name.c_str());
{
string path;
- if (xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
+ if (xc->port->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
return -EFAULT;
off_t length = xc->getSyscallArg(1);
{
string path;
- if (xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
+ if (xc->port->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
return -EFAULT;
/* XXX endianess */
#include <sys/uio.h>
#include "base/intmath.hh" // for RoundUp
-#include "mem/port.hh"
+#include "mem/translating_port.hh"
#include "targetarch/isa_traits.hh" // for Addr
#include "base/trace.hh"
//
// copy data into simulator space (read from target memory)
//
- virtual bool copyIn(Port *memport)
+ virtual bool copyIn(TranslatingPort *memport)
{
memport->readBlobFunctional(addr, bufPtr, size);
return true; // no EFAULT detection for now
//
// copy data out of simulator space (write to target memory)
//
- virtual bool copyOut(Port *memport)
+ virtual bool copyOut(TranslatingPort *memport)
{
memport->writeBlobFunctional(addr, bufPtr, size);
return true; // no EFAULT detection for now
{
std::string path;
-/* if (xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
+ if (xc->port->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
return -EFAULT;
-*/
- //@todo Fix fault condition
- xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0));
if (path == "/dev/sysdev0") {
// This is a memory-mapped high-resolution timer device on Alpha.
{
std::string path;
-/*
- if (xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
+ if (xc->port->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
return -EFAULT;
-*/
- xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0));
uint32_t mode = xc->getSyscallArg(1);
mode_t hostMode = 0;
{
std::string path;
-/*
- if (xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
- return -EFAULT; */
-
- xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0));
+ if (xc->port->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
+ return -EFAULT;
struct stat hostBuf;
int result = stat(path.c_str(), &hostBuf);
if (result < 0)
return errno;
- OS::copyOutStatBuf(xc->cpu->memPort, xc->getSyscallArg(1), &hostBuf);
+ OS::copyOutStatBuf(xc->port, xc->getSyscallArg(1), &hostBuf);
return 0;
}
if (result < 0)
return errno;
- OS::copyOutStat64Buf(xc->cpu->memPort, xc->getSyscallArg(1), &hostBuf);
+ OS::copyOutStat64Buf(xc->port, xc->getSyscallArg(1), &hostBuf);
return 0;
}
{
std::string path;
-/* if (xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
- return -EFAULT;*/
-
- xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0));
+ if (xc->port->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
+ return -EFAULT;
struct stat hostBuf;
int result = lstat(path.c_str(), &hostBuf);
if (result < 0)
return -errno;
- OS::copyOutStatBuf(xc->cpu->memPort, xc->getSyscallArg(1), &hostBuf);
+ OS::copyOutStatBuf(xc->port, xc->getSyscallArg(1), &hostBuf);
return 0;
}
{
std::string path;
-/* if (xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
- return -EFAULT; */
-
- xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0));
+ if (xc->port->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
+ return -EFAULT;
struct stat64 hostBuf;
int result = lstat64(path.c_str(), &hostBuf);
if (result < 0)
return -errno;
- OS::copyOutStat64Buf(xc->cpu->memPort, xc->getSyscallArg(1), &hostBuf);
+ OS::copyOutStat64Buf(xc->port, xc->getSyscallArg(1), &hostBuf);
return 0;
}
if (result < 0)
return -errno;
- OS::copyOutStatBuf(xc->cpu->memPort, xc->getSyscallArg(1), &hostBuf);
+ OS::copyOutStatBuf(xc->port, xc->getSyscallArg(1), &hostBuf);
return 0;
}
{
std::string path;
-/* if (xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
- return -EFAULT;*/
-
- xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0));
+ if (xc->port->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
+ return -EFAULT;
struct statfs hostBuf;
int result = statfs(path.c_str(), &hostBuf);
if (result < 0)
return errno;
- OS::copyOutStatfsBuf(xc->cpu->memPort, xc->getSyscallArg(1), &hostBuf);
+ OS::copyOutStatfsBuf(xc->port, xc->getSyscallArg(1), &hostBuf);
return 0;
}
if (result < 0)
return errno;
- OS::copyOutStatfsBuf(xc->cpu->memPort, xc->getSyscallArg(1), &hostBuf);
+ OS::copyOutStatfsBuf(xc->port, xc->getSyscallArg(1), &hostBuf);
return 0;
}
for (int i = 0; i < count; ++i)
{
typename OS::tgt_iovec tiov;
- xc->cpu->memPort->readBlobFunctional(tiov_base + i*sizeof(typename OS::tgt_iovec),
+ xc->port->readBlobFunctional(tiov_base + i*sizeof(typename OS::tgt_iovec),(uint8_t*)
&tiov, sizeof(typename OS::tgt_iovec));
hiov[i].iov_len = tiov.iov_len;
hiov[i].iov_base = new char [hiov[i].iov_len];
- xc->cpu->memPort->readBlobFunctional(tiov.iov_base,
- hiov[i].iov_base, hiov[i].iov_len);
+ xc->port->readBlobFunctional(tiov.iov_base,
+ (uint8_t *)hiov[i].iov_base, hiov[i].iov_len);
}
int result = writev(process->sim_fd(fd), hiov, count);
break;
}
- rlp.copyOut(xc->cpu->memPort);
+ rlp.copyOut(xc->port);
return 0;
}
getElapsedTime(tp->tv_sec, tp->tv_usec);
tp->tv_sec += seconds_since_epoch;
- tp.copyOut(xc->cpu->memPort);
+ tp.copyOut(xc->port);
return 0;
}
{
std::string path;
-/* if (xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
- return -EFAULT;*/
-
- xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0));
+ if (xc->port->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
+ return -EFAULT;
TypedBufferArg<typename OS::timeval [2]> tp(xc->getSyscallArg(1));
- tp.copyIn(xc->cpu->memPort);
+ tp.copyIn(xc->port);
struct timeval hostTimeval[2];
for (int i = 0; i < 2; ++i)
rup->ru_nvcsw = 0;
rup->ru_nivcsw = 0;
- rup.copyOut(xc->cpu->memPort);
+ rup.copyOut(xc->port);
return 0;
}