return memoryPortList[portName];
}
-//
-// little helper for better prot_* error messages
-//
-void
-PhysicalMemory::prot_access_error(Addr addr, int size, Command func)
-{
- panic("invalid physical memory access!\n"
- "%s: %i(addr=%#x, size=%d) out of range (max=%#x)\n",
- name(), func, addr, size, pmem_size - 1);
-}
-
-void
-PhysicalMemory::prot_memset(Addr addr, uint8_t val, int size)
-{
- if (addr + size >= pmem_size)
- prot_access_error(addr, size, Write);
-
- memset(pmem_addr + addr - base_addr, val, size);
-}
-
int
PhysicalMemory::deviceBlockSize()
{
void
PhysicalMemory::doFunctionalAccess(Packet &pkt)
{
- if (pkt.addr + pkt.size >= pmem_size)
- prot_access_error(pkt.addr, pkt.size, pkt.cmd);
+ assert(pkt.addr + pkt.size < pmem_size);
switch (pkt.cmd) {
case Read:
PhysicalMemory(const std::string &n);
virtual ~PhysicalMemory();
- protected:
- // error handling for prot_* functions
- void prot_access_error(Addr addr, int size, Command func);
-
public:
int deviceBlockSize();
- void prot_memset(Addr addr, uint8_t val, int size);
-
// fast back-door memory access for vtophys(), remote gdb, etc.
// uint64_t phys_read_qword(Addr addr) const;
private:
should not need to be virtual, since it can be implemented in
terms of writeBlobFunctional(). However, it shouldn't be
performance-critical either, so it could be if we wanted to.
- Not even sure if this is actually needed anywhere (there's a
- prot_memset on the old functional memory that's never used),
- but Nate claims it is.
*/
void memsetBlobFunctional(Addr addr, uint8_t val, int size);