}
std::vector<uint64_t> argv(call->argc64 + 1);
- PortProxy &proxy = tc->getPhysProxy();
+ PortProxy &proxy = physProxy(tc);
ByteOrder endian = ArmISA::byteOrder(tc);
DPRINTF(Semihosting, "Semihosting call64: %s(0x%x)\n", call->name, param);
}
std::vector<uint64_t> argv(call->argc32 + 1);
- PortProxy &proxy = tc->getPhysProxy();
+ PortProxy &proxy = physProxy(tc);
ByteOrder endian = ArmISA::byteOrder(tc);
DPRINTF(Semihosting, "Semihosting call32: %s(0x%x)\n", call->name, param);
files[i] = FileBase::create(*this, cp, csprintf("file%i", i));
}
+PortProxy &
+ArmSemihosting::physProxy(ThreadContext *tc)
+{
+ if (ArmISA::inSecureState(tc)) {
+ if (!physProxyS) {
+ System *sys = tc->getSystemPtr();
+ physProxyS.reset(new SecurePortProxy(
+ sys->getSystemPort(),
+ sys->cacheLineSize()));
+ }
+ return *physProxyS;
+ } else {
+ return tc->getPhysProxy();
+ }
+}
+
+
std::string
ArmSemihosting::readString(ThreadContext *tc, Addr ptr, size_t len)
{
std::vector<char> buf(len + 1);
buf[len] = '\0';
- tc->getPhysProxy().readBlob(ptr, (uint8_t *)buf.data(), len);
+ physProxy(tc).readBlob(ptr, (uint8_t *)buf.data(), len);
return std::string(buf.data());
}
ArmSemihosting::callWriteC(ThreadContext *tc, bool aarch64,
std::vector<uint64_t> &argv)
{
- const char c = tc->getPhysProxy().read<char>(argv[0]);
+ const char c = physProxy(tc).read<char>(argv[0]);
DPRINTF(Semihosting, "Semihosting SYS_WRITEC('%c')\n", c);
std::cout.put(c);
std::vector<uint64_t> &argv)
{
DPRINTF(Semihosting, "Semihosting SYS_WRITE0(...)\n");
- PortProxy &proxy = tc->getPhysProxy();
+ PortProxy &proxy = physProxy(tc);
for (Addr addr = (Addr)argv[0]; ; ++addr) {
char data = proxy.read<char>(addr);
if (data == 0)
return RetErrno(argv[3], EBADF);
std::vector<uint8_t> buffer(argv[3]);
- tc->getPhysProxy().readBlob(argv[2], buffer.data(), buffer.size());
+ physProxy(tc).readBlob(argv[2], buffer.data(), buffer.size());
int64_t ret = files[argv[1]]->write(buffer.data(), buffer.size());
if (ret < 0) {
} else {
panic_if(ret > buffer.size(), "Read longer than buffer size.");
- tc->getPhysProxy().writeBlob(argv[2], buffer.data(), ret);
+ physProxy(tc).writeBlob(argv[2], buffer.data(), ret);
// Return the number of bytes not written
return retOK(argv[3] - ret);
if (path_len >= max_len)
return retError(ENOSPC);
- tc->getPhysProxy().writeBlob(
+ physProxy(tc).writeBlob(
guest_buf, (const uint8_t *)path, path_len + 1);
return retOK(0);
}
std::vector<uint64_t> &argv)
{
if (cmdLine.size() + 1 < argv[2]) {
- PortProxy &proxy = tc->getPhysProxy();
+ PortProxy &proxy = physProxy(tc);
ByteOrder endian = ArmISA::byteOrder(tc);
proxy.writeBlob(
(Addr)argv[1],
heap_base, heap_limit, stack_base, stack_limit);
Addr base = argv[1];
- PortProxy &proxy = tc->getPhysProxy();
+ PortProxy &proxy = physProxy(tc);
ByteOrder endian = ArmISA::byteOrder(tc);
if (aarch64) {
proxy.writeHtoG<uint64_t>(base + 0 * 8, heap_base, endian);
ArmSemihosting::callElapsed(ThreadContext *tc, bool aarch64,
std::vector<uint64_t> &argv)
{
- PortProxy &proxy = tc->getPhysProxy();
+ PortProxy &proxy = physProxy(tc);
ByteOrder endian = ArmISA::byteOrder(tc);
const uint64_t tick = semiTick(curTick());