}
if (sec->fileImage) {
- memPort->writeBlobFunctional(addr, sec->fileImage, sec->size, true);
+ memPort->writeBlob(addr, sec->fileImage, sec->size, true);
}
else {
// no image: must be bss
- memPort->memsetBlobFunctional(addr, 0, sec->size, true);
+ memPort->memsetBlob(addr, 0, sec->size, true);
}
}
return true;
}
void
-Port::writeBlobFunctional(Addr addr, uint8_t *p, int size)
+Port::writeBlob(Addr addr, uint8_t *p, int size)
{
blobHelper(addr, p, size, Write);
}
void
-Port::readBlobFunctional(Addr addr, uint8_t *p, int size)
+Port::readBlob(Addr addr, uint8_t *p, int size)
{
blobHelper(addr, p, size, Read);
}
void
-Port::memsetBlobFunctional(Addr addr, uint8_t val, int size)
+Port::memsetBlob(Addr addr, uint8_t val, int size)
{
// quick and dirty...
uint8_t *buf = new uint8_t[size];
void getPeerAddressRanges(AddrRangeList &range_list, bool &owner)
{ peer->getDeviceAddressRanges(range_list, owner); }
- // Do we need similar wrappers for sendAtomic()? If not, should
- // we drop the "Functional" from the names?
-
/** This function is a wrapper around sendFunctional()
that breaks a larger, arbitrarily aligned access into
appropriate chunks. The default implementation can use
getBlockSize() to determine the block size and go from there.
*/
- void readBlobFunctional(Addr addr, uint8_t *p, int size);
+ void readBlob(Addr addr, uint8_t *p, int size);
/** This function is a wrapper around sendFunctional()
that breaks a larger, arbitrarily aligned access into
appropriate chunks. The default implementation can use
getBlockSize() to determine the block size and go from there.
*/
- void writeBlobFunctional(Addr addr, uint8_t *p, int size);
+ void writeBlob(Addr addr, uint8_t *p, int size);
/** Fill size bytes starting at addr with byte value val. This
should not need to be virtual, since it can be implemented in
- terms of writeBlobFunctional(). However, it shouldn't be
+ terms of writeBlob(). However, it shouldn't be
performance-critical either, so it could be if we wanted to.
*/
- void memsetBlobFunctional(Addr addr, uint8_t val, int size);
+ void memsetBlob(Addr addr, uint8_t val, int size);
private:
{ }
bool
-TranslatingPort::tryReadBlobFunctional(Addr addr, uint8_t *p, int size)
+TranslatingPort::tryReadBlob(Addr addr, uint8_t *p, int size)
{
Addr paddr;
int prevSize = 0;
if (!pTable->translate(gen.addr(),paddr))
return false;
- port->readBlobFunctional(paddr, p + prevSize, gen.size());
+ port->readBlob(paddr, p + prevSize, gen.size());
prevSize += gen.size();
}
}
void
-TranslatingPort::readBlobFunctional(Addr addr, uint8_t *p, int size)
+TranslatingPort::readBlob(Addr addr, uint8_t *p, int size)
{
- if (!tryReadBlobFunctional(addr, p, size))
- fatal("readBlobFunctional(0x%x, ...) failed", addr);
+ if (!tryReadBlob(addr, p, size))
+ fatal("readBlob(0x%x, ...) failed", addr);
}
bool
-TranslatingPort::tryWriteBlobFunctional(Addr addr, uint8_t *p, int size,
- bool alloc)
+TranslatingPort::tryWriteBlob(Addr addr, uint8_t *p, int size, bool alloc)
{
Addr paddr;
}
}
- port->writeBlobFunctional(paddr, p + prevSize, gen.size());
+ port->writeBlob(paddr, p + prevSize, gen.size());
prevSize += gen.size();
}
void
-TranslatingPort::writeBlobFunctional(Addr addr, uint8_t *p, int size,
- bool alloc)
+TranslatingPort::writeBlob(Addr addr, uint8_t *p, int size, bool alloc)
{
- if (!tryWriteBlobFunctional(addr, p, size, alloc))
- fatal("writeBlobFunctional(0x%x, ...) failed", addr);
+ if (!tryWriteBlob(addr, p, size, alloc))
+ fatal("writeBlob(0x%x, ...) failed", addr);
}
bool
-TranslatingPort::tryMemsetBlobFunctional(Addr addr, uint8_t val, int size,
- bool alloc)
+TranslatingPort::tryMemsetBlob(Addr addr, uint8_t val, int size, bool alloc)
{
Addr paddr;
}
}
- port->memsetBlobFunctional(paddr, val, gen.size());
+ port->memsetBlob(paddr, val, gen.size());
}
return true;
}
void
-TranslatingPort::memsetBlobFunctional(Addr addr, uint8_t val, int size,
- bool alloc)
+TranslatingPort::memsetBlob(Addr addr, uint8_t val, int size, bool alloc)
{
- if (!tryMemsetBlobFunctional(addr, val, size, alloc))
- fatal("memsetBlobFunctional(0x%x, ...) failed", addr);
+ if (!tryMemsetBlob(addr, val, size, alloc))
+ fatal("memsetBlob(0x%x, ...) failed", addr);
}
bool
-TranslatingPort::tryWriteStringFunctional(Addr addr, const char *str)
+TranslatingPort::tryWriteString(Addr addr, const char *str)
{
Addr paddr,vaddr;
uint8_t c;
if (!pTable->translate(vaddr++,paddr))
return false;
- port->writeBlobFunctional(paddr, &c, 1);
+ port->writeBlob(paddr, &c, 1);
} while (c);
return true;
}
void
-TranslatingPort::writeStringFunctional(Addr addr, const char *str)
+TranslatingPort::writeString(Addr addr, const char *str)
{
- if (!tryWriteStringFunctional(addr, str))
- fatal("writeStringFunctional(0x%x, ...) failed", addr);
+ if (!tryWriteString(addr, str))
+ fatal("writeString(0x%x, ...) failed", addr);
}
bool
-TranslatingPort::tryReadStringFunctional(std::string &str, Addr addr)
+TranslatingPort::tryReadString(std::string &str, Addr addr)
{
Addr paddr,vaddr;
uint8_t c;
if (!pTable->translate(vaddr++,paddr))
return false;
- port->readBlobFunctional(paddr, &c, 1);
+ port->readBlob(paddr, &c, 1);
str += c;
} while (c);
}
void
-TranslatingPort::readStringFunctional(std::string &str, Addr addr)
+TranslatingPort::readString(std::string &str, Addr addr)
{
- if (!tryReadStringFunctional(str, addr))
- fatal("readStringFunctional(0x%x, ...) failed", addr);
+ if (!tryReadString(str, addr))
+ fatal("readString(0x%x, ...) failed", addr);
}
virtual ~TranslatingPort();
public:
- bool tryReadBlobFunctional(Addr addr, uint8_t *p, int size);
- bool tryWriteBlobFunctional(Addr addr, uint8_t *p, int size,
- bool alloc = false);
- bool tryMemsetBlobFunctional(Addr addr, uint8_t val, int size,
- bool alloc = false);
- bool tryWriteStringFunctional(Addr addr, const char *str);
- bool tryReadStringFunctional(std::string &str, Addr addr);
+ bool tryReadBlob(Addr addr, uint8_t *p, int size);
+ bool tryWriteBlob(Addr addr, uint8_t *p, int size, bool alloc = false);
+ bool tryMemsetBlob(Addr addr, uint8_t val, int size, bool alloc = false);
+ bool tryWriteString(Addr addr, const char *str);
+ bool tryReadString(std::string &str, Addr addr);
- void readBlobFunctional(Addr addr, uint8_t *p, int size);
- void writeBlobFunctional(Addr addr, uint8_t *p, int size,
- bool alloc = false);
- void memsetBlobFunctional(Addr addr, uint8_t val, int size,
- bool alloc = false);
- void writeStringFunctional(Addr addr, const char *str);
- void readStringFunctional(std::string &str, Addr addr);
+ void readBlob(Addr addr, uint8_t *p, int size);
+ void writeBlob(Addr addr, uint8_t *p, int size, bool alloc = false);
+ void memsetBlob(Addr addr, uint8_t val, int size, bool alloc = false);
+ void writeString(Addr addr, const char *str);
+ void readString(std::string &str, Addr addr);
};
#endif
Addr data_ptr_swap;
for (int i = 0; i < strings.size(); ++i) {
data_ptr_swap = htog(data_ptr);
- memPort->writeBlobFunctional(array_ptr, (uint8_t*)&data_ptr_swap, sizeof(Addr));
- memPort->writeStringFunctional(data_ptr, strings[i].c_str());
+ memPort->writeBlob(array_ptr, (uint8_t*)&data_ptr_swap, sizeof(Addr));
+ memPort->writeString(data_ptr, strings[i].c_str());
array_ptr += sizeof(Addr);
data_ptr += strings[i].size() + 1;
}
// add NULL terminator
data_ptr = 0;
- memPort->writeBlobFunctional(array_ptr, (uint8_t*)&data_ptr, sizeof(Addr));
+ memPort->writeBlob(array_ptr, (uint8_t*)&data_ptr, sizeof(Addr));
}
LiveProcess::LiveProcess(const string &nm, ObjectFile *_objFile,
// write contents to stack
uint64_t argc = argv.size();
argc = htog(argc);
- initVirtMem->writeBlobFunctional(stack_min, (uint8_t*)&argc, sizeof(uint64_t));
+ initVirtMem->writeBlob(stack_min, (uint8_t*)&argc, sizeof(uint64_t));
copyStringArray(argv, argv_array_base, arg_data_base, initVirtMem);
copyStringArray(envp, envp_array_base, env_data_base, initVirtMem);
{
string path;
- if (!xc->getMemPort()->tryReadStringFunctional(path, xc->getSyscallArg(0)))
+ if (!xc->getMemPort()->tryReadString(path, xc->getSyscallArg(0)))
return (TheISA::IntReg)-EFAULT;
int result = unlink(path.c_str());
{
string old_name;
- if (!xc->getMemPort()->tryReadStringFunctional(old_name, xc->getSyscallArg(0)))
+ if (!xc->getMemPort()->tryReadString(old_name, xc->getSyscallArg(0)))
return -EFAULT;
string new_name;
- if (!xc->getMemPort()->tryReadStringFunctional(new_name, xc->getSyscallArg(1)))
+ if (!xc->getMemPort()->tryReadString(new_name, xc->getSyscallArg(1)))
return -EFAULT;
int64_t result = rename(old_name.c_str(), new_name.c_str());
{
string path;
- if (!xc->getMemPort()->tryReadStringFunctional(path, xc->getSyscallArg(0)))
+ if (!xc->getMemPort()->tryReadString(path, xc->getSyscallArg(0)))
return -EFAULT;
off_t length = xc->getSyscallArg(1);
{
string path;
- if (!xc->getMemPort()->tryReadStringFunctional(path, xc->getSyscallArg(0)))
+ if (!xc->getMemPort()->tryReadString(path, xc->getSyscallArg(0)))
return -EFAULT;
/* XXX endianess */
//
virtual bool copyIn(TranslatingPort *memport)
{
- memport->readBlobFunctional(addr, bufPtr, size);
+ memport->readBlob(addr, bufPtr, size);
return true; // no EFAULT detection for now
}
//
virtual bool copyOut(TranslatingPort *memport)
{
- memport->writeBlobFunctional(addr, bufPtr, size);
+ memport->writeBlob(addr, bufPtr, size);
return true; // no EFAULT detection for now
}
{
std::string path;
- if (!xc->getMemPort()->tryReadStringFunctional(path, xc->getSyscallArg(0)))
+ if (!xc->getMemPort()->tryReadString(path, xc->getSyscallArg(0)))
return -EFAULT;
if (path == "/dev/sysdev0") {
{
std::string path;
- if (!xc->getMemPort()->tryReadStringFunctional(path, xc->getSyscallArg(0)))
+ if (!xc->getMemPort()->tryReadString(path, xc->getSyscallArg(0)))
return -EFAULT;
uint32_t mode = xc->getSyscallArg(1);
{
std::string path;
- if (!xc->getMemPort()->tryReadStringFunctional(path, xc->getSyscallArg(0)))
+ if (!xc->getMemPort()->tryReadString(path, xc->getSyscallArg(0)))
return -EFAULT;
struct stat hostBuf;
{
std::string path;
- if (!xc->getMemPort()->tryReadStringFunctional(path, xc->getSyscallArg(0)))
+ if (!xc->getMemPort()->tryReadString(path, xc->getSyscallArg(0)))
return -EFAULT;
struct stat hostBuf;
{
std::string path;
- if (!xc->getMemPort()->tryReadStringFunctional(path, xc->getSyscallArg(0)))
+ if (!xc->getMemPort()->tryReadString(path, xc->getSyscallArg(0)))
return -EFAULT;
#if BSD_HOST
{
std::string path;
- if (!xc->getMemPort()->tryReadStringFunctional(path, xc->getSyscallArg(0)))
+ if (!xc->getMemPort()->tryReadString(path, xc->getSyscallArg(0)))
return -EFAULT;
struct statfs hostBuf;
return -EBADF;
}
+ TranslatingPort *p = xc->getMemPort();
uint64_t tiov_base = xc->getSyscallArg(1);
size_t count = xc->getSyscallArg(2);
struct iovec hiov[count];
for (int i = 0; i < count; ++i)
{
typename OS::tgt_iovec tiov;
- xc->getMemPort()->readBlobFunctional(tiov_base + i*sizeof(typename OS::tgt_iovec),(uint8_t*)
- &tiov, sizeof(typename OS::tgt_iovec));
+
+ p->readBlob(tiov_base + i*sizeof(typename OS::tgt_iovec),
+ (uint8_t*)&tiov, sizeof(typename OS::tgt_iovec));
hiov[i].iov_len = gtoh(tiov.iov_len);
hiov[i].iov_base = new char [hiov[i].iov_len];
- xc->getMemPort()->readBlobFunctional(gtoh(tiov.iov_base),
- (uint8_t *)hiov[i].iov_base, hiov[i].iov_len);
+ p->readBlob(gtoh(tiov.iov_base), (uint8_t *)hiov[i].iov_base,
+ hiov[i].iov_len);
}
int result = writev(process->sim_fd(fd), hiov, count);
{
std::string path;
- if (!xc->getMemPort()->tryReadStringFunctional(path, xc->getSyscallArg(0)))
+ if (!xc->getMemPort()->tryReadString(path, xc->getSyscallArg(0)))
return -EFAULT;
TypedBufferArg<typename OS::timeval [2]> tp(xc->getSyscallArg(1));