51 #include "debug/LLSC.hh"
52 #include "debug/MemoryAccess.hh"
59 MemObject(p), range(params()->range), pmemAddr(NULL),
60 confTableReported(p->conf_table_reported), inAddrMap(p->in_addr_map),
61 kvmMap(p->kvm_map), _system(NULL)
71 panic(
"Memory Size not divisible by page size\n");
85 using namespace Stats;
92 .
desc(
"Number of bytes read from this memory")
101 .
desc(
"Number of instructions bytes read from this memory")
110 .
desc(
"Number of bytes written to this memory")
119 .
desc(
"Number of read requests responded to by this memory")
128 .
desc(
"Number of write requests responded to by this memory")
137 .
desc(
"Number of other requests responded to by this memory")
145 .
desc(
"Total read bandwidth from this memory (bytes/s)")
156 .
desc(
"Instruction read bandwidth from this memory (bytes/s)")
166 .
desc(
"Write bandwidth from this memory (bytes/s)")
176 .
desc(
"Total bandwidth to/from this memory (bytes/s)")
210 if (i->matchesContext(req)) {
211 DPRINTF(LLSC,
"Modifying lock record: context %d addr %#x\n",
219 DPRINTF(LLSC,
"Adding lock record: context %d addr %#x\n",
234 bool isLLSC = pkt->
isLLSC();
239 bool allowStore = !isLLSC;
250 if (i->addr == paddr && i->matchesContext(req)) {
253 DPRINTF(LLSC,
"StCond success: context %d addr %#x\n",
272 if (i->addr == paddr) {
273 DPRINTF(LLSC,
"Erasing lock record: context %d addr %#x\n",
274 i->contextId, paddr);
297 DPRINTF(MemoryAccess,"%s from %s of size %i on address 0x%x data " \
298 "0x%x %c\n", A, system()->getMasterName(pkt->req->masterId()),\
299 pkt->getSize(), pkt->getAddr(), pkt->get<T>(), \
300 pkt->req->isUncacheable() ? 'U' : 'C'); \
304 #define TRACE_PACKET(A) \
306 switch (pkt->getSize()) { \
312 DPRINTF(MemoryAccess, "%s from %s of size %i on address 0x%x %c\n",\
313 A, system()->getMasterName(pkt->req->masterId()), \
314 pkt->getSize(), pkt->getAddr(), \
315 pkt->req->isUncacheable() ? 'U' : 'C'); \
316 DDUMP(MemoryAccess, pkt->getConstPtr<uint8_t>(), pkt->getSize()); \
322 #define TRACE_PACKET(A)
330 DPRINTF(MemoryAccess,
"Cache responding to %#llx: not responding\n",
336 DPRINTF(MemoryAccess,
"CleanEvict on 0x%x: not responding\n",
354 uint64_t condition_val64;
355 uint32_t condition_val32;
358 panic(
"Swap only works if there is real memory (i.e. null=False)");
360 bool overwrite_mem =
true;
363 std::memcpy(&overwrite_val[0], pkt->
getConstPtr<uint8_t>(),
365 std::memcpy(pkt->
getPtr<uint8_t>(), hostAddr, pkt->
getSize());
368 if (pkt->
getSize() ==
sizeof(uint64_t)) {
370 overwrite_mem = !std::memcmp(&condition_val64, hostAddr,
372 }
else if (pkt->
getSize() ==
sizeof(uint32_t)) {
374 overwrite_mem = !std::memcmp(&condition_val32, hostAddr,
377 panic(
"Invalid size for conditional read/write\n");
381 std::memcpy(hostAddr, &overwrite_val[0], pkt->
getSize());
387 }
else if (pkt->
isRead()) {
410 DPRINTF(MemoryAccess,
"%s wrote %i bytes to address %x\n",
419 panic(
"unimplemented");
455 panic(
"AbstractMemory: unimplemented functional command %s",
void ccprintf(cp::Print &print)
void functionalAccess(PacketPtr pkt)
Perform an untimed memory read or write without changing anything but the memory itself.
Derived & subname(off_type index, const std::string &name)
Set the subfield name for the given index, and marks this stat to print at the end of simulation...
Addr start() const
Get the start address of the range.
ContextID contextId() const
Accessor function for context ID.
Object used to maintain state of a PrintReq.
const FlagsType nonan
Don't print if this is NAN.
void setExtraData(uint64_t extraData)
Accessor function for store conditional return value.
Locked address class that represents a physical address and a context id.
bool writeOK(PacketPtr pkt)
uint64_t getExtraData() const
Accessor function for store conditional return value.
AbstractMemory(const AbstractMemory &)
Stats::Formula bwRead
Read bandwidth from this memory.
Stats::Vector numWrites
Number of write requests.
virtual BaseCPU * getCpuPtr()=0
Addr getPageBytes() const
Get the page bytes for the ISA.
const std::string & curPrefix()
Returns the current line prefix.
bool checkLockedAddrList(PacketPtr pkt)
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
ThreadContext is the external interface to all thread state for anything outside of the CPU...
T * getPtr()
get a pointer to the data ptr.
Stats::Formula simSeconds
Derived & init(size_type size)
Set this vector to have the given size.
AbstractMemory declaration.
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
Stats::Vector bytesWritten
Number of bytes written to this memory.
static Addr mask(Addr paddr)
AbstractMemoryParams Params
System * system() const
read the system pointer Implemented for completeness with the setter
AddrRange getAddrRange() const
Get the address range.
void printLabels()
Print all of the pending unprinted labels on the stack.
Derived & prereq(const Stat &prereq)
Set the prerequisite stat and marks this stat to print at the end of simulation.
void access(PacketPtr pkt)
Perform an untimed memory access and update all the state (e.g.
Stats::Vector bytesRead
Number of total bytes read from this memory.
Stats::Formula bwTotal
Total bandwidth from this memory.
const RequestPtr req
A pointer to the original request.
bool needsResponse() const
static void wakeup(ThreadID tid)
std::list< LockedAddr > lockedAddrList
bool isSubset(const AddrRange &r) const
Determine if this range is a subset of another range, i.e.
ThreadContext * getThreadContext(ContextID tid)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
bool cacheResponding() const
Derived & precision(int _precision)
Set the precision and marks this stat to print at the end of simulation.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
uint64_t size() const
Get the memory size.
void trackLoadLocked(PacketPtr pkt)
const FlagsType total
Print the total.
MasterID maxMasters()
Get the number of masters registered in the system.
Stats::Vector bytesInstRead
Number of instruction bytes read from this memory.
MasterID masterId() const
Accesssor for the requestor id.
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
Stats::Vector numOther
Number of other requests.
void makeResponse()
Take a request packet and modify it in place to be suitable for returning as a response to that reque...
void regStats() override
Register Statistics.
void init() override
Initialise this memory.
virtual const std::string name() const
void setBackingStore(uint8_t *pmem_addr)
Set the host memory backing store to be used by this memory controller.
const std::string & cmdString() const
Return the string name of the cmd field (for debugging and tracing).
SenderState * senderState
This packet's sender state.
MemCmd cmd
The command field of the packet.
The MemObject class extends the ClockedObject with accessor functions to get its master and slave por...
virtual int threadId() const =0
System * _system
Pointor to the System object.
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
const T * getConstPtr() const
AtomicOpFunctor * getAtomicOp() const
Accessor function to atomic op.
bool isInvalidate() const
const FlagsType nozero
Don't print if this is zero.
Stats::Formula bwWrite
Write bandwidth from this memory.
Stats::Formula bwInstRead
Read bandwidth from this memory.
void regStats() override
Register statistics for this object.
Stats::Vector numReads
Number of read requests.