gem5  v20.1.0.0
mem64.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2013,2017-2019 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  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are
16  * met: redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer;
18  * redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution;
21  * neither the name of the copyright holders nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #ifndef __ARCH_ARM_MEM64_HH__
39 #define __ARCH_ARM_MEM64_HH__
40 
41 #include "arch/arm/insts/misc64.hh"
43 
44 namespace ArmISA
45 {
46 
47 class SysDC64 : public MiscRegOp64
48 {
49  protected:
52  uint64_t imm;
53 
54  // This is used for fault handling only
55  mutable Addr faultAddr;
56 
57  SysDC64(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
58  IntRegIndex _base, MiscRegIndex _dest, uint64_t _imm)
59  : MiscRegOp64(mnem, _machInst, __opClass, false),
60  base(_base), dest(_dest), imm(_imm), faultAddr(0)
61  {}
62 
63  std::string generateDisassembly(
64  Addr pc, const Loader::SymbolTable *symtab) const override;
65 };
66 
68 {
69  protected:
70  MightBeMicro64(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
71  : ArmStaticInst(mnem, _machInst, __opClass)
72  {}
73 
74  void
75  advancePC(PCState &pcState) const override
76  {
77  if (flags[IsLastMicroop]) {
78  pcState.uEnd();
79  } else if (flags[IsMicroop]) {
80  pcState.uAdvance();
81  } else {
82  pcState.advance();
83  }
84  }
85 };
86 
87 class Memory64 : public MightBeMicro64
88 {
89  public:
90  enum AddrMode {
94  };
95 
96  protected:
97 
101  bool baseIsSP;
102  static const unsigned numMicroops = 3;
103 
105 
106  Memory64(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
107  IntRegIndex _dest, IntRegIndex _base)
108  : MightBeMicro64(mnem, _machInst, __opClass),
109  dest(_dest), base(_base), uops(NULL), memAccessFlags(0)
110  {
111  baseIsSP = isSP(_base);
112  }
113 
114  virtual
116  {
117  delete [] uops;
118  }
119 
121  fetchMicroop(MicroPC microPC) const override
122  {
123  assert(uops != NULL && microPC < numMicroops);
124  return uops[microPC];
125  }
126 
127  void startDisassembly(std::ostream &os) const;
128 
129  unsigned memAccessFlags;
130 
131  void setExcAcRel(bool exclusive, bool acrel);
132 };
133 
134 class MemoryImm64 : public Memory64
135 {
136  protected:
137  int64_t imm;
138 
139  MemoryImm64(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
140  IntRegIndex _dest, IntRegIndex _base, int64_t _imm)
141  : Memory64(mnem, _machInst, __opClass, _dest, _base), imm(_imm)
142  {}
143 
144  std::string generateDisassembly(
145  Addr pc, const Loader::SymbolTable *symtab) const override;
146 };
147 
148 class MemoryDImm64 : public MemoryImm64
149 {
150  protected:
152 
153  MemoryDImm64(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
154  IntRegIndex _dest, IntRegIndex _dest2, IntRegIndex _base,
155  int64_t _imm)
156  : MemoryImm64(mnem, _machInst, __opClass, _dest, _base, _imm),
157  dest2(_dest2)
158  {}
159 
160  std::string generateDisassembly(
161  Addr pc, const Loader::SymbolTable *symtab) const override;
162 };
163 
165 {
166  protected:
168 
169  MemoryDImmEx64(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
170  IntRegIndex _result, IntRegIndex _dest, IntRegIndex _dest2,
171  IntRegIndex _base, int32_t _imm)
172  : MemoryDImm64(mnem, _machInst, __opClass, _dest, _dest2,
173  _base, _imm), result(_result)
174  {}
175 
176  std::string generateDisassembly(
177  Addr pc, const Loader::SymbolTable *symtab) const override;
178 };
179 
181 {
182  protected:
183  MemoryPreIndex64(const char *mnem, ExtMachInst _machInst,
184  OpClass __opClass, IntRegIndex _dest, IntRegIndex _base,
185  int64_t _imm)
186  : MemoryImm64(mnem, _machInst, __opClass, _dest, _base, _imm)
187  {}
188 
189  std::string generateDisassembly(
190  Addr pc, const Loader::SymbolTable *symtab) const override;
191 };
192 
194 {
195  protected:
196  MemoryPostIndex64(const char *mnem, ExtMachInst _machInst,
197  OpClass __opClass, IntRegIndex _dest, IntRegIndex _base,
198  int64_t _imm)
199  : MemoryImm64(mnem, _machInst, __opClass, _dest, _base, _imm)
200  {}
201 
202  std::string generateDisassembly(
203  Addr pc, const Loader::SymbolTable *symtab) const override;
204 };
205 
206 class MemoryReg64 : public Memory64
207 {
208  protected:
211  uint64_t shiftAmt;
212 
213  MemoryReg64(const char *mnem, ExtMachInst _machInst,
214  OpClass __opClass, IntRegIndex _dest, IntRegIndex _base,
215  IntRegIndex _offset, ArmExtendType _type,
216  uint64_t _shiftAmt)
217  : Memory64(mnem, _machInst, __opClass, _dest, _base),
218  offset(_offset), type(_type), shiftAmt(_shiftAmt)
219  {}
220 
221  std::string generateDisassembly(
222  Addr pc, const Loader::SymbolTable *symtab) const override;
223 };
224 
225 class MemoryRaw64 : public Memory64
226 {
227  protected:
228  MemoryRaw64(const char *mnem, ExtMachInst _machInst,
229  OpClass __opClass, IntRegIndex _dest, IntRegIndex _base)
230  : Memory64(mnem, _machInst, __opClass, _dest, _base)
231  {}
232 
233  std::string generateDisassembly(
234  Addr pc, const Loader::SymbolTable *symtab) const override;
235 };
236 
237 class MemoryEx64 : public Memory64
238 {
239  protected:
241 
242  MemoryEx64(const char *mnem, ExtMachInst _machInst,
243  OpClass __opClass, IntRegIndex _dest, IntRegIndex _base,
244  IntRegIndex _result)
245  : Memory64(mnem, _machInst, __opClass, _dest, _base), result(_result)
246  {}
247 
248  std::string generateDisassembly(
249  Addr pc, const Loader::SymbolTable *symtab) const override;
250 };
251 
252 class MemoryLiteral64 : public Memory64
253 {
254  protected:
255  int64_t imm;
256 
257  MemoryLiteral64(const char *mnem, ExtMachInst _machInst,
258  OpClass __opClass, IntRegIndex _dest, int64_t _imm)
259  : Memory64(mnem, _machInst, __opClass, _dest, INTREG_ZERO), imm(_imm)
260  {}
261 
262  std::string generateDisassembly(
263  Addr pc, const Loader::SymbolTable *symtab) const override;
264 };
265 
266 }
267 
268 #endif //__ARCH_ARM_INSTS_MEM_HH__
ArmISA::MemoryPreIndex64
Definition: mem64.hh:180
ArmISA::MemoryImm64::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem64.cc:89
ArmISA::SysDC64::faultAddr
Addr faultAddr
Definition: mem64.hh:55
StaticInst::flags
std::bitset< Num_Flags > flags
Flag values for this instruction.
Definition: static_inst.hh:99
ArmISA::MemoryImm64::MemoryImm64
MemoryImm64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _base, int64_t _imm)
Definition: mem64.hh:139
X86ISA::os
Bitfield< 17 > os
Definition: misc.hh:803
ArmISA::Memory64::AddrMd_PostIndex
@ AddrMd_PostIndex
Definition: mem64.hh:93
MiscRegOp64
This class is implementing the Base class for a generic AArch64 instruction which is making use of sy...
Definition: misc64.hh:121
ArmISA::isSP
static bool isSP(IntRegIndex reg)
Definition: intregs.hh:515
ArmISA::Memory64::AddrMd_Offset
@ AddrMd_Offset
Definition: mem64.hh:91
ArmISA::MemoryDImm64::dest2
IntRegIndex dest2
Definition: mem64.hh:151
ArmISA::MightBeMicro64
Definition: mem64.hh:67
ArmISA::MemoryDImm64::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem64.cc:101
ArmISA::MemoryRaw64::MemoryRaw64
MemoryRaw64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _base)
Definition: mem64.hh:228
Loader::SymbolTable
Definition: symtab.hh:59
ArmISA::IntRegIndex
IntRegIndex
Definition: intregs.hh:51
ArmISA::INTREG_ZERO
@ INTREG_ZERO
Definition: intregs.hh:112
ArmISA::MemoryEx64::result
IntRegIndex result
Definition: mem64.hh:240
ArmISA::MemoryPostIndex64
Definition: mem64.hh:193
ArmISA::Memory64::startDisassembly
void startDisassembly(std::ostream &os) const
Definition: mem64.cc:62
ArmISA::Memory64::uops
StaticInstPtr * uops
Definition: mem64.hh:104
ArmISA::Memory64::baseIsSP
bool baseIsSP
True if the base register is SP (used for SP alignment checking).
Definition: mem64.hh:101
ArmISA::MemoryEx64::MemoryEx64
MemoryEx64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _base, IntRegIndex _result)
Definition: mem64.hh:242
ArmISA
Definition: ccregs.hh:41
ArmISA::Memory64::fetchMicroop
StaticInstPtr fetchMicroop(MicroPC microPC) const override
Return the microop that goes with a particular micropc.
Definition: mem64.hh:121
ArmISA::SysDC64::SysDC64
SysDC64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _base, MiscRegIndex _dest, uint64_t _imm)
Definition: mem64.hh:57
ArmISA::Memory64::memAccessFlags
unsigned memAccessFlags
Definition: mem64.hh:129
ArmISA::MemoryLiteral64::MemoryLiteral64
MemoryLiteral64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, int64_t _imm)
Definition: mem64.hh:257
ArmISA::SysDC64::imm
uint64_t imm
Definition: mem64.hh:52
ArmISA::ArmStaticInst
Definition: static_inst.hh:60
ArmISA::MemoryRaw64::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem64.cc:170
ArmISA::MemoryDImm64::MemoryDImm64
MemoryDImm64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _dest2, IntRegIndex _base, int64_t _imm)
Definition: mem64.hh:153
ArmISA::MightBeMicro64::MightBeMicro64
MightBeMicro64(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: mem64.hh:70
misc64.hh
ArmISA::MemoryDImm64
Definition: mem64.hh:148
ArmISA::MemoryDImmEx64
Definition: mem64.hh:164
ArmISA::MemoryReg64::shiftAmt
uint64_t shiftAmt
Definition: mem64.hh:211
ArmISA::MemoryPreIndex64::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem64.cc:137
MipsISA::pc
Bitfield< 4 > pc
Definition: pra_constants.hh:240
ArmISA::MightBeMicro64::advancePC
void advancePC(PCState &pcState) const override
Definition: mem64.hh:75
ArmISA::MemoryImm64
Definition: mem64.hh:134
ArmISA::MemoryDImmEx64::MemoryDImmEx64
MemoryDImmEx64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _result, IntRegIndex _dest, IntRegIndex _dest2, IntRegIndex _base, int32_t _imm)
Definition: mem64.hh:169
ArmISA::SysDC64::dest
MiscRegIndex dest
Definition: mem64.hh:51
ArmISA::Memory64
Definition: mem64.hh:87
ArmISA::MemoryPreIndex64::MemoryPreIndex64
MemoryPreIndex64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _base, int64_t _imm)
Definition: mem64.hh:183
StaticInst::ExtMachInst
TheISA::ExtMachInst ExtMachInst
Binary extended machine instruction type.
Definition: static_inst.hh:89
ArmISA::MemoryPostIndex64::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem64.cc:147
ArmISA::MemoryReg64
Definition: mem64.hh:206
ArmISA::MemoryReg64::offset
IntRegIndex offset
Definition: mem64.hh:209
ArmISA::Memory64::numMicroops
static const unsigned numMicroops
Definition: mem64.hh:102
ArmISA::MemoryLiteral64
Definition: mem64.hh:252
ArmISA::MemoryRaw64
Definition: mem64.hh:225
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
ArmISA::MemoryReg64::MemoryReg64
MemoryReg64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _base, IntRegIndex _offset, ArmExtendType _type, uint64_t _shiftAmt)
Definition: mem64.hh:213
ArmISA::MemoryEx64::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem64.cc:180
ArmISA::Memory64::AddrMd_PreIndex
@ AddrMd_PreIndex
Definition: mem64.hh:92
ArmISA::Memory64::~Memory64
virtual ~Memory64()
Definition: mem64.hh:115
ArmISA::MemoryReg64::type
ArmExtendType type
Definition: mem64.hh:210
ArmISA::ArmExtendType
ArmExtendType
Definition: types.hh:575
ArmISA::Memory64::setExcAcRel
void setExcAcRel(bool exclusive, bool acrel)
Definition: mem64.cc:75
ArmISA::MemoryReg64::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem64.cc:159
ArmISA::MemoryImm64::imm
int64_t imm
Definition: mem64.hh:137
ArmISA::Memory64::Memory64
Memory64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _base)
Definition: mem64.hh:106
MipsISA::PCState
GenericISA::DelaySlotPCState< MachInst > PCState
Definition: types.hh:41
static_inst.hh
ArmISA::MiscRegIndex
MiscRegIndex
Definition: miscregs.hh:56
ArmISA::Memory64::base
IntRegIndex base
Definition: mem64.hh:99
ArmISA::SysDC64
Definition: mem64.hh:47
ArmISA::MemoryDImmEx64::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem64.cc:118
ArmISA::MemoryLiteral64::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem64.cc:195
RefCountingPtr< StaticInst >
ArmISA::SysDC64::base
IntRegIndex base
Definition: mem64.hh:50
ArmISA::Memory64::AddrMode
AddrMode
Definition: mem64.hh:90
MicroPC
uint16_t MicroPC
Definition: types.hh:144
ArmISA::MemoryPostIndex64::MemoryPostIndex64
MemoryPostIndex64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _base, int64_t _imm)
Definition: mem64.hh:196
ArmISA::MemoryLiteral64::imm
int64_t imm
Definition: mem64.hh:255
ArmISA::SysDC64::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem64.cc:50
ArmISA::MemoryDImmEx64::result
IntRegIndex result
Definition: mem64.hh:167
ArmISA::MemoryEx64
Definition: mem64.hh:237
ArmISA::Memory64::dest
IntRegIndex dest
Definition: mem64.hh:98

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