gem5  v21.1.0.2
exec_context.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014, 2016-2018, 2020 ARM Limited
3  * All rights reserved
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Copyright (c) 2002-2005 The Regents of The University of Michigan
15  * Copyright (c) 2015 Advanced Micro Devices, Inc.
16  * All rights reserved.
17  *
18  * Redistribution and use in source and binary forms, with or without
19  * modification, are permitted provided that the following conditions are
20  * met: redistributions of source code must retain the above copyright
21  * notice, this list of conditions and the following disclaimer;
22  * redistributions in binary form must reproduce the above copyright
23  * notice, this list of conditions and the following disclaimer in the
24  * documentation and/or other materials provided with the distribution;
25  * neither the name of the copyright holders nor the names of its
26  * contributors may be used to endorse or promote products derived from
27  * this software without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40  */
41 
42 #ifndef __CPU_EXEC_CONTEXT_HH__
43 #define __CPU_EXEC_CONTEXT_HH__
44 
45 #include "arch/vecregs.hh"
46 #include "base/types.hh"
47 #include "config/the_isa.hh"
48 #include "cpu/base.hh"
49 #include "cpu/reg_class.hh"
50 #include "cpu/static_inst_fwd.hh"
51 #include "cpu/translation.hh"
52 #include "mem/request.hh"
53 
54 namespace gem5
55 {
56 
74 {
75  public:
83  virtual RegVal readIntRegOperand(const StaticInst *si, int idx) = 0;
84 
86  virtual void setIntRegOperand(const StaticInst *si,
87  int idx, RegVal val) = 0;
88 
99  virtual RegVal readFloatRegOperandBits(const StaticInst *si, int idx) = 0;
100 
103  virtual void setFloatRegOperandBits(const StaticInst *si,
104  int idx, RegVal val) = 0;
105 
112  const StaticInst *si, int idx) const = 0;
113 
116  const StaticInst *si, int idx) = 0;
117 
119  virtual void setVecRegOperand(const StaticInst *si, int idx,
120  const TheISA::VecRegContainer& val) = 0;
127  const StaticInst *si, int idx) const = 0;
128 
130  virtual void setVecElemOperand(
131  const StaticInst *si, int idx, const TheISA::VecElem val) = 0;
138  const StaticInst *si, int idx) const = 0;
139 
142  const StaticInst *si, int idx) = 0;
143 
145  virtual void setVecPredRegOperand(
146  const StaticInst *si, int idx,
147  const TheISA::VecPredRegContainer& val) = 0;
154  virtual RegVal readCCRegOperand(const StaticInst *si, int idx) = 0;
155  virtual void setCCRegOperand(
156  const StaticInst *si, int idx, RegVal val) = 0;
163  virtual RegVal readMiscRegOperand(const StaticInst *si, int idx) = 0;
164  virtual void setMiscRegOperand(const StaticInst *si,
165  int idx, RegVal val) = 0;
166 
171  virtual RegVal readMiscReg(int misc_reg) = 0;
172 
177  virtual void setMiscReg(int misc_reg, RegVal val) = 0;
178 
185  virtual TheISA::PCState pcState() const = 0;
186  virtual void pcState(const TheISA::PCState &val) = 0;
200  virtual Fault
201  readMem(Addr addr, uint8_t *data, unsigned int size,
202  Request::Flags flags, const std::vector<bool>& byte_enable)
203  {
204  panic("ExecContext::readMem() should be overridden\n");
205  }
206 
214  virtual Fault
215  initiateMemRead(Addr addr, unsigned int size,
216  Request::Flags flags, const std::vector<bool>& byte_enable)
217  {
218  panic("ExecContext::initiateMemRead() should be overridden\n");
219  }
220 
225  virtual Fault initiateHtmCmd(Request::Flags flags) = 0;
230  virtual Fault writeMem(uint8_t *data, unsigned int size, Addr addr,
231  Request::Flags flags, uint64_t *res,
232  const std::vector<bool>& byte_enable) = 0;
233 
238  virtual Fault
239  amoMem(Addr addr, uint8_t *data, unsigned int size,
240  Request::Flags flags, AtomicOpFunctorPtr amo_op)
241  {
242  panic("ExecContext::amoMem() should be overridden\n");
243  }
244 
249  virtual Fault
250  initiateMemAMO(Addr addr, unsigned int size, Request::Flags flags,
251  AtomicOpFunctorPtr amo_op)
252  {
253  panic("ExecContext::initiateMemAMO() should be overridden\n");
254  }
255 
259  virtual void setStCondFailures(unsigned int sc_failures) = 0;
260 
264  virtual unsigned int readStCondFailures() const = 0;
265 
269  virtual ThreadContext *tcBase() const = 0;
270 
276  virtual bool readPredicate() const = 0;
277  virtual void setPredicate(bool val) = 0;
278  virtual bool readMemAccPredicate() const = 0;
279  virtual void setMemAccPredicate(bool val) = 0;
280 
281  // hardware transactional memory
282  virtual uint64_t newHtmTransactionUid() const = 0;
283  virtual uint64_t getHtmTransactionUid() const = 0;
284  virtual bool inHtmTransactionalState() const = 0;
285  virtual uint64_t getHtmTransactionalDepth() const = 0;
286 
297  virtual void demapPage(Addr vaddr, uint64_t asn) = 0;
298  virtual void armMonitor(Addr address) = 0;
299  virtual bool mwait(PacketPtr pkt) = 0;
300  virtual void mwaitAtomic(ThreadContext *tc) = 0;
301  virtual AddressMonitor *getAddrMonitor() = 0;
302 
304 };
305 
306 } // namespace gem5
307 
308 #endif // __CPU_EXEC_CONTEXT_HH__
gem5::ExecContext::setStCondFailures
virtual void setStCondFailures(unsigned int sc_failures)=0
Sets the number of consecutive store conditional failures.
gem5::RegVal
uint64_t RegVal
Definition: types.hh:173
gem5::ExecContext::setMemAccPredicate
virtual void setMemAccPredicate(bool val)=0
gem5::ExecContext::setMiscReg
virtual void setMiscReg(int misc_reg, RegVal val)=0
Sets a miscellaneous register, handling any architectural side effects due to writing that register.
gem5::ArmISA::VecPredRegContainer
VecPredReg::Container VecPredRegContainer
Definition: vec.hh:68
data
const char data[]
Definition: circlebuf.test.cc:48
gem5::ExecContext::readIntRegOperand
virtual RegVal readIntRegOperand(const StaticInst *si, int idx)=0
Reads an integer register.
gem5::ExecContext::readStCondFailures
virtual unsigned int readStCondFailures() const =0
Returns the number of consecutive store conditional failures.
gem5::ExecContext::setCCRegOperand
virtual void setCCRegOperand(const StaticInst *si, int idx, RegVal val)=0
gem5::X86ISA::val
Bitfield< 63 > val
Definition: misc.hh:775
gem5::ExecContext::inHtmTransactionalState
virtual bool inHtmTransactionalState() const =0
std::vector< bool >
gem5::ExecContext::getWritableVecRegOperand
virtual TheISA::VecRegContainer & getWritableVecRegOperand(const StaticInst *si, int idx)=0
Gets destination vector register operand for modification.
gem5::ExecContext::readMiscReg
virtual RegVal readMiscReg(int misc_reg)=0
Reads a miscellaneous register, handling any architectural side effects due to reading that register.
gem5::ExecContext::getAddrMonitor
virtual AddressMonitor * getAddrMonitor()=0
gem5::ExecContext::mwaitAtomic
virtual void mwaitAtomic(ThreadContext *tc)=0
request.hh
gem5::ExecContext::setIntRegOperand
virtual void setIntRegOperand(const StaticInst *si, int idx, RegVal val)=0
Sets an integer register to a value.
gem5::AddressMonitor
Definition: base.hh:73
gem5::ExecContext::readPredicate
virtual bool readPredicate() const =0
gem5::Flags< FlagsType >
translation.hh
gem5::StaticInst
Base, ISA-independent static instruction class.
Definition: static_inst.hh:88
gem5::ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:93
gem5::Fault
std::shared_ptr< FaultBase > Fault
Definition: types.hh:255
gem5::ExecContext::setVecRegOperand
virtual void setVecRegOperand(const StaticInst *si, int idx, const TheISA::VecRegContainer &val)=0
Sets a destination vector register operand to a value.
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:283
gem5::MipsISA::PCState
GenericISA::DelaySlotPCState< 4 > PCState
Definition: pcstate.hh:40
gem5::ExecContext::writeMem
virtual Fault writeMem(uint8_t *data, unsigned int size, Addr addr, Request::Flags flags, uint64_t *res, const std::vector< bool > &byte_enable)=0
For atomic-mode contexts, perform an atomic memory write operation.
gem5::ExecContext::setVecPredRegOperand
virtual void setVecPredRegOperand(const StaticInst *si, int idx, const TheISA::VecPredRegContainer &val)=0
Sets a destination predicate register operand to a value.
gem5::ExecContext::pcState
virtual TheISA::PCState pcState() const =0
gem5::ExecContext::demapPage
virtual void demapPage(Addr vaddr, uint64_t asn)=0
Invalidate a page in the DTLB and ITLB.
gem5::ExecContext::tcBase
virtual ThreadContext * tcBase() const =0
Returns a pointer to the ThreadContext.
gem5::ExecContext::initiateMemRead
virtual Fault initiateMemRead(Addr addr, unsigned int size, Request::Flags flags, const std::vector< bool > &byte_enable)
Initiate a timing memory read operation.
Definition: exec_context.hh:215
gem5::ArmISA::VecRegContainer
gem5::VecRegContainer< NumVecElemPerVecReg *sizeof(VecElem)> VecRegContainer
Definition: vec.hh:62
gem5::ExecContext::readMemAccPredicate
virtual bool readMemAccPredicate() const =0
gem5::ExecContext::getHtmTransactionUid
virtual uint64_t getHtmTransactionUid() const =0
gem5::ArmISA::si
Bitfield< 6 > si
Definition: misc_types.hh:772
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::ExecContext::initiateHtmCmd
virtual Fault initiateHtmCmd(Request::Flags flags)=0
Initiate an HTM command, e.g.
gem5::ExecContext::setMiscRegOperand
virtual void setMiscRegOperand(const StaticInst *si, int idx, RegVal val)=0
gem5::ExecContext::setVecElemOperand
virtual void setVecElemOperand(const StaticInst *si, int idx, const TheISA::VecElem val)=0
Sets a vector register to a value.
gem5::ExecContext::readMem
virtual Fault readMem(Addr addr, uint8_t *data, unsigned int size, Request::Flags flags, const std::vector< bool > &byte_enable)
Perform an atomic memory read operation.
Definition: exec_context.hh:201
gem5::ExecContext::newHtmTransactionUid
virtual uint64_t newHtmTransactionUid() const =0
gem5::ExecContext::readVecPredRegOperand
virtual const TheISA::VecPredRegContainer & readVecPredRegOperand(const StaticInst *si, int idx) const =0
Predicate registers interface.
base.hh
gem5::ArmISA::VecElem
uint32_t VecElem
Definition: vec.hh:60
types.hh
static_inst_fwd.hh
gem5::ExecContext::readMiscRegOperand
virtual RegVal readMiscRegOperand(const StaticInst *si, int idx)=0
reg_class.hh
gem5::ExecContext::getWritableVecPredRegOperand
virtual TheISA::VecPredRegContainer & getWritableVecPredRegOperand(const StaticInst *si, int idx)=0
Gets destination predicate register operand for modification.
gem5::ExecContext
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
Definition: exec_context.hh:73
gem5::ExecContext::setFloatRegOperandBits
virtual void setFloatRegOperandBits(const StaticInst *si, int idx, RegVal val)=0
Sets the bits of a floating point register of single width to a binary value.
gem5::MipsISA::vaddr
vaddr
Definition: pra_constants.hh:278
gem5::ExecContext::initiateMemAMO
virtual Fault initiateMemAMO(Addr addr, unsigned int size, Request::Flags flags, AtomicOpFunctorPtr amo_op)
For timing-mode contexts, initiate an atomic AMO (atomic read-modify-write memory operation)
Definition: exec_context.hh:250
gem5::ExecContext::readCCRegOperand
virtual RegVal readCCRegOperand(const StaticInst *si, int idx)=0
gem5::AtomicOpFunctorPtr
std::unique_ptr< AtomicOpFunctor > AtomicOpFunctorPtr
Definition: amo.hh:242
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::ExecContext::armMonitor
virtual void armMonitor(Addr address)=0
gem5::ExecContext::readVecElemOperand
virtual TheISA::VecElem readVecElemOperand(const StaticInst *si, int idx) const =0
Vector Elem Interfaces.
gem5::ExecContext::getHtmTransactionalDepth
virtual uint64_t getHtmTransactionalDepth() const =0
gem5::ExecContext::setPredicate
virtual void setPredicate(bool val)=0
gem5::ExecContext::amoMem
virtual Fault amoMem(Addr addr, uint8_t *data, unsigned int size, Request::Flags flags, AtomicOpFunctorPtr amo_op)
For atomic-mode contexts, perform an atomic AMO (a.k.a., Atomic Read-Modify-Write Memory Operation)
Definition: exec_context.hh:239
gem5::ExecContext::readVecRegOperand
virtual const TheISA::VecRegContainer & readVecRegOperand(const StaticInst *si, int idx) const =0
Vector Register Interfaces.
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:177
gem5::X86ISA::addr
Bitfield< 3 > addr
Definition: types.hh:84
gem5::ExecContext::mwait
virtual bool mwait(PacketPtr pkt)=0
gem5::ExecContext::readFloatRegOperandBits
virtual RegVal readFloatRegOperandBits(const StaticInst *si, int idx)=0
Reads a floating point register in its binary format, instead of by value.

Generated on Tue Sep 21 2021 12:25:00 for gem5 by doxygen 1.8.17