diff options
author | Tuan Ta <qtt2@cornell.edu> | 2018-01-22 12:54:14 -0500 |
---|---|---|
committer | Tuan Ta <qtt2@cornell.edu> | 2018-06-14 22:41:11 +0000 |
commit | 7bab1d0aff897bc23b5677a51ae67b8cc32953dc (patch) | |
tree | b306210feabe295f3aeaad2c1ac4d7c4679b117c /src/mem/request.hh | |
parent | 74a8947fcb37ec4b3d43cf96740c474f0e3ffed8 (diff) | |
download | gem5-7bab1d0aff897bc23b5677a51ae67b8cc32953dc.tar.xz |
base,mem: Support AtomicOpFunctor in the classic memory system
AtomicOpFunctor can be used to implement atomic memory operations.
AtomicOpFunctor is captured inside a memory request and executed directly
in the memory hierarchy in a single step.
This patch enables AtomicOpFunctor pointers to be included in a memory
request and executed in a single step in the classic cache system.
This patch also makes the copy constructor of Request class do a deep
copy of AtomicOpFunctor object. This prevents a copy of a Request object
from accessing a deleted AtomicOpFunctor object.
Change-Id: I6649532b37f711e55f4552ad26893efeb300dd37
Reviewed-on: https://gem5-review.googlesource.com/8185
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Diffstat (limited to 'src/mem/request.hh')
-rw-r--r-- | src/mem/request.hh | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/mem/request.hh b/src/mem/request.hh index 1615a644a..189d160ab 100644 --- a/src/mem/request.hh +++ b/src/mem/request.hh @@ -445,12 +445,30 @@ class Request Request(int asid, Addr vaddr, unsigned size, Flags flags, MasterID mid, Addr pc, ContextID cid, AtomicOpFunctor *atomic_op) - : atomicOpFunctor(atomic_op) { - setVirt(asid, vaddr, size, flags, mid, pc); + setVirt(asid, vaddr, size, flags, mid, pc, atomic_op); setContext(cid); } + Request(const Request& other) + : _paddr(other._paddr), _size(other._size), + _masterId(other._masterId), + _flags(other._flags), + _memSpaceConfigFlags(other._memSpaceConfigFlags), + privateFlags(other.privateFlags), + _time(other._time), + _taskId(other._taskId), _asid(other._asid), _vaddr(other._vaddr), + _extraData(other._extraData), _contextId(other._contextId), + _pc(other._pc), _reqInstSeqNum(other._reqInstSeqNum), + translateDelta(other.translateDelta), + accessDelta(other.accessDelta), depth(other.depth) + { + if (other.atomicOpFunctor) + atomicOpFunctor = (other.atomicOpFunctor)->clone(); + else + atomicOpFunctor = nullptr; + } + ~Request() { if (hasAtomicOpFunctor()) { @@ -474,7 +492,7 @@ class Request */ void setVirt(int asid, Addr vaddr, unsigned size, Flags flags, MasterID mid, - Addr pc) + Addr pc, AtomicOpFunctor *amo_op = nullptr) { _asid = asid; _vaddr = vaddr; @@ -490,6 +508,7 @@ class Request depth = 0; accessDelta = 0; translateDelta = 0; + atomicOpFunctor = amo_op; } /** |