Go to the documentation of this file.
48 #include "debug/LLSC.hh"
49 #include "debug/MemoryAccess.hh"
61 backdoor(params().range, nullptr,
64 confTableReported(
p.conf_table_reported), inAddrMap(
p.in_addr_map),
65 kvmMap(
p.kvm_map), _system(NULL),
69 "Memory range %s must be valid with non-zero size.",
78 const auto &file =
params().image_file;
83 fatal_if(!
object,
"%s: Could not load %s.",
name(), file);
90 warn(
"%s: Moving image from %s to memory address range %s.",
118 : statistics::
Group(&_mem),
mem(_mem),
119 ADD_STAT(bytesRead, statistics::units::Byte::get(),
120 "Number of bytes read from this memory"),
121 ADD_STAT(bytesInstRead, statistics::units::Byte::get(),
122 "Number of instructions bytes read from this memory"),
123 ADD_STAT(bytesWritten, statistics::units::Byte::get(),
124 "Number of bytes written to this memory"),
125 ADD_STAT(numReads, statistics::units::Count::get(),
126 "Number of read requests responded to by this memory"),
127 ADD_STAT(numWrites, statistics::units::Count::get(),
128 "Number of write requests responded to by this memory"),
129 ADD_STAT(numOther, statistics::units::Count::get(),
130 "Number of other requests responded to by this memory"),
131 ADD_STAT(bwRead, statistics::units::Rate<
132 statistics::units::Byte, statistics::units::Second>::get(),
133 "Total read bandwidth from this memory"),
135 statistics::units::Rate<
136 statistics::units::Byte, statistics::units::Second>::get(),
137 "Instruction read bandwidth from this memory"),
138 ADD_STAT(bwWrite, statistics::units::Rate<
139 statistics::units::Byte, statistics::units::Second>::get(),
140 "Write bandwidth from this memory"),
141 ADD_STAT(bwTotal, statistics::units::Rate<
142 statistics::units::Byte, statistics::units::Second>::get(),
143 "Total bandwidth to/from this memory")
150 using namespace statistics;
159 .init(max_requestors)
162 for (
int i = 0;
i < max_requestors;
i++) {
167 .init(max_requestors)
170 for (
int i = 0;
i < max_requestors;
i++) {
175 .init(max_requestors)
178 for (
int i = 0;
i < max_requestors;
i++) {
183 .init(max_requestors)
186 for (
int i = 0;
i < max_requestors;
i++) {
191 .init(max_requestors)
194 for (
int i = 0;
i < max_requestors;
i++) {
199 .init(max_requestors)
202 for (
int i = 0;
i < max_requestors;
i++) {
211 for (
int i = 0;
i < max_requestors;
i++) {
217 .prereq(bytesInstRead)
220 for (
int i = 0;
i < max_requestors;
i++) {
226 .prereq(bytesWritten)
229 for (
int i = 0;
i < max_requestors;
i++) {
238 for (
int i = 0;
i < max_requestors;
i++) {
245 bwTotal = (bytesRead + bytesWritten) /
simSeconds;
268 if (
i->matchesContext(req)) {
269 DPRINTF(LLSC,
"Modifying lock record: context %d addr %#x\n",
270 req->contextId(), paddr);
277 DPRINTF(LLSC,
"Adding lock record: context %d addr %#x\n",
278 req->contextId(), paddr);
293 bool isLLSC = pkt->
isLLSC();
298 bool allowStore = !isLLSC;
309 if (
i->addr == paddr &&
i->matchesContext(req)) {
312 DPRINTF(LLSC,
"StCond success: context %d addr %#x\n",
313 req->contextId(), paddr);
322 req->setExtraData(allowStore ? 1 : 0);
331 if (
i->addr == paddr) {
332 DPRINTF(LLSC,
"Erasing lock record: context %d addr %#x\n",
333 i->contextId, paddr);
336 ContextID requestor_cid = req->hasContextId() ?
339 if (owner_cid != requestor_cid) {
360 DPRINTF(MemoryAccess,
"%s from %s of size %i on address %#x data "
364 pkt->
req->isUncacheable() ?
'U' :
'C');
367 DPRINTF(MemoryAccess,
"%s from %s of size %i on address %#x %c\n",
373 # define TRACE_PACKET(A) tracePacket(system(), A, pkt)
375 # define TRACE_PACKET(A)
382 DPRINTF(MemoryAccess,
"Cache responding to %#llx: not responding\n",
388 DPRINTF(MemoryAccess,
"CleanEvict on 0x%x: not responding\n",
405 uint64_t condition_val64;
406 uint32_t condition_val32;
409 "(i.e. null=False)");
411 bool overwrite_mem =
true;
417 if (pkt->
req->isCondSwap()) {
418 if (pkt->
getSize() ==
sizeof(uint64_t)) {
419 condition_val64 = pkt->
req->getExtraData();
420 overwrite_mem = !std::memcmp(&condition_val64, host_addr,
422 }
else if (pkt->
getSize() ==
sizeof(uint32_t)) {
423 condition_val32 = (uint32_t)pkt->
req->getExtraData();
424 overwrite_mem = !std::memcmp(&condition_val32, host_addr,
427 panic(
"Invalid size for conditional read/write\n");
431 std::memcpy(host_addr, &overwrite_val[0], pkt->
getSize());
433 assert(!pkt->
req->isInstFetch());
437 }
else if (pkt->
isRead()) {
451 if (pkt->
req->isInstFetch())
463 DPRINTF(MemoryAccess,
"%s write due to %s\n",
464 __func__, pkt->
print());
466 assert(!pkt->
req->isInstFetch());
509 panic(
"AbstractMemory: unimplemented functional command %s",
const std::string & cmdString() const
Return the string name of the cmd field (for debugging and tracing).
std::string to_string() const
Get a string representation of the range.
statistics::Vector bytesWritten
Number of bytes written to this memory.
MemStats(AbstractMemory &mem)
virtual void initState()
initState() is called on each SimObject when not restoring from a checkpoint.
Addr start() const
Get the start address of the range.
uint64_t getUintX(ByteOrder endian) const
Get the data in the packet byte swapped from the specified endianness and zero-extended to 64 bits.
statistics::Vector numOther
Number of other requests.
statistics::Vector numWrites
Number of write requests.
void setData(const uint8_t *p)
Copy data into the packet from the provided pointer.
AddrRange getAddrRange() const
Get the address range.
std::list< LockedAddr > lockedAddrList
RequestPtr req
A pointer to the original request.
bool contains(const Addr &a) const
Determine if the range contains an address.
const ContextID InvalidContextID
const FlagsType nozero
Don't print if this is zero.
bool cacheResponding() const
const FlagsType nonan
Don't print if this is NAN.
ByteOrder getGuestByteOrder() const
Get the guest byte order.
bool isSubset(const AddrRange &r) const
Determine if this range is a subset of another range, i.e.
void printLabels()
Print all of the pending unprinted labels on the stack.
void ccprintf(cp::Print &print)
statistics::Vector numReads
Number of read requests.
unsigned int cacheLineSize() const
Get the cache line size of the system.
gem5::memory::AbstractMemory::MemStats stats
AtomicOpFunctor * getAtomicOp() const
Accessor function to atomic op.
Wrapper that groups a few flag bits under the same undelying container.
RequestorID maxRequestors()
Get the number of requestors registered in the system.
statistics::Vector bytesInstRead
Number of instruction bytes read from this memory.
virtual BaseISA * getIsaPtr()=0
ThreadContext is the external interface to all thread state for anything outside of the CPU.
void functionalAccess(PacketPtr pkt)
Perform an untimed memory read or write without changing anything but the memory itself.
void setBackingStore(uint8_t *pmem_addr)
Set the host memory backing store to be used by this memory controller.
virtual std::string name() const
bool writeOK(PacketPtr pkt)
void print(std::ostream &o, int verbosity=0, const std::string &prefix="") const
MemoryImage & offset(Addr by)
bool interleaved() const
Determine if the range is interleaved or not.
const Params & params() const
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
bool checkLockedAddrList(PacketPtr pkt)
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
AbstractMemory(const AbstractMemory &)
uint8_t * toHostAddr(Addr addr) const
Transform a gem5 address space address into its physical counterpart in the host address space.
An abstract memory represents a contiguous block of physical memory, with an associated address range...
std::string getRequestorName(RequestorID requestor_id)
Get the name of an object for a given request id.
std::shared_ptr< Request > RequestPtr
const T * getConstPtr() const
This object is a proxy for a port or other object which implements the functional response protocol,...
const std::string & curPrefix()
Returns the current line prefix.
Addr size() const
Get the size of the address range.
bool valid() const
Determine if the range is valid.
MemCmd cmd
The command field of the packet.
bool needsResponse() const
void writeData(uint8_t *p) const
Copy data from the packet to the memory at the provided pointer.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
SenderState * senderState
This packet's sender state.
virtual void regStats()
Callback to set stat parameters.
#define DDUMP(x, data, count)
DPRINTF is a debugging trace facility that allows one to selectively enable tracing statements.
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
ObjectFile * createObjectFile(const std::string &fname, bool raw)
uint64_t size() const
Get the memory size.
void regStats() override
Callback to set stat parameters.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
bool insert(const Symbol &symbol)
Insert a new symbol in the table if it does not already exist.
statistics::Vector bytesRead
Number of total bytes read from this memory.
System * system() const
read the system pointer Implemented for completeness with the setter
void makeResponse()
Take a request packet and modify it in place to be suitable for returning as a response to that reque...
virtual void globalClearExclusive()
int ContextID
Globally unique thread context ID.
statistics::Formula & simSeconds
Locked address class that represents a physical address and a context id.
bool write(const PortProxy &proxy) const
ClockedObjectParams Params
Parameters of ClockedObject.
SymbolTable debugSymbolTable
Global unified debugging symbol table (for target).
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
static Addr mask(Addr paddr)
void access(PacketPtr pkt)
Perform an untimed memory access and update all the state (e.g.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
const FlagsType total
Print the total.
AddrRange getAddrRange() const
Get address range to which this packet belongs.
void trackLoadLocked(PacketPtr pkt)
bool isInvalidate() const
#define panic(...)
This implements a cprintf based panic() function.
Object used to maintain state of a PrintReq.
Generated on Tue Feb 8 2022 11:47:09 for gem5 by doxygen 1.8.17