Go to the documentation of this file.
45 #include "arch/locked_mem.hh"
49 #include "debug/LLSC.hh"
50 #include "debug/MemoryAccess.hh"
56 backdoor(params().range, nullptr,
59 confTableReported(
p.conf_table_reported), inAddrMap(
p.in_addr_map),
60 kvmMap(
p.kvm_map), _system(NULL),
64 "Memory range %s must be valid with non-zero size.",
73 const auto &file =
params().image_file;
78 fatal_if(!
object,
"%s: Could not load %s.",
name(), file);
85 warn(
"%s: Moving image from %s to memory address range %s.",
116 "Number of instructions bytes read from this memory"),
118 "Number of bytes written to this memory"),
120 "Number of read requests responded to by this memory"),
122 "Number of write requests responded to by this memory"),
124 "Number of other requests responded to by this memory"),
126 "Total read bandwidth from this memory"),
128 "Instruction read bandwidth from this memory"),
130 "Write bandwidth from this memory"),
132 "Total bandwidth to/from this memory")
139 using namespace Stats;
148 .init(max_requestors)
151 for (
int i = 0;
i < max_requestors;
i++) {
156 .init(max_requestors)
159 for (
int i = 0;
i < max_requestors;
i++) {
164 .init(max_requestors)
167 for (
int i = 0;
i < max_requestors;
i++) {
172 .init(max_requestors)
175 for (
int i = 0;
i < max_requestors;
i++) {
180 .init(max_requestors)
183 for (
int i = 0;
i < max_requestors;
i++) {
188 .init(max_requestors)
191 for (
int i = 0;
i < max_requestors;
i++) {
200 for (
int i = 0;
i < max_requestors;
i++) {
206 .prereq(bytesInstRead)
209 for (
int i = 0;
i < max_requestors;
i++) {
215 .prereq(bytesWritten)
218 for (
int i = 0;
i < max_requestors;
i++) {
227 for (
int i = 0;
i < max_requestors;
i++) {
234 bwTotal = (bytesRead + bytesWritten) /
simSeconds;
257 if (
i->matchesContext(req)) {
258 DPRINTF(LLSC,
"Modifying lock record: context %d addr %#x\n",
259 req->contextId(), paddr);
266 DPRINTF(LLSC,
"Adding lock record: context %d addr %#x\n",
267 req->contextId(), paddr);
282 bool isLLSC = pkt->
isLLSC();
287 bool allowStore = !isLLSC;
298 if (
i->addr == paddr &&
i->matchesContext(req)) {
301 DPRINTF(LLSC,
"StCond success: context %d addr %#x\n",
302 req->contextId(), paddr);
311 req->setExtraData(allowStore ? 1 : 0);
320 if (
i->addr == paddr) {
321 DPRINTF(LLSC,
"Erasing lock record: context %d addr %#x\n",
322 i->contextId, paddr);
325 ContextID requestor_cid = req->hasContextId() ?
328 if (owner_cid != requestor_cid) {
349 DPRINTF(MemoryAccess,
"%s from %s of size %i on address %#x data "
353 pkt->
req->isUncacheable() ?
'U' :
'C');
356 DPRINTF(MemoryAccess,
"%s from %s of size %i on address %#x %c\n",
362 # define TRACE_PACKET(A) tracePacket(system(), A, pkt)
364 # define TRACE_PACKET(A)
371 DPRINTF(MemoryAccess,
"Cache responding to %#llx: not responding\n",
377 DPRINTF(MemoryAccess,
"CleanEvict on 0x%x: not responding\n",
394 uint64_t condition_val64;
395 uint32_t condition_val32;
398 "(i.e. null=False)");
400 bool overwrite_mem =
true;
406 if (pkt->
req->isCondSwap()) {
407 if (pkt->
getSize() ==
sizeof(uint64_t)) {
408 condition_val64 = pkt->
req->getExtraData();
409 overwrite_mem = !std::memcmp(&condition_val64, host_addr,
411 }
else if (pkt->
getSize() ==
sizeof(uint32_t)) {
412 condition_val32 = (uint32_t)pkt->
req->getExtraData();
413 overwrite_mem = !std::memcmp(&condition_val32, host_addr,
416 panic(
"Invalid size for conditional read/write\n");
420 std::memcpy(host_addr, &overwrite_val[0], pkt->
getSize());
422 assert(!pkt->
req->isInstFetch());
426 }
else if (pkt->
isRead()) {
440 if (pkt->
req->isInstFetch())
452 DPRINTF(MemoryAccess,
"%s write due to %s\n",
453 __func__, pkt->
print());
455 assert(!pkt->
req->isInstFetch());
498 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.
Wrapper that groups a few flag bits under the same undelying container.
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)
ClockedObjectParams Params
Parameters of ClockedObject.
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.
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
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 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...
Stats::Formula & simSeconds
#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 UNIT_RATE(T1, T2)
#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.
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.
bool isSubset(const AddrRange &r) const
Determine if this range is a subset of another range, i.e.
bool insert(const Symbol &symbol)
const Params & params() const
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 Tue Mar 23 2021 19:41:27 for gem5 by doxygen 1.8.17