summaryrefslogtreecommitdiff
path: root/mem
diff options
context:
space:
mode:
Diffstat (limited to 'mem')
-rw-r--r--mem/physical.cc2
-rw-r--r--mem/port.cc9
-rw-r--r--mem/translating_port.cc20
-rw-r--r--mem/translating_port.hh3
4 files changed, 27 insertions, 7 deletions
diff --git a/mem/physical.cc b/mem/physical.cc
index fea4b6ec5..69544c8fe 100644
--- a/mem/physical.cc
+++ b/mem/physical.cc
@@ -174,6 +174,8 @@ PhysicalMemory::doFunctionalAccess(Packet &pkt)
default:
panic("unimplemented");
}
+
+ pkt.result = Success;
}
Port *
diff --git a/mem/port.cc b/mem/port.cc
index 8c4b3810c..e080f8b81 100644
--- a/mem/port.cc
+++ b/mem/port.cc
@@ -63,3 +63,12 @@ Port::readBlobFunctional(Addr addr, uint8_t *p, int size)
blobHelper(addr, p, size, Read);
}
+void
+Port::memsetBlobFunctional(Addr addr, uint8_t val, int size)
+{
+ // quick and dirty...
+ uint8_t *buf = new uint8_t[size];
+
+ memset(buf, val, size);
+ blobHelper(addr, buf, size, Write);
+}
diff --git a/mem/translating_port.cc b/mem/translating_port.cc
index e385a74b6..f4f2ca737 100644
--- a/mem/translating_port.cc
+++ b/mem/translating_port.cc
@@ -83,23 +83,31 @@ TranslatingPort::writeBlobFunctional(Addr addr, uint8_t *p, int size,
return No_Fault;
}
-/*
+
Fault
-TranslatingPort::memsetBlobFunctional(Addr addr, uint8_t val, int size)
+TranslatingPort::memsetBlobFunctional(Addr addr, uint8_t val, int size,
+ bool alloc)
{
Addr paddr;
for (ChunkGenerator gen(addr, size, VMPageSize); !gen.done(); gen.next()) {
- if (!pTable->translate(gen.addr(),paddr))
- return Machine_Check_Fault;
+ if (!pTable->translate(gen.addr(), paddr)) {
+ if (alloc) {
+ pTable->allocate(roundDown(gen.addr(), VMPageSize),
+ VMPageSize);
+ pTable->translate(gen.addr(), paddr);
+ } else {
+ return Machine_Check_Fault;
+ }
+ }
- port->memsetBlobFunctional(paddr, val, gen.size());
+ port->memsetBlobFunctional(paddr, val, gen.size());
}
return No_Fault;
}
-*/
+
Fault
TranslatingPort::writeStringFunctional(Addr addr, const char *str)
diff --git a/mem/translating_port.hh b/mem/translating_port.hh
index 3d77b2c2b..1a334c103 100644
--- a/mem/translating_port.hh
+++ b/mem/translating_port.hh
@@ -51,7 +51,8 @@ class TranslatingPort
Fault readBlobFunctional(Addr addr, uint8_t *p, int size);
Fault writeBlobFunctional(Addr addr, uint8_t *p, int size,
bool alloc = false);
- // Fault memsetBlobFunctional(Addr addr, uint8_t val, int size);
+ Fault memsetBlobFunctional(Addr addr, uint8_t val, int size,
+ bool alloc = false);
Fault writeStringFunctional(Addr addr, const char *str);
Fault readStringFunctional(std::string &str, Addr addr);