gem5  v20.1.0.0
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/registers.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 
70 class ExecContext {
71  public:
73 
77 
78  public:
86  virtual RegVal readIntRegOperand(const StaticInst *si, int idx) = 0;
87 
89  virtual void setIntRegOperand(const StaticInst *si,
90  int idx, RegVal val) = 0;
91 
102  virtual RegVal readFloatRegOperandBits(const StaticInst *si, int idx) = 0;
103 
106  virtual void setFloatRegOperandBits(const StaticInst *si,
107  int idx, RegVal val) = 0;
108 
114  virtual const VecRegContainer&
115  readVecRegOperand(const StaticInst *si, int idx) const = 0;
116 
118  virtual VecRegContainer&
119  getWritableVecRegOperand(const StaticInst *si, int idx) = 0;
120 
122  virtual void
123  setVecRegOperand(const StaticInst *si, int idx,
124  const VecRegContainer& val) = 0;
130  virtual ConstVecLane8
131  readVec8BitLaneOperand(const StaticInst *si, int idx) const = 0;
132 
134  virtual ConstVecLane16
135  readVec16BitLaneOperand(const StaticInst *si, int idx) const = 0;
136 
138  virtual ConstVecLane32
139  readVec32BitLaneOperand(const StaticInst *si, int idx) const = 0;
140 
142  virtual ConstVecLane64
143  readVec64BitLaneOperand(const StaticInst *si, int idx) const = 0;
144 
147  virtual void setVecLaneOperand(const StaticInst *si, int idx,
148  const LaneData<LaneSize::Byte>& val) = 0;
149  virtual void setVecLaneOperand(const StaticInst *si, int idx,
150  const LaneData<LaneSize::TwoByte>& val) = 0;
151  virtual void setVecLaneOperand(const StaticInst *si, int idx,
152  const LaneData<LaneSize::FourByte>& val) = 0;
153  virtual void setVecLaneOperand(const StaticInst *si, int idx,
160  virtual VecElem readVecElemOperand(const StaticInst *si,
161  int idx) const = 0;
162 
164  virtual void setVecElemOperand(const StaticInst *si, int idx,
165  const VecElem val) = 0;
171  virtual const VecPredRegContainer&
172  readVecPredRegOperand(const StaticInst *si, int idx) const = 0;
173 
175  virtual VecPredRegContainer&
176  getWritableVecPredRegOperand(const StaticInst *si, int idx) = 0;
177 
179  virtual void
180  setVecPredRegOperand(const StaticInst *si, int idx,
181  const VecPredRegContainer& val) = 0;
188  virtual RegVal readCCRegOperand(const StaticInst *si, int idx) = 0;
189  virtual void setCCRegOperand(
190  const StaticInst *si, int idx, RegVal val) = 0;
197  virtual RegVal readMiscRegOperand(const StaticInst *si, int idx) = 0;
198  virtual void setMiscRegOperand(const StaticInst *si,
199  int idx, RegVal val) = 0;
200 
205  virtual RegVal readMiscReg(int misc_reg) = 0;
206 
211  virtual void setMiscReg(int misc_reg, RegVal val) = 0;
212 
219  virtual PCState pcState() const = 0;
220  virtual void pcState(const PCState &val) = 0;
234  virtual Fault readMem(Addr addr, uint8_t *data, unsigned int size,
235  Request::Flags flags,
236  const std::vector<bool>& byte_enable = std::vector<bool>())
237  {
238  panic("ExecContext::readMem() should be overridden\n");
239  }
240 
248  virtual Fault initiateMemRead(Addr addr, unsigned int size,
249  Request::Flags flags,
250  const std::vector<bool>& byte_enable = std::vector<bool>())
251  {
252  panic("ExecContext::initiateMemRead() should be overridden\n");
253  }
254 
259  virtual Fault initiateHtmCmd(Request::Flags flags) = 0;
264  virtual Fault writeMem(uint8_t *data, unsigned int size, Addr addr,
265  Request::Flags flags, uint64_t *res,
266  const std::vector<bool>& byte_enable =
267  std::vector<bool>()) = 0;
268 
273  virtual Fault amoMem(Addr addr, uint8_t *data, unsigned int size,
274  Request::Flags flags,
275  AtomicOpFunctorPtr amo_op)
276  {
277  panic("ExecContext::amoMem() should be overridden\n");
278  }
279 
284  virtual Fault initiateMemAMO(Addr addr, unsigned int size,
285  Request::Flags flags,
286  AtomicOpFunctorPtr amo_op)
287  {
288  panic("ExecContext::initiateMemAMO() should be overridden\n");
289  }
290 
294  virtual void setStCondFailures(unsigned int sc_failures) = 0;
295 
299  virtual unsigned int readStCondFailures() const = 0;
300 
311  virtual void syscall() = 0;
312 
316  virtual ThreadContext *tcBase() const = 0;
317 
323  virtual bool readPredicate() const = 0;
324  virtual void setPredicate(bool val) = 0;
325  virtual bool readMemAccPredicate() const = 0;
326  virtual void setMemAccPredicate(bool val) = 0;
327 
328  // hardware transactional memory
329  virtual uint64_t newHtmTransactionUid() const = 0;
330  virtual uint64_t getHtmTransactionUid() const = 0;
331  virtual bool inHtmTransactionalState() const = 0;
332  virtual uint64_t getHtmTransactionalDepth() const = 0;
333 
344  virtual void demapPage(Addr vaddr, uint64_t asn) = 0;
345  virtual void armMonitor(Addr address) = 0;
346  virtual bool mwait(PacketPtr pkt) = 0;
347  virtual void mwaitAtomic(ThreadContext *tc) = 0;
348  virtual AddressMonitor *getAddrMonitor() = 0;
349 
351 };
352 
353 #endif // __CPU_EXEC_CONTEXT_HH__
ExecContext::setPredicate
virtual void setPredicate(bool val)=0
AtomicOpFunctorPtr
std::unique_ptr< AtomicOpFunctor > AtomicOpFunctorPtr
Definition: amo.hh:239
ExecContext::initiateMemRead
virtual Fault initiateMemRead(Addr addr, unsigned int size, Request::Flags flags, const std::vector< bool > &byte_enable=std::vector< bool >())
Initiate a timing memory read operation.
Definition: exec_context.hh:248
ExecContext::readVec8BitLaneOperand
virtual ConstVecLane8 readVec8BitLaneOperand(const StaticInst *si, int idx) const =0
Vector Register Lane Interfaces.
ExecContext::newHtmTransactionUid
virtual uint64_t newHtmTransactionUid() const =0
VecPredRegContainer
Generic predicate register container.
Definition: vec_pred_reg.hh:47
data
const char data[]
Definition: circlebuf.test.cc:42
ExecContext::readIntRegOperand
virtual RegVal readIntRegOperand(const StaticInst *si, int idx)=0
Reads an integer register.
ArmISA::VecRegContainer
VecReg::Container VecRegContainer
Definition: registers.hh:71
ExecContext::getWritableVecRegOperand
virtual VecRegContainer & getWritableVecRegOperand(const StaticInst *si, int idx)=0
Gets destination vector register operand for modification.
ExecContext::demapPage
virtual void demapPage(Addr vaddr, uint64_t asn)=0
Invalidate a page in the DTLB and ITLB.
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:273
StaticInst
Base, ISA-independent static instruction class.
Definition: static_inst.hh:85
ExecContext::setMiscRegOperand
virtual void setMiscRegOperand(const StaticInst *si, int idx, RegVal val)=0
Flags< FlagsType >
ExecContext::readVecElemOperand
virtual VecElem readVecElemOperand(const StaticInst *si, int idx) const =0
Vector Elem Interfaces.
ExecContext::readVec32BitLaneOperand
virtual ConstVecLane32 readVec32BitLaneOperand(const StaticInst *si, int idx) const =0
Reads source vector 32bit operand.
ArmISA::si
Bitfield< 6 > si
Definition: miscregs_types.hh:766
ExecContext::inHtmTransactionalState
virtual bool inHtmTransactionalState() const =0
ExecContext::mwait
virtual bool mwait(PacketPtr pkt)=0
ArmISA::VecPredRegContainer
VecPredReg::Container VecPredRegContainer
Definition: registers.hh:77
std::vector< bool >
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.
ExecContext::setStCondFailures
virtual void setStCondFailures(unsigned int sc_failures)=0
Sets the number of consecutive store conditional failures.
request.hh
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=std::vector< bool >())=0
For atomic-mode contexts, perform an atomic memory write operation.
AddressMonitor
Definition: base.hh:70
ExecContext::setVecElemOperand
virtual void setVecElemOperand(const StaticInst *si, int idx, const VecElem val)=0
Sets a vector register to a value.
ExecContext::pcState
virtual PCState pcState() const =0
ExecContext::readCCRegOperand
virtual RegVal readCCRegOperand(const StaticInst *si, int idx)=0
ExecContext::PCState
TheISA::PCState PCState
Definition: exec_context.hh:72
ExecContext::getWritableVecPredRegOperand
virtual VecPredRegContainer & getWritableVecPredRegOperand(const StaticInst *si, int idx)=0
Gets destination predicate register operand for modification.
ExecContext::armMonitor
virtual void armMonitor(Addr address)=0
ArmISA::VecElem
uint32_t VecElem
Definition: registers.hh:68
ExecContext::setCCRegOperand
virtual void setCCRegOperand(const StaticInst *si, int idx, RegVal val)=0
ExecContext::mwaitAtomic
virtual void mwaitAtomic(ThreadContext *tc)=0
ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:88
ExecContext::readVecRegOperand
virtual const VecRegContainer & readVecRegOperand(const StaticInst *si, int idx) const =0
Vector Register Interfaces.
translation.hh
VecLaneT
Vector Lane abstraction Another view of a container.
Definition: vec_reg.hh:262
ExecContext::setVecLaneOperand
virtual void setVecLaneOperand(const StaticInst *si, int idx, const LaneData< LaneSize::Byte > &val)=0
Write a lane of the destination vector operand.
Fault
std::shared_ptr< FaultBase > Fault
Definition: types.hh:240
MipsISA::vaddr
vaddr
Definition: pra_constants.hh:275
ExecContext
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
Definition: exec_context.hh:70
ExecContext::syscall
virtual void syscall()=0
Executes a syscall.
X86ISA::val
Bitfield< 63 > val
Definition: misc.hh:769
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
ExecContext::getAddrMonitor
virtual AddressMonitor * getAddrMonitor()=0
ExecContext::readMiscRegOperand
virtual RegVal readMiscRegOperand(const StaticInst *si, int idx)=0
ExecContext::readVec16BitLaneOperand
virtual ConstVecLane16 readVec16BitLaneOperand(const StaticInst *si, int idx) const =0
Reads source vector 16bit operand.
ExecContext::tcBase
virtual ThreadContext * tcBase() const =0
Returns a pointer to the ThreadContext.
ExecContext::readStCondFailures
virtual unsigned int readStCondFailures() const =0
Returns the number of consecutive store conditional failures.
ExecContext::setMemAccPredicate
virtual void setMemAccPredicate(bool val)=0
base.hh
MipsISA::PCState
GenericISA::DelaySlotPCState< MachInst > PCState
Definition: types.hh:41
types.hh
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
ExecContext::readMiscReg
virtual RegVal readMiscReg(int misc_reg)=0
Reads a miscellaneous register, handling any architectural side effects due to reading that register.
static_inst_fwd.hh
addr
ip6_addr_t addr
Definition: inet.hh:423
reg_class.hh
ExecContext::setVecRegOperand
virtual void setVecRegOperand(const StaticInst *si, int idx, const VecRegContainer &val)=0
Sets a destination vector register operand to a value.
ExecContext::getHtmTransactionUid
virtual uint64_t getHtmTransactionUid() const =0
ExecContext::getHtmTransactionalDepth
virtual uint64_t getHtmTransactionalDepth() const =0
ExecContext::readVecPredRegOperand
virtual const VecPredRegContainer & readVecPredRegOperand(const StaticInst *si, int idx) const =0
Predicate registers interface.
ExecContext::setVecPredRegOperand
virtual void setVecPredRegOperand(const StaticInst *si, int idx, const VecPredRegContainer &val)=0
Sets a destination predicate register operand to a value.
ExecContext::readPredicate
virtual bool readPredicate() const =0
ExecContext::readFloatRegOperandBits
virtual RegVal readFloatRegOperandBits(const StaticInst *si, int idx)=0
Reads a floating point register in its binary format, instead of by value.
ExecContext::VecElem
TheISA::VecElem VecElem
Definition: exec_context.hh:75
ExecContext::setIntRegOperand
virtual void setIntRegOperand(const StaticInst *si, int idx, RegVal val)=0
Sets an integer register to a value.
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:284
ExecContext::readVec64BitLaneOperand
virtual ConstVecLane64 readVec64BitLaneOperand(const StaticInst *si, int idx) const =0
Reads source vector 64bit operand.
ExecContext::readMemAccPredicate
virtual bool readMemAccPredicate() const =0
LaneData
LaneSize is an abstraction of a LS byte value for the execution and thread contexts to handle values ...
Definition: vec_reg.hh:458
ExecContext::readMem
virtual Fault readMem(Addr addr, uint8_t *data, unsigned int size, Request::Flags flags, const std::vector< bool > &byte_enable=std::vector< bool >())
Perform an atomic memory read operation.
Definition: exec_context.hh:234
RegVal
uint64_t RegVal
Definition: types.hh:168
VecRegContainer
Vector Register Abstraction This generic class is the model in a particularization of MVC,...
Definition: vec_reg.hh:156
ExecContext::initiateHtmCmd
virtual Fault initiateHtmCmd(Request::Flags flags)=0
Initiate an HTM command, e.g.
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:171
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.

Generated on Wed Sep 30 2020 14:02:08 for gem5 by doxygen 1.8.17