* AbstractMemory declaration
*/
-#ifndef __ABSTRACT_MEMORY_HH__
-#define __ABSTRACT_MEMORY_HH__
+#ifndef __MEM_ABSTRACT_MEMORY_HH__
+#define __MEM_ABSTRACT_MEMORY_HH__
+#include "mem/backdoor.hh"
#include "mem/mem_object.hh"
#include "params/AbstractMemory.hh"
#include "sim/stats.hh"
Addr addr;
// locking hw context
- const int contextId;
+ const ContextID contextId;
static Addr mask(Addr paddr) { return (paddr & ~Addr_Mask); }
// check for matching execution context
- bool matchesContext(Request *req) const
+ bool matchesContext(const RequestPtr &req) const
{
return (contextId == req->contextId());
}
- LockedAddr(Request *req) : addr(mask(req->getPaddr())),
- contextId(req->contextId())
+ LockedAddr(const RequestPtr &req) : addr(mask(req->getPaddr())),
+ contextId(req->contextId())
{}
// constructor for unserialization use
// Pointer to host memory used to implement this memory
uint8_t* pmemAddr;
+ // Backdoor to access this memory.
+ MemBackdoor backdoor;
+
// Enable specific memories to be reported to the configuration table
- bool confTableReported;
+ const bool confTableReported;
// Should the memory appear in the global address map
- bool inAddrMap;
+ const bool inAddrMap;
+
+ // Should KVM map this memory for the guest
+ const bool kvmMap;
std::list<LockedAddr> lockedAddrList;
// this method must be called on *all* stores since even
// non-conditional stores must clear any matching lock addresses.
bool writeOK(PacketPtr pkt) {
- Request *req = pkt->req;
+ const RequestPtr &req = pkt->req;
if (lockedAddrList.empty()) {
// no locked addrs: nothing to check, store_conditional fails
bool isLLSC = pkt->isLLSC();
AbstractMemory(const Params* p);
virtual ~AbstractMemory() {}
+ /**
+ * Initialise this memory.
+ */
+ void init() override;
+
/**
* See if this is a null memory that should never store data and
* always return zero.
*/
bool isInAddrMap() const { return inAddrMap; }
+ /**
+ * When shadow memories are in use, KVM may want to make one or the other,
+ * but cannot map both into the guest address space.
+ *
+ * @return if this memory should be mapped into the KVM guest address space
+ */
+ bool isKvmMap() const { return kvmMap; }
+
/**
* Perform an untimed memory access and update all the state
* (e.g. locked addresses) and statistics accordingly. The packet
/**
* Register Statistics
*/
- virtual void regStats();
+ void regStats() override;
};
-#endif //__ABSTRACT_MEMORY_HH__
+#endif //__MEM_ABSTRACT_MEMORY_HH__