gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
exec_context.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 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/static_inst_fwd.hh"
53 #include "cpu/translation.hh"
54 #include "mem/request.hh"
55 
72 class ExecContext {
73  public:
79 
81 
82  public:
90  virtual IntReg readIntRegOperand(const StaticInst *si, int idx) = 0;
91 
93  virtual void setIntRegOperand(const StaticInst *si,
94  int idx, IntReg val) = 0;
95 
105  virtual FloatReg readFloatRegOperand(const StaticInst *si, int idx) = 0;
106 
110  int idx) = 0;
111 
113  virtual void setFloatRegOperand(const StaticInst *si,
114  int idx, FloatReg val) = 0;
115 
118  virtual void setFloatRegOperandBits(const StaticInst *si,
119  int idx, FloatRegBits val) = 0;
120 
127  virtual CCReg readCCRegOperand(const StaticInst *si, int idx) = 0;
128  virtual void setCCRegOperand(const StaticInst *si, int idx, CCReg val) = 0;
135  virtual MiscReg readMiscRegOperand(const StaticInst *si, int idx) = 0;
136  virtual void setMiscRegOperand(const StaticInst *si,
137  int idx, const MiscReg &val) = 0;
138 
143  virtual MiscReg readMiscReg(int misc_reg) = 0;
144 
149  virtual void setMiscReg(int misc_reg, const MiscReg &val) = 0;
150 
157  virtual PCState pcState() const = 0;
158  virtual void pcState(const PCState &val) = 0;
170  virtual void setEA(Addr EA) = 0;
176  virtual Addr getEA() const = 0;
177 
185  virtual Fault readMem(Addr addr, uint8_t *data, unsigned int size,
186  Request::Flags flags)
187  {
188  panic("ExecContext::readMem() should be overridden\n");
189  }
190 
198  virtual Fault initiateMemRead(Addr addr, unsigned int size,
199  Request::Flags flags)
200  {
201  panic("ExecContext::initiateMemRead() should be overridden\n");
202  }
203 
208  virtual Fault writeMem(uint8_t *data, unsigned int size, Addr addr,
209  Request::Flags flags, uint64_t *res) = 0;
210 
214  virtual void setStCondFailures(unsigned int sc_failures) = 0;
215 
219  virtual unsigned int readStCondFailures() const = 0;
220 
231  virtual void syscall(int64_t callnum, Fault *fault) = 0;
232 
236  virtual ThreadContext *tcBase() = 0;
237 
247  virtual Fault hwrei() = 0;
248 
253  virtual bool simPalCheck(int palFunc) = 0;
254 
262  virtual bool readPredicate() = 0;
263  virtual void setPredicate(bool val) = 0;
264 
275  virtual void demapPage(Addr vaddr, uint64_t asn) = 0;
276  virtual void armMonitor(Addr address) = 0;
277  virtual bool mwait(PacketPtr pkt) = 0;
278  virtual void mwaitAtomic(ThreadContext *tc) = 0;
279  virtual AddressMonitor *getAddrMonitor() = 0;
280 
288 #if THE_ISA == MIPS_ISA
289  virtual MiscReg readRegOtherThread(int regIdx,
290  ThreadID tid = InvalidThreadID) = 0;
291  virtual void setRegOtherThread(int regIdx, MiscReg val,
292  ThreadID tid = InvalidThreadID) = 0;
293 #endif
294 
296 };
297 
298 #endif // __CPU_EXEC_CONTEXT_HH__
virtual MiscReg readRegOtherThread(int regIdx, ThreadID tid=InvalidThreadID)=0
uint8_t CCReg
Definition: registers.hh:57
virtual void setPredicate(bool val)=0
virtual Addr getEA() const =0
Get the effective address of the instruction.
virtual FloatRegBits readFloatRegOperandBits(const StaticInst *si, int idx)=0
Reads a floating point register in its binary format, instead of by value.
#define panic(...)
Definition: misc.hh:153
virtual MiscReg readMiscReg(int misc_reg)=0
Reads a miscellaneous register, handling any architectural side effects due to reading that register...
Declaration of a request, the overall memory request consisting of the parts of the request that are ...
virtual void setFloatRegOperandBits(const StaticInst *si, int idx, FloatRegBits val)=0
Sets the bits of a floating point register of single width to a binary value.
ip6_addr_t addr
Definition: inet.hh:335
virtual MiscReg readMiscRegOperand(const StaticInst *si, int idx)=0
virtual PCState pcState() const =0
TheISA::PCState PCState
Definition: exec_context.hh:75
uint64_t MiscReg
Definition: registers.hh:54
virtual Fault readMem(Addr addr, uint8_t *data, unsigned int size, Request::Flags flags)
Perform an atomic memory read operation.
TheISA::IntReg IntReg
Definition: exec_context.hh:74
virtual bool simPalCheck(int palFunc)=0
Check for special simulator handling of specific PAL calls.
virtual void demapPage(Addr vaddr, uint64_t asn)=0
Invalidate a page in the DTLB and ITLB.
ThreadContext is the external interface to all thread state for anything outside of the CPU...
TheISA::CCReg CCReg
Definition: exec_context.hh:80
virtual void setStCondFailures(unsigned int sc_failures)=0
Sets the number of consecutive store conditional failures.
Bitfield< 63 > val
Definition: misc.hh:770
const char data[]
Definition: circlebuf.cc:43
Bitfield< 15, 0 > si
Definition: types.hh:55
virtual bool mwait(PacketPtr pkt)=0
virtual IntReg readIntRegOperand(const StaticInst *si, int idx)=0
Reads an integer register.
virtual void mwaitAtomic(ThreadContext *tc)=0
TheISA::FloatReg FloatReg
Definition: exec_context.hh:76
virtual Fault hwrei()=0
Somewhat Alpha-specific function that handles returning from an error or interrupt.
virtual void syscall(int64_t callnum, Fault *fault)=0
Executes a syscall specified by the callnum.
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
Definition: exec_context.hh:72
virtual void setMiscRegOperand(const StaticInst *si, int idx, const MiscReg &val)=0
uint64_t FloatRegBits
Definition: registers.hh:51
TheISA::FloatRegBits FloatRegBits
Definition: exec_context.hh:77
virtual void setFloatRegOperand(const StaticInst *si, int idx, FloatReg val)=0
Sets a floating point register of single width to a value.
virtual void armMonitor(Addr address)=0
double FloatReg
Definition: registers.hh:50
virtual Fault writeMem(uint8_t *data, unsigned int size, Addr addr, Request::Flags flags, uint64_t *res)=0
For atomic-mode contexts, perform an atomic memory write operation.
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 FloatReg readFloatRegOperand(const StaticInst *si, int idx)=0
Reads a floating point register of single register width.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:245
virtual void setIntRegOperand(const StaticInst *si, int idx, IntReg val)=0
Sets an integer register to a value.
const ThreadID InvalidThreadID
Definition: types.hh:172
uint64_t IntReg
Definition: registers.hh:47
virtual CCReg readCCRegOperand(const StaticInst *si, int idx)=0
virtual unsigned int readStCondFailures() const =0
Returns the number of consecutive store conditional failures.
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:171
int size()
Definition: pagetable.hh:146
virtual AddressMonitor * getAddrMonitor()=0
virtual Fault initiateMemRead(Addr addr, unsigned int size, Request::Flags flags)
Initiate a timing memory read operation.
GenericISA::SimplePCState< MachInst > PCState
Definition: types.hh:43
virtual void setEA(Addr EA)=0
Record the effective address of the instruction.
virtual void setRegOtherThread(int regIdx, MiscReg val, ThreadID tid=InvalidThreadID)=0
Base, ISA-independent static instruction class.
Definition: static_inst.hh:68
virtual ThreadContext * tcBase()=0
Returns a pointer to the ThreadContext.
virtual bool readPredicate()=0
TheISA::MiscReg MiscReg
Definition: exec_context.hh:78
std::shared_ptr< FaultBase > Fault
Definition: types.hh:184
virtual void setCCRegOperand(const StaticInst *si, int idx, CCReg val)=0
virtual void setMiscReg(int misc_reg, const MiscReg &val)=0
Sets a miscellaneous register, handling any architectural side effects due to writing that register...

Generated on Fri Jun 9 2017 13:03:42 for gem5 by doxygen 1.8.6