Go to the documentation of this file.
45 #include "arch/locked_mem.hh"
50 #include "debug/LLSC.hh"
51 #include "debug/MemoryAccess.hh"
59 backdoor(params()->range, nullptr,
62 confTableReported(
p->conf_table_reported), inAddrMap(
p->in_addr_map),
63 kvmMap(
p->kvm_map), _system(NULL),
67 "Memory range %s must be valid with non-zero size.",
76 const auto &file =
params()->image_file;
81 fatal_if(!
object,
"%s: Could not load %s.",
name(), file);
88 warn(
"%s: Moving image from %s to memory address range %s.",
117 bytesRead(this,
"bytes_read",
118 "Number of bytes read from this memory"),
119 bytesInstRead(this,
"bytes_inst_read",
120 "Number of instructions bytes read from this memory"),
121 bytesWritten(this,
"bytes_written",
122 "Number of bytes written to this memory"),
123 numReads(this,
"num_reads",
124 "Number of read requests responded to by this memory"),
125 numWrites(this,
"num_writes",
126 "Number of write requests responded to by this memory"),
127 numOther(this,
"num_other",
128 "Number of other requests responded to by this memory"),
129 bwRead(this,
"bw_read",
130 "Total read bandwidth from this memory (bytes/s)"),
131 bwInstRead(this,
"bw_inst_read",
132 "Instruction read bandwidth from this memory (bytes/s)"),
133 bwWrite(this,
"bw_write",
134 "Write bandwidth from this memory (bytes/s)"),
135 bwTotal(this,
"bw_total",
136 "Total bandwidth to/from this memory (bytes/s)")
143 using namespace Stats;
152 .init(max_requestors)
155 for (
int i = 0;
i < max_requestors;
i++) {
160 .init(max_requestors)
163 for (
int i = 0;
i < max_requestors;
i++) {
168 .init(max_requestors)
171 for (
int i = 0;
i < max_requestors;
i++) {
176 .init(max_requestors)
179 for (
int i = 0;
i < max_requestors;
i++) {
184 .init(max_requestors)
187 for (
int i = 0;
i < max_requestors;
i++) {
192 .init(max_requestors)
195 for (
int i = 0;
i < max_requestors;
i++) {
204 for (
int i = 0;
i < max_requestors;
i++) {
210 .prereq(bytesInstRead)
213 for (
int i = 0;
i < max_requestors;
i++) {
219 .prereq(bytesWritten)
222 for (
int i = 0;
i < max_requestors;
i++) {
231 for (
int i = 0;
i < max_requestors;
i++) {
238 bwTotal = (bytesRead + bytesWritten) /
simSeconds;
261 if (
i->matchesContext(req)) {
262 DPRINTF(LLSC,
"Modifying lock record: context %d addr %#x\n",
263 req->contextId(), paddr);
270 DPRINTF(LLSC,
"Adding lock record: context %d addr %#x\n",
271 req->contextId(), paddr);
285 bool isLLSC = pkt->
isLLSC();
290 bool allowStore = !isLLSC;
301 if (
i->addr == paddr &&
i->matchesContext(req)) {
304 DPRINTF(LLSC,
"StCond success: context %d addr %#x\n",
305 req->contextId(), paddr);
314 req->setExtraData(allowStore ? 1 : 0);
323 if (
i->addr == paddr) {
324 DPRINTF(LLSC,
"Erasing lock record: context %d addr %#x\n",
325 i->contextId, paddr);
328 ContextID requestor_cid = req->hasContextId() ?
331 if (owner_cid != requestor_cid) {
350 #if THE_ISA != NULL_ISA
353 DPRINTF(MemoryAccess,
"%s from %s of size %i on address %#x data "
357 pkt->
req->isUncacheable() ?
'U' :
'C');
361 DPRINTF(MemoryAccess,
"%s from %s of size %i on address %#x %c\n",
367 # define TRACE_PACKET(A) tracePacket(system(), A, pkt)
369 # define TRACE_PACKET(A)
376 DPRINTF(MemoryAccess,
"Cache responding to %#llx: not responding\n",
382 DPRINTF(MemoryAccess,
"CleanEvict on 0x%x: not responding\n",
399 uint64_t condition_val64;
400 uint32_t condition_val32;
403 "(i.e. null=False)");
405 bool overwrite_mem =
true;
411 if (pkt->
req->isCondSwap()) {
412 if (pkt->
getSize() ==
sizeof(uint64_t)) {
413 condition_val64 = pkt->
req->getExtraData();
414 overwrite_mem = !std::memcmp(&condition_val64, host_addr,
416 }
else if (pkt->
getSize() ==
sizeof(uint32_t)) {
417 condition_val32 = (uint32_t)pkt->
req->getExtraData();
418 overwrite_mem = !std::memcmp(&condition_val32, host_addr,
421 panic(
"Invalid size for conditional read/write\n");
425 std::memcpy(host_addr, &overwrite_val[0], pkt->
getSize());
427 assert(!pkt->
req->isInstFetch());
431 }
else if (pkt->
isRead()) {
445 if (pkt->
req->isInstFetch())
457 DPRINTF(MemoryAccess,
"%s write due to %s\n",
458 __func__, pkt->
print());
460 assert(!pkt->
req->isInstFetch());
503 panic(
"AbstractMemory: unimplemented functional command %s",
Stats::Vector bytesRead
Number of total bytes read from this memory.
virtual void regStats()
Callback to set stat parameters.
bool checkLockedAddrList(PacketPtr pkt)
uint8_t * toHostAddr(Addr addr) const
Transform a gem5 address space address into its physical counterpart in the host address space.
MemoryImage & offset(Addr by)
AddrRange getAddrRange() const
Get address range to which this packet belongs.
AddrRange getAddrRange() const
Get the address range.
bool cacheResponding() const
bool write(const PortProxy &proxy) const
virtual void initState()
initState() is called on each SimObject when not restoring from a checkpoint.
void writeData(uint8_t *p) const
Copy data from the packet to the memory at the provided pointer.
bool interleaved() const
Determine if the range is interleaved or not.
void setBackingStore(uint8_t *pmem_addr)
Set the host memory backing store to be used by this memory controller.
ByteOrder getGuestByteOrder() const
Get the guest byte order.
Locked address class that represents a physical address and a context id.
int ContextID
Globally unique thread context ID.
ObjectFile * createObjectFile(const std::string &fname, bool raw)
bool contains(const Addr &a) const
Determine if the range contains an address.
bool isInvalidate() const
std::shared_ptr< Request > RequestPtr
RequestPtr req
A pointer to the original request.
const ContextID InvalidContextID
void print(std::ostream &o, int verbosity=0, const std::string &prefix="") const
void functionalAccess(PacketPtr pkt)
Perform an untimed memory read or write without changing anything but the memory itself.
void setData(const uint8_t *p)
Copy data into the packet from the provided pointer.
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
An abstract memory represents a contiguous block of physical memory, with an associated address range...
AbstractMemory::MemStats stats
AbstractMemory(const AbstractMemory &)
SymbolTable debugSymbolTable
Global unified debugging symbol table (for target).
void access(PacketPtr pkt)
Perform an untimed memory access and update all the state (e.g.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
void trackLoadLocked(PacketPtr pkt)
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
Stats::Vector numWrites
Number of write requests.
uint64_t size() const
Get the memory size.
uint64_t getUintX(ByteOrder endian) const
Get the data in the packet byte swapped from the specified endianness and zero-extended to 64 bits.
Stats::Formula simSeconds
const std::string & cmdString() const
Return the string name of the cmd field (for debugging and tracing).
bool needsResponse() const
bool valid() const
Determine if the range is valid.
Stats::Vector numReads
Number of read requests.
AtomicOpFunctor * getAtomicOp() const
Accessor function to atomic op.
const Params * params() const
const std::string & curPrefix()
Returns the current line prefix.
Stats::Vector bytesInstRead
Number of instruction bytes read from this memory.
MemStats(AbstractMemory &mem)
Object used to maintain state of a PrintReq.
void globalClearExclusive(XC *xc)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
void makeResponse()
Take a request packet and modify it in place to be suitable for returning as a response to that reque...
#define DDUMP(x, data, count)
DPRINTF is a debugging trace facility that allows one to selectively enable tracing statements.
static Addr mask(Addr paddr)
const FlagsType nozero
Don't print if this is zero.
virtual const std::string name() const
MemCmd cmd
The command field of the packet.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
This object is a proxy for a port or other object which implements the functional response protocol,...
Addr start() const
Get the start address of the range.
RequestorID maxRequestors()
Get the number of requestors registered in the system.
std::list< LockedAddr > lockedAddrList
std::string to_string() const
Get a string representation of the range.
Overload hash function for BasicBlockRange type.
void printLabels()
Print all of the pending unprinted labels on the stack.
bool writeOK(PacketPtr pkt)
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
void ccprintf(cp::Print &print)
std::string getRequestorName(RequestorID requestor_id)
Get the name of an object for a given request id.
AbstractMemoryParams Params
bool isSubset(const AddrRange &r) const
Determine if this range is a subset of another range, i.e.
bool insert(const Symbol &symbol)
SenderState * senderState
This packet's sender state.
unsigned int cacheLineSize() const
Get the cache line size of the system.
System * system() const
read the system pointer Implemented for completeness with the setter
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
const FlagsType total
Print the total.
Addr size() const
Get the size of the address range.
Stats::Vector bytesWritten
Number of bytes written to this memory.
const T * getConstPtr() const
const FlagsType nonan
Don't print if this is NAN.
Stats::Vector numOther
Number of other requests.
#define panic(...)
This implements a cprintf based panic() function.
void regStats() override
Callback to set stat parameters.
Generated on Wed Sep 30 2020 14:02:12 for gem5 by doxygen 1.8.17