diff --git a/src/arch/arm/isa.cc b/src/arch/arm/isa.cc index fabbe0756..2ae0bd7dc 100644 --- a/src/arch/arm/isa.cc +++ b/src/arch/arm/isa.cc @@ -1465,7 +1465,7 @@ ISA::setMiscReg(int misc_reg, const MiscReg &val, ThreadContext *tc) case MISCREG_ATS1HR: case MISCREG_ATS1HW: { - unsigned flags = 0; + Request::Flags flags = 0; BaseTLB::Mode mode = BaseTLB::Read; TLB::ArmTranslationType tranType = TLB::NormalTran; Fault fault; @@ -1710,7 +1710,7 @@ ISA::setMiscReg(int misc_reg, const MiscReg &val, ThreadContext *tc) case MISCREG_AT_S1E3W_Xt: { RequestPtr req = new Request; - unsigned flags = 0; + Request::Flags flags = 0; BaseTLB::Mode mode = BaseTLB::Read; TLB::ArmTranslationType tranType = TLB::NormalTran; Fault fault; diff --git a/src/arch/arm/tlb.cc b/src/arch/arm/tlb.cc index a19a609b7..6658657aa 100644 --- a/src/arch/arm/tlb.cc +++ b/src/arch/arm/tlb.cc @@ -64,6 +64,7 @@ #include "debug/TLB.hh" #include "debug/TLBVerbose.hh" #include "mem/page_table.hh" +#include "mem/request.hh" #include "params/ArmTLB.hh" #include "sim/full_system.hh" #include "sim/process.hh" @@ -555,7 +556,7 @@ TLB::translateSe(RequestPtr req, ThreadContext *tc, Mode mode, vaddr = purifyTaggedAddr(vaddr_tainted, tc, aarch64EL, ttbcr); else vaddr = vaddr_tainted; - uint32_t flags = req->getFlags(); + Request::Flags flags = req->getFlags(); bool is_fetch = (mode == Execute); bool is_write = (mode == Write); @@ -588,7 +589,7 @@ Fault TLB::checkPermissions(TlbEntry *te, RequestPtr req, Mode mode) { Addr vaddr = req->getVaddr(); // 32-bit don't have to purify - uint32_t flags = req->getFlags(); + Request::Flags flags = req->getFlags(); bool is_fetch = (mode == Execute); bool is_write = (mode == Write); bool is_priv = isPriv && !(flags & UserMode); @@ -760,7 +761,7 @@ TLB::checkPermissions64(TlbEntry *te, RequestPtr req, Mode mode, Addr vaddr_tainted = req->getVaddr(); Addr vaddr = purifyTaggedAddr(vaddr_tainted, tc, aarch64EL, ttbcr); - uint32_t flags = req->getFlags(); + Request::Flags flags = req->getFlags(); bool is_fetch = (mode == Execute); bool is_write = (mode == Write); bool is_priv M5_VAR_USED = isPriv && !(flags & UserMode); @@ -967,7 +968,7 @@ TLB::translateFs(RequestPtr req, ThreadContext *tc, Mode mode, vaddr = purifyTaggedAddr(vaddr_tainted, tc, aarch64EL, ttbcr); else vaddr = vaddr_tainted; - uint32_t flags = req->getFlags(); + Request::Flags flags = req->getFlags(); bool is_fetch = (mode == Execute); bool is_write = (mode == Write); @@ -981,7 +982,7 @@ TLB::translateFs(RequestPtr req, ThreadContext *tc, Mode mode, isPriv, flags & UserMode, isSecure, tranType & S1S2NsTran); DPRINTF(TLB, "translateFs addr %#x, mode %d, st2 %d, scr %#x sctlr %#x " - "flags %#x tranType 0x%x\n", vaddr_tainted, mode, isStage2, + "flags %#lx tranType 0x%x\n", vaddr_tainted, mode, isStage2, scr, sctlr, flags, tranType); if ((req->isInstFetch() && (!sctlr.i)) || diff --git a/src/arch/generic/memhelpers.hh b/src/arch/generic/memhelpers.hh index b12e7b0b1..f1c1d3322 100644 --- a/src/arch/generic/memhelpers.hh +++ b/src/arch/generic/memhelpers.hh @@ -54,7 +54,7 @@ template Fault initiateMemRead(XC *xc, Trace::InstRecord *traceData, Addr addr, - MemT &mem, unsigned flags) + MemT &mem, Request::Flags flags) { return xc->initiateMemRead(addr, sizeof(MemT), flags); } @@ -73,7 +73,7 @@ getMem(PacketPtr pkt, MemT &mem, Trace::InstRecord *traceData) template Fault readMemAtomic(XC *xc, Trace::InstRecord *traceData, Addr addr, MemT &mem, - unsigned flags) + Request::Flags flags) { memset(&mem, 0, sizeof(mem)); Fault fault = xc->readMem(addr, (uint8_t *)&mem, sizeof(MemT), flags); @@ -89,7 +89,7 @@ readMemAtomic(XC *xc, Trace::InstRecord *traceData, Addr addr, MemT &mem, template Fault writeMemTiming(XC *xc, Trace::InstRecord *traceData, MemT mem, Addr addr, - unsigned flags, uint64_t *res) + Request::Flags flags, uint64_t *res) { if (traceData) { traceData->setData(mem); @@ -102,7 +102,7 @@ writeMemTiming(XC *xc, Trace::InstRecord *traceData, MemT mem, Addr addr, template Fault writeMemAtomic(XC *xc, Trace::InstRecord *traceData, const MemT &mem, - Addr addr, unsigned flags, uint64_t *res) + Addr addr, Request::Flags flags, uint64_t *res) { if (traceData) { traceData->setData(mem); diff --git a/src/arch/x86/memhelpers.hh b/src/arch/x86/memhelpers.hh index b13207ec4..416dfe3c1 100644 --- a/src/arch/x86/memhelpers.hh +++ b/src/arch/x86/memhelpers.hh @@ -45,7 +45,7 @@ namespace X86ISA template Fault initiateMemRead(XC *xc, Trace::InstRecord *traceData, Addr addr, - unsigned dataSize, unsigned flags) + unsigned dataSize, Request::Flags flags) { return xc->initiateMemRead(addr, dataSize, flags); } @@ -100,7 +100,7 @@ getMem(PacketPtr pkt, std::array &mem, unsigned dataSize, template Fault readMemAtomic(XC *xc, Trace::InstRecord *traceData, Addr addr, uint64_t &mem, - unsigned dataSize, unsigned flags) + unsigned dataSize, Request::Flags flags) { memset(&mem, 0, sizeof(mem)); Fault fault = xc->readMem(addr, (uint8_t *)&mem, dataSize, flags); @@ -142,7 +142,8 @@ readMemAtomic(XC *xc, Trace::InstRecord *traceData, Addr addr, template Fault writeMemTiming(XC *xc, Trace::InstRecord *traceData, uint64_t mem, - unsigned dataSize, Addr addr, unsigned flags, uint64_t *res) + unsigned dataSize, Addr addr, Request::Flags flags, + uint64_t *res) { if (traceData) { traceData->setData(mem); @@ -176,7 +177,8 @@ writeMemTiming(XC *xc, Trace::InstRecord *traceData, template Fault writeMemAtomic(XC *xc, Trace::InstRecord *traceData, uint64_t mem, - unsigned dataSize, Addr addr, unsigned flags, uint64_t *res) + unsigned dataSize, Addr addr, Request::Flags flags, + uint64_t *res) { if (traceData) { traceData->setData(mem); diff --git a/src/arch/x86/tlb.cc b/src/arch/x86/tlb.cc index d0e77bc9b..be43cb06e 100644 --- a/src/arch/x86/tlb.cc +++ b/src/arch/x86/tlb.cc @@ -273,7 +273,7 @@ Fault TLB::translate(RequestPtr req, ThreadContext *tc, Translation *translation, Mode mode, bool &delayedResponse, bool timing) { - uint32_t flags = req->getFlags(); + Request::Flags flags = req->getFlags(); int seg = flags & SegmentFlagMask; bool storeCheck = flags & (StoreCheck << FlagShift); diff --git a/src/cpu/base_dyn_inst.hh b/src/cpu/base_dyn_inst.hh index e846f6790..6d9a53253 100644 --- a/src/cpu/base_dyn_inst.hh +++ b/src/cpu/base_dyn_inst.hh @@ -65,6 +65,7 @@ #include "cpu/static_inst.hh" #include "cpu/translation.hh" #include "mem/packet.hh" +#include "mem/request.hh" #include "sim/byteswap.hh" #include "sim/system.hh" @@ -313,10 +314,10 @@ class BaseDynInst : public ExecContext, public RefCounted cpu->demapPage(vaddr, asn); } - Fault initiateMemRead(Addr addr, unsigned size, unsigned flags); + Fault initiateMemRead(Addr addr, unsigned size, Request::Flags flags); - Fault writeMem(uint8_t *data, unsigned size, - Addr addr, unsigned flags, uint64_t *res); + Fault writeMem(uint8_t *data, unsigned size, Addr addr, + Request::Flags flags, uint64_t *res); /** Splits a request in two if it crosses a dcache block. */ void splitRequest(RequestPtr req, RequestPtr &sreqLow, @@ -873,7 +874,8 @@ class BaseDynInst : public ExecContext, public RefCounted template Fault -BaseDynInst::initiateMemRead(Addr addr, unsigned size, unsigned flags) +BaseDynInst::initiateMemRead(Addr addr, unsigned size, + Request::Flags flags) { instFlags[ReqMade] = true; Request *req = NULL; @@ -925,8 +927,8 @@ BaseDynInst::initiateMemRead(Addr addr, unsigned size, unsigned flags) template Fault -BaseDynInst::writeMem(uint8_t *data, unsigned size, - Addr addr, unsigned flags, uint64_t *res) +BaseDynInst::writeMem(uint8_t *data, unsigned size, Addr addr, + Request::Flags flags, uint64_t *res) { if (traceData) traceData->setMem(addr, size, flags); diff --git a/src/cpu/checker/cpu.cc b/src/cpu/checker/cpu.cc index 4d5919cdf..9aae8b812 100644 --- a/src/cpu/checker/cpu.cc +++ b/src/cpu/checker/cpu.cc @@ -139,7 +139,8 @@ CheckerCPU::unserialize(CheckpointIn &cp) } Fault -CheckerCPU::readMem(Addr addr, uint8_t *data, unsigned size, unsigned flags) +CheckerCPU::readMem(Addr addr, uint8_t *data, unsigned size, + Request::Flags flags) { Fault fault = NoFault; int fullSize = size; @@ -225,7 +226,7 @@ CheckerCPU::readMem(Addr addr, uint8_t *data, unsigned size, unsigned flags) Fault CheckerCPU::writeMem(uint8_t *data, unsigned size, - Addr addr, unsigned flags, uint64_t *res) + Addr addr, Request::Flags flags, uint64_t *res) { Fault fault = NoFault; bool checked_flags = false; diff --git a/src/cpu/checker/cpu.hh b/src/cpu/checker/cpu.hh index 93ab9defd..21ff9c7f7 100644 --- a/src/cpu/checker/cpu.hh +++ b/src/cpu/checker/cpu.hh @@ -57,6 +57,7 @@ #include "cpu/simple_thread.hh" #include "cpu/static_inst.hh" #include "debug/Checker.hh" +#include "mem/request.hh" #include "params/CheckerCPU.hh" #include "sim/eventq.hh" @@ -374,9 +375,9 @@ class CheckerCPU : public BaseCPU, public ExecContext } Fault readMem(Addr addr, uint8_t *data, unsigned size, - unsigned flags) override; - Fault writeMem(uint8_t *data, unsigned size, - Addr addr, unsigned flags, uint64_t *res) override; + Request::Flags flags) override; + Fault writeMem(uint8_t *data, unsigned size, Addr addr, + Request::Flags flags, uint64_t *res) override; unsigned int readStCondFailures() const override { return thread->readStCondFailures(); diff --git a/src/cpu/exec_context.hh b/src/cpu/exec_context.hh index 951c9c2b3..dd718b56a 100644 --- a/src/cpu/exec_context.hh +++ b/src/cpu/exec_context.hh @@ -51,6 +51,7 @@ #include "cpu/base.hh" #include "cpu/static_inst_fwd.hh" #include "cpu/translation.hh" +#include "mem/request.hh" /** * The ExecContext is an abstract base class the provides the @@ -182,7 +183,7 @@ class ExecContext { * should never be called). */ virtual Fault readMem(Addr addr, uint8_t *data, unsigned int size, - unsigned int flags) + Request::Flags flags) { panic("ExecContext::readMem() should be overridden\n"); } @@ -195,7 +196,7 @@ class ExecContext { * should never be called). */ virtual Fault initiateMemRead(Addr addr, unsigned int size, - unsigned int flags) + Request::Flags flags) { panic("ExecContext::initiateMemRead() should be overridden\n"); } @@ -205,7 +206,7 @@ class ExecContext { * For timing-mode contexts, initiate a timing memory write operation. */ virtual Fault writeMem(uint8_t *data, unsigned int size, Addr addr, - unsigned int flags, uint64_t *res) = 0; + Request::Flags flags, uint64_t *res) = 0; /** * Sets the number of consecutive store conditional failures. diff --git a/src/cpu/minor/exec_context.hh b/src/cpu/minor/exec_context.hh index a5d646b6c..4a56c01fe 100644 --- a/src/cpu/minor/exec_context.hh +++ b/src/cpu/minor/exec_context.hh @@ -58,6 +58,7 @@ #include "cpu/minor/pipeline.hh" #include "cpu/base.hh" #include "cpu/simple_thread.hh" +#include "mem/request.hh" #include "debug/MinorExecute.hh" namespace Minor @@ -103,7 +104,7 @@ class ExecContext : public ::ExecContext } Fault - initiateMemRead(Addr addr, unsigned int size, unsigned int flags) + initiateMemRead(Addr addr, unsigned int size, Request::Flags flags) { execute.getLSQ().pushRequest(inst, true /* load */, nullptr, size, addr, flags, NULL); @@ -112,7 +113,7 @@ class ExecContext : public ::ExecContext Fault writeMem(uint8_t *data, unsigned int size, Addr addr, - unsigned int flags, uint64_t *res) + Request::Flags flags, uint64_t *res) { execute.getLSQ().pushRequest(inst, false /* store */, data, size, addr, flags, res); diff --git a/src/cpu/minor/lsq.cc b/src/cpu/minor/lsq.cc index 5995a52c2..476f9d474 100644 --- a/src/cpu/minor/lsq.cc +++ b/src/cpu/minor/lsq.cc @@ -1471,7 +1471,8 @@ LSQ::needsToTick() void LSQ::pushRequest(MinorDynInstPtr inst, bool isLoad, uint8_t *data, - unsigned int size, Addr addr, unsigned int flags, uint64_t *res) + unsigned int size, Addr addr, Request::Flags flags, + uint64_t *res) { bool needs_burst = transferNeedsBurst(addr, size, lineWidth); LSQRequestPtr request; diff --git a/src/cpu/minor/lsq.hh b/src/cpu/minor/lsq.hh index e0b72177c..1a9094806 100644 --- a/src/cpu/minor/lsq.hh +++ b/src/cpu/minor/lsq.hh @@ -712,7 +712,8 @@ class LSQ : public Named /** Single interface for readMem/writeMem to issue requests into * the LSQ */ void pushRequest(MinorDynInstPtr inst, bool isLoad, uint8_t *data, - unsigned int size, Addr addr, unsigned int flags, uint64_t *res); + unsigned int size, Addr addr, Request::Flags flags, + uint64_t *res); /** Push a predicate failed-representing request into the queues just * to maintain commit order */ diff --git a/src/cpu/simple/atomic.cc b/src/cpu/simple/atomic.cc index a8e97f14c..8dd81ae0b 100644 --- a/src/cpu/simple/atomic.cc +++ b/src/cpu/simple/atomic.cc @@ -334,8 +334,8 @@ AtomicSimpleCPU::AtomicCPUDPort::recvFunctionalSnoop(PacketPtr pkt) } Fault -AtomicSimpleCPU::readMem(Addr addr, uint8_t * data, - unsigned size, unsigned flags) +AtomicSimpleCPU::readMem(Addr addr, uint8_t * data, unsigned size, + Request::Flags flags) { SimpleExecContext& t_info = *threadInfo[curThread]; SimpleThread* thread = t_info.thread; @@ -422,15 +422,16 @@ AtomicSimpleCPU::readMem(Addr addr, uint8_t * data, } Fault -AtomicSimpleCPU::initiateMemRead(Addr addr, unsigned size, unsigned flags) +AtomicSimpleCPU::initiateMemRead(Addr addr, unsigned size, + Request::Flags flags) { panic("initiateMemRead() is for timing accesses, and should " "never be called on AtomicSimpleCPU.\n"); } Fault -AtomicSimpleCPU::writeMem(uint8_t *data, unsigned size, - Addr addr, unsigned flags, uint64_t *res) +AtomicSimpleCPU::writeMem(uint8_t *data, unsigned size, Addr addr, + Request::Flags flags, uint64_t *res) { SimpleExecContext& t_info = *threadInfo[curThread]; SimpleThread* thread = t_info.thread; diff --git a/src/cpu/simple/atomic.hh b/src/cpu/simple/atomic.hh index 098ecd759..cdc1890de 100644 --- a/src/cpu/simple/atomic.hh +++ b/src/cpu/simple/atomic.hh @@ -45,6 +45,7 @@ #include "cpu/simple/base.hh" #include "cpu/simple/exec_context.hh" +#include "mem/request.hh" #include "params/AtomicSimpleCPU.hh" #include "sim/probe/probe.hh" @@ -202,12 +203,13 @@ class AtomicSimpleCPU : public BaseSimpleCPU void suspendContext(ThreadID thread_num) override; Fault readMem(Addr addr, uint8_t *data, unsigned size, - unsigned flags) override; + Request::Flags flags) override; - Fault initiateMemRead(Addr addr, unsigned size, unsigned flags) override; + Fault initiateMemRead(Addr addr, unsigned size, + Request::Flags flags) override; Fault writeMem(uint8_t *data, unsigned size, - Addr addr, unsigned flags, uint64_t *res) override; + Addr addr, Request::Flags flags, uint64_t *res) override; void regProbePoints() override; diff --git a/src/cpu/simple/base.hh b/src/cpu/simple/base.hh index 9164a2960..15ab2aba4 100644 --- a/src/cpu/simple/base.hh +++ b/src/cpu/simple/base.hh @@ -143,12 +143,13 @@ class BaseSimpleCPU : public BaseCPU void startup() override; virtual Fault readMem(Addr addr, uint8_t* data, unsigned size, - unsigned flags) = 0; + Request::Flags flags) = 0; - virtual Fault initiateMemRead(Addr addr, unsigned size, unsigned flags) = 0; + virtual Fault initiateMemRead(Addr addr, unsigned size, + Request::Flags flags) = 0; virtual Fault writeMem(uint8_t* data, unsigned size, Addr addr, - unsigned flags, uint64_t* res) = 0; + Request::Flags flags, uint64_t* res) = 0; void countInst(); Counter totalInsts() const override; diff --git a/src/cpu/simple/exec_context.hh b/src/cpu/simple/exec_context.hh index f9d80d0d5..430790c09 100644 --- a/src/cpu/simple/exec_context.hh +++ b/src/cpu/simple/exec_context.hh @@ -53,6 +53,7 @@ #include "cpu/simple/base.hh" #include "cpu/static_inst_fwd.hh" #include "cpu/translation.hh" +#include "mem/request.hh" class BaseSimpleCPU; @@ -286,19 +287,19 @@ class SimpleExecContext : public ExecContext { { panic("BaseSimpleCPU::getEA() not implemented\n"); } Fault readMem(Addr addr, uint8_t *data, unsigned int size, - unsigned int flags) override + Request::Flags flags) override { return cpu->readMem(addr, data, size, flags); } Fault initiateMemRead(Addr addr, unsigned int size, - unsigned int flags) override + Request::Flags flags) override { return cpu->initiateMemRead(addr, size, flags); } Fault writeMem(uint8_t *data, unsigned int size, Addr addr, - unsigned int flags, uint64_t *res) override + Request::Flags flags, uint64_t *res) override { return cpu->writeMem(data, size, addr, flags, res); } diff --git a/src/cpu/simple/timing.cc b/src/cpu/simple/timing.cc index 515d6b23c..65fea15ee 100644 --- a/src/cpu/simple/timing.cc +++ b/src/cpu/simple/timing.cc @@ -409,14 +409,15 @@ TimingSimpleCPU::buildSplitPacket(PacketPtr &pkt1, PacketPtr &pkt2, Fault TimingSimpleCPU::readMem(Addr addr, uint8_t *data, - unsigned size, unsigned flags) + unsigned size, Request::Flags flags) { panic("readMem() is for atomic accesses, and should " "never be called on TimingSimpleCPU.\n"); } Fault -TimingSimpleCPU::initiateMemRead(Addr addr, unsigned size, unsigned flags) +TimingSimpleCPU::initiateMemRead(Addr addr, unsigned size, + Request::Flags flags) { SimpleExecContext &t_info = *threadInfo[curThread]; SimpleThread* thread = t_info.thread; @@ -489,7 +490,7 @@ TimingSimpleCPU::handleWritePacket() Fault TimingSimpleCPU::writeMem(uint8_t *data, unsigned size, - Addr addr, unsigned flags, uint64_t *res) + Addr addr, Request::Flags flags, uint64_t *res) { SimpleExecContext &t_info = *threadInfo[curThread]; SimpleThread* thread = t_info.thread; diff --git a/src/cpu/simple/timing.hh b/src/cpu/simple/timing.hh index 035f05158..eebf884ca 100644 --- a/src/cpu/simple/timing.hh +++ b/src/cpu/simple/timing.hh @@ -279,12 +279,13 @@ class TimingSimpleCPU : public BaseSimpleCPU void suspendContext(ThreadID thread_num) override; Fault readMem(Addr addr, uint8_t *data, unsigned size, - unsigned flags) override; + Request::Flags flags) override; - Fault initiateMemRead(Addr addr, unsigned size, unsigned flags) override; + Fault initiateMemRead(Addr addr, unsigned size, + Request::Flags flags) override; Fault writeMem(uint8_t *data, unsigned size, - Addr addr, unsigned flags, uint64_t *res) override; + Addr addr, Request::Flags flags, uint64_t *res) override; void fetch(); void sendFetch(const Fault &fault, RequestPtr req, ThreadContext *tc);