gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
exec_context.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014, 2016-2018 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  * Authors: Kevin Lim
42  * Andreas Sandberg
43  */
44 
45 #ifndef __CPU_EXEC_CONTEXT_HH__
46 #define __CPU_EXEC_CONTEXT_HH__
47 
48 #include "arch/registers.hh"
49 #include "base/types.hh"
50 #include "config/the_isa.hh"
51 #include "cpu/base.hh"
52 #include "cpu/reg_class.hh"
53 #include "cpu/static_inst_fwd.hh"
54 #include "cpu/translation.hh"
55 #include "mem/request.hh"
56 
73 class ExecContext {
74  public:
76 
80 
81  public:
89  virtual RegVal readIntRegOperand(const StaticInst *si, int idx) = 0;
90 
92  virtual void setIntRegOperand(const StaticInst *si,
93  int idx, RegVal val) = 0;
94 
105  virtual RegVal readFloatRegOperandBits(const StaticInst *si, int idx) = 0;
106 
109  virtual void setFloatRegOperandBits(const StaticInst *si,
110  int idx, RegVal val) = 0;
111 
117  virtual const VecRegContainer&
118  readVecRegOperand(const StaticInst *si, int idx) const = 0;
119 
121  virtual VecRegContainer&
122  getWritableVecRegOperand(const StaticInst *si, int idx) = 0;
123 
125  virtual void
126  setVecRegOperand(const StaticInst *si, int idx,
127  const VecRegContainer& val) = 0;
133  virtual ConstVecLane8
134  readVec8BitLaneOperand(const StaticInst *si, int idx) const = 0;
135 
137  virtual ConstVecLane16
138  readVec16BitLaneOperand(const StaticInst *si, int idx) const = 0;
139 
141  virtual ConstVecLane32
142  readVec32BitLaneOperand(const StaticInst *si, int idx) const = 0;
143 
145  virtual ConstVecLane64
146  readVec64BitLaneOperand(const StaticInst *si, int idx) const = 0;
147 
150  virtual void setVecLaneOperand(const StaticInst *si, int idx,
151  const LaneData<LaneSize::Byte>& val) = 0;
152  virtual void setVecLaneOperand(const StaticInst *si, int idx,
153  const LaneData<LaneSize::TwoByte>& val) = 0;
154  virtual void setVecLaneOperand(const StaticInst *si, int idx,
155  const LaneData<LaneSize::FourByte>& val) = 0;
156  virtual void setVecLaneOperand(const StaticInst *si, int idx,
163  virtual VecElem readVecElemOperand(const StaticInst *si,
164  int idx) const = 0;
165 
167  virtual void setVecElemOperand(const StaticInst *si, int idx,
168  const VecElem val) = 0;
174  virtual const VecPredRegContainer&
175  readVecPredRegOperand(const StaticInst *si, int idx) const = 0;
176 
178  virtual VecPredRegContainer&
179  getWritableVecPredRegOperand(const StaticInst *si, int idx) = 0;
180 
182  virtual void
183  setVecPredRegOperand(const StaticInst *si, int idx,
184  const VecPredRegContainer& val) = 0;
191  virtual RegVal readCCRegOperand(const StaticInst *si, int idx) = 0;
192  virtual void setCCRegOperand(
193  const StaticInst *si, int idx, RegVal val) = 0;
200  virtual RegVal readMiscRegOperand(const StaticInst *si, int idx) = 0;
201  virtual void setMiscRegOperand(const StaticInst *si,
202  int idx, RegVal val) = 0;
203 
208  virtual RegVal readMiscReg(int misc_reg) = 0;
209 
214  virtual void setMiscReg(int misc_reg, RegVal val) = 0;
215 
222  virtual PCState pcState() const = 0;
223  virtual void pcState(const PCState &val) = 0;
237  virtual Fault readMem(Addr addr, uint8_t *data, unsigned int size,
238  Request::Flags flags,
239  const std::vector<bool>& byte_enable = std::vector<bool>())
240  {
241  panic("ExecContext::readMem() should be overridden\n");
242  }
243 
251  virtual Fault initiateMemRead(Addr addr, unsigned int size,
252  Request::Flags flags,
253  const std::vector<bool>& byte_enable = std::vector<bool>())
254  {
255  panic("ExecContext::initiateMemRead() should be overridden\n");
256  }
257 
262  virtual Fault writeMem(uint8_t *data, unsigned int size, Addr addr,
263  Request::Flags flags, uint64_t *res,
264  const std::vector<bool>& byte_enable =
265  std::vector<bool>()) = 0;
266 
271  virtual Fault amoMem(Addr addr, uint8_t *data, unsigned int size,
272  Request::Flags flags,
273  AtomicOpFunctorPtr amo_op)
274  {
275  panic("ExecContext::amoMem() should be overridden\n");
276  }
277 
282  virtual Fault initiateMemAMO(Addr addr, unsigned int size,
283  Request::Flags flags,
284  AtomicOpFunctorPtr amo_op)
285  {
286  panic("ExecContext::initiateMemAMO() should be overridden\n");
287  }
288 
292  virtual void setStCondFailures(unsigned int sc_failures) = 0;
293 
297  virtual unsigned int readStCondFailures() const = 0;
298 
309  virtual void syscall(Fault *fault) = 0;
310 
314  virtual ThreadContext *tcBase() = 0;
315 
321  virtual bool readPredicate() const = 0;
322  virtual void setPredicate(bool val) = 0;
323  virtual bool readMemAccPredicate() const = 0;
324  virtual void setMemAccPredicate(bool val) = 0;
325 
336  virtual void demapPage(Addr vaddr, uint64_t asn) = 0;
337  virtual void armMonitor(Addr address) = 0;
338  virtual bool mwait(PacketPtr pkt) = 0;
339  virtual void mwaitAtomic(ThreadContext *tc) = 0;
340  virtual AddressMonitor *getAddrMonitor() = 0;
341 
343 };
344 
345 #endif // __CPU_EXEC_CONTEXT_HH__
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:167
virtual RegVal readFloatRegOperandBits(const StaticInst *si, int idx)=0
Reads a floating point register in its binary format, instead of by value.
virtual void setIntRegOperand(const StaticInst *si, int idx, RegVal val)=0
Sets an integer register to a value.
virtual void setMiscReg(int misc_reg, RegVal val)=0
Sets a miscellaneous register, handling any architectural side effects due to writing that register...
virtual RegVal readIntRegOperand(const StaticInst *si, int idx)=0
Reads an integer register.
virtual void setPredicate(bool val)=0
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) ...
virtual bool readMemAccPredicate() const =0
virtual VecElem readVecElemOperand(const StaticInst *si, int idx) const =0
Vector Elem Interfaces.
virtual ConstVecLane32 readVec32BitLaneOperand(const StaticInst *si, int idx) const =0
Reads source vector 32bit operand.
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.
Vector Register Abstraction This generic class is the model in a particularization of MVC...
Definition: vec_reg.hh:160
virtual VecRegContainer & getWritableVecRegOperand(const StaticInst *si, int idx)=0
Gets destination vector register operand for modification.
Declaration of a request, the overall memory request consisting of the parts of the request that are ...
ip6_addr_t addr
Definition: inet.hh:335
std::unique_ptr< AtomicOpFunctor > AtomicOpFunctorPtr
Definition: amo.hh:230
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.
virtual PCState pcState() const =0
TheISA::PCState PCState
Definition: exec_context.hh:75
virtual ConstVecLane8 readVec8BitLaneOperand(const StaticInst *si, int idx) const =0
Vector Register Lane Interfaces.
uint64_t RegVal
Definition: types.hh:168
virtual void demapPage(Addr vaddr, uint64_t asn)=0
Invalidate a page in the DTLB and ITLB.
virtual void setVecElemOperand(const StaticInst *si, int idx, const VecElem val)=0
Sets a vector register to a value.
ThreadContext is the external interface to all thread state for anything outside of the CPU...
virtual VecPredRegContainer & getWritableVecPredRegOperand(const StaticInst *si, int idx)=0
Gets destination predicate register operand for modification.
virtual RegVal readCCRegOperand(const StaticInst *si, int idx)=0
virtual void setStCondFailures(unsigned int sc_failures)=0
Sets the number of consecutive store conditional failures.
Bitfield< 63 > val
Definition: misc.hh:771
Bitfield< 15, 0 > si
Definition: types.hh:55
virtual bool mwait(PacketPtr pkt)=0
virtual void mwaitAtomic(ThreadContext *tc)=0
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.
LaneSize is an abstraction of a LS byte value for the execution and thread contexts to handle values ...
Definition: vec_reg.hh:457
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
Definition: exec_context.hh:73
::DummyVecPredRegContainer VecPredRegContainer
Definition: registers.hh:60
::DummyVecRegContainer VecRegContainer
Definition: registers.hh:53
virtual const VecRegContainer & readVecRegOperand(const StaticInst *si, int idx) const =0
Vector Register Interfaces.
virtual void armMonitor(Addr address)=0
virtual ConstVecLane16 readVec16BitLaneOperand(const StaticInst *si, int idx) const =0
Reads source vector 16bit operand.
virtual void setCCRegOperand(const StaticInst *si, int idx, RegVal val)=0
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
virtual void setVecLaneOperand(const StaticInst *si, int idx, const LaneData< LaneSize::Byte > &val)=0
Write a lane of the destination vector operand.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:255
virtual RegVal readMiscRegOperand(const StaticInst *si, int idx)=0
virtual unsigned int readStCondFailures() const =0
Returns the number of consecutive store conditional failures.
virtual AddressMonitor * getAddrMonitor()=0
virtual ConstVecLane64 readVec64BitLaneOperand(const StaticInst *si, int idx) const =0
Reads source vector 64bit operand.
virtual void syscall(Fault *fault)=0
Executes a syscall.
GenericISA::SimplePCState< MachInst > PCState
Definition: types.hh:43
Generic predicate register container.
Definition: vec_pred_reg.hh:51
virtual const VecPredRegContainer & readVecPredRegOperand(const StaticInst *si, int idx) const =0
Predicate registers interface.
Base, ISA-independent static instruction class.
Definition: static_inst.hh:83
virtual ThreadContext * tcBase()=0
Returns a pointer to the ThreadContext.
::DummyVecElem VecElem
Definition: registers.hh:50
virtual void setMemAccPredicate(bool val)=0
Vector Lane abstraction Another view of a container.
Definition: vec_reg.hh:262
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.
TheISA::VecElem VecElem
Definition: exec_context.hh:78
const char data[]
std::shared_ptr< FaultBase > Fault
Definition: types.hh:240
virtual RegVal readMiscReg(int misc_reg)=0
Reads a miscellaneous register, handling any architectural side effects due to reading that register...
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) ...
virtual void setVecRegOperand(const StaticInst *si, int idx, const VecRegContainer &val)=0
Sets a destination vector register operand to a value.
virtual void setMiscRegOperand(const StaticInst *si, int idx, RegVal val)=0
virtual void setVecPredRegOperand(const StaticInst *si, int idx, const VecPredRegContainer &val)=0
Sets a destination predicate register operand to a value.
virtual bool readPredicate() const =0

Generated on Fri Feb 28 2020 16:26:59 for gem5 by doxygen 1.8.13