Go to the documentation of this file.
48 #include "debug/LLSC.hh"
49 #include "debug/MemoryAccess.hh"
61 backdoor(params().range, nullptr,
65 confTableReported(
p.conf_table_reported), inAddrMap(
p.in_addr_map),
66 kvmMap(
p.kvm_map), writeable(
p.writeable), _system(NULL),
70 "Memory range %s must be valid with non-zero size.",
79 const auto &file =
params().image_file;
84 fatal_if(!
object,
"%s: Could not load %s.",
name(), file);
91 warn(
"%s: Moving image from %s to memory address range %s.",
119 : statistics::
Group(&_mem),
mem(_mem),
120 ADD_STAT(bytesRead, statistics::units::Byte::get(),
121 "Number of bytes read from this memory"),
122 ADD_STAT(bytesInstRead, statistics::units::Byte::get(),
123 "Number of instructions bytes read from this memory"),
124 ADD_STAT(bytesWritten, statistics::units::Byte::get(),
125 "Number of bytes written to this memory"),
127 "Number of read requests responded to by this memory"),
129 "Number of write requests responded to by this memory"),
131 "Number of other requests responded to by this memory"),
132 ADD_STAT(bwRead, statistics::units::Rate<
133 statistics::units::Byte, statistics::units::Second>::get(),
134 "Total read bandwidth from this memory"),
136 statistics::units::Rate<
137 statistics::units::Byte, statistics::units::Second>::get(),
138 "Instruction read bandwidth from this memory"),
139 ADD_STAT(bwWrite, statistics::units::Rate<
140 statistics::units::Byte, statistics::units::Second>::get(),
141 "Write bandwidth from this memory"),
142 ADD_STAT(bwTotal, statistics::units::Rate<
143 statistics::units::Byte, statistics::units::Second>::get(),
144 "Total bandwidth to/from this memory")
151 using namespace statistics;
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++) {
200 .init(max_requestors)
203 for (
int i = 0;
i < max_requestors;
i++) {
212 for (
int i = 0;
i < max_requestors;
i++) {
218 .prereq(bytesInstRead)
221 for (
int i = 0;
i < max_requestors;
i++) {
227 .prereq(bytesWritten)
230 for (
int i = 0;
i < max_requestors;
i++) {
239 for (
int i = 0;
i < max_requestors;
i++) {
246 bwTotal = (bytesRead + bytesWritten) /
simSeconds;
269 if (
i->matchesContext(req)) {
270 DPRINTF(LLSC,
"Modifying lock record: context %d addr %#x\n",
271 req->contextId(), paddr);
278 DPRINTF(LLSC,
"Adding lock record: context %d addr %#x\n",
279 req->contextId(), paddr);
294 bool isLLSC = pkt->
isLLSC();
299 bool allowStore = !isLLSC;
310 if (
i->addr == paddr &&
i->matchesContext(req)) {
313 DPRINTF(LLSC,
"StCond success: context %d addr %#x\n",
314 req->contextId(), paddr);
323 req->setExtraData(allowStore ? 1 : 0);
332 if (
i->addr == paddr) {
333 DPRINTF(LLSC,
"Erasing lock record: context %d addr %#x\n",
334 i->contextId, paddr);
337 ContextID requestor_cid = req->hasContextId() ?
340 if (owner_cid != requestor_cid) {
361 DPRINTF(MemoryAccess,
"%s from %s of size %i on address %#x data "
365 pkt->
req->isUncacheable() ?
'U' :
'C');
368 DPRINTF(MemoryAccess,
"%s from %s of size %i on address %#x %c\n",
374 # define TRACE_PACKET(A) tracePacket(system(), A, pkt)
376 # define TRACE_PACKET(A)
383 DPRINTF(MemoryAccess,
"Cache responding to %#llx: not responding\n",
389 DPRINTF(MemoryAccess,
"CleanEvict on 0x%x: not responding\n",
406 uint64_t condition_val64;
407 uint32_t condition_val32;
410 "(i.e. null=False)");
412 bool overwrite_mem =
true;
418 if (pkt->
req->isCondSwap()) {
419 if (pkt->
getSize() ==
sizeof(uint64_t)) {
420 condition_val64 = pkt->
req->getExtraData();
421 overwrite_mem = !std::memcmp(&condition_val64, host_addr,
423 }
else if (pkt->
getSize() ==
sizeof(uint32_t)) {
424 condition_val32 = (uint32_t)pkt->
req->getExtraData();
425 overwrite_mem = !std::memcmp(&condition_val32, host_addr,
428 panic(
"Invalid size for conditional read/write\n");
432 std::memcpy(host_addr, &overwrite_val[0], pkt->
getSize());
434 assert(!pkt->
req->isInstFetch());
438 }
else if (pkt->
isRead()) {
452 if (pkt->
req->isInstFetch())
464 DPRINTF(MemoryAccess,
"%s write due to %s\n",
465 __func__, pkt->
print());
467 assert(!pkt->
req->isInstFetch());
510 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.
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).
virtual BaseISA * getIsaPtr() const =0
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 Sun Jul 30 2023 01:56:57 for gem5 by doxygen 1.8.17