gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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  * Authors: Gabe Black
38  */
39 #ifndef __ARCH_ARM_MEM64_HH__
40 #define __ARCH_ARM_MEM64_HH__
41 
42 #include "arch/arm/insts/misc64.hh"
44 
45 namespace ArmISA
46 {
47 
48 class SysDC64 : public MiscRegOp64
49 {
50  protected:
53  uint64_t imm;
54 
55  // This is used for fault handling only
56  mutable Addr faultAddr;
57 
58  SysDC64(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
59  IntRegIndex _base, MiscRegIndex _dest, uint64_t _imm)
60  : MiscRegOp64(mnem, _machInst, __opClass, false),
61  base(_base), dest(_dest), imm(_imm), faultAddr(0)
62  {}
63 
64  std::string generateDisassembly(
65  Addr pc, const SymbolTable *symtab) const override;
66 };
67 
69 {
70  protected:
71  MightBeMicro64(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
72  : ArmStaticInst(mnem, _machInst, __opClass)
73  {}
74 
75  void
76  advancePC(PCState &pcState) const
77  {
78  if (flags[IsLastMicroop]) {
79  pcState.uEnd();
80  } else if (flags[IsMicroop]) {
81  pcState.uAdvance();
82  } else {
83  pcState.advance();
84  }
85  }
86 };
87 
88 class Memory64 : public MightBeMicro64
89 {
90  public:
91  enum AddrMode {
94  AddrMd_PostIndex
95  };
96 
97  protected:
98 
102  bool baseIsSP;
103  static const unsigned numMicroops = 3;
104 
106 
107  Memory64(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
108  IntRegIndex _dest, IntRegIndex _base)
109  : MightBeMicro64(mnem, _machInst, __opClass),
110  dest(_dest), base(_base), uops(NULL), memAccessFlags(0)
111  {
112  baseIsSP = isSP(_base);
113  }
114 
115  virtual
117  {
118  delete [] uops;
119  }
120 
122  fetchMicroop(MicroPC microPC) const override
123  {
124  assert(uops != NULL && microPC < numMicroops);
125  return uops[microPC];
126  }
127 
128  void startDisassembly(std::ostream &os) const;
129 
130  unsigned memAccessFlags;
131 
132  void setExcAcRel(bool exclusive, bool acrel);
133 };
134 
135 class MemoryImm64 : public Memory64
136 {
137  protected:
138  int64_t imm;
139 
140  MemoryImm64(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
141  IntRegIndex _dest, IntRegIndex _base, int64_t _imm)
142  : Memory64(mnem, _machInst, __opClass, _dest, _base), imm(_imm)
143  {}
144 
145  std::string generateDisassembly(
146  Addr pc, const SymbolTable *symtab) const override;
147 };
148 
149 class MemoryDImm64 : public MemoryImm64
150 {
151  protected:
153 
154  MemoryDImm64(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
155  IntRegIndex _dest, IntRegIndex _dest2, IntRegIndex _base,
156  int64_t _imm)
157  : MemoryImm64(mnem, _machInst, __opClass, _dest, _base, _imm),
158  dest2(_dest2)
159  {}
160 
161  std::string generateDisassembly(
162  Addr pc, const SymbolTable *symtab) const override;
163 };
164 
166 {
167  protected:
169 
170  MemoryDImmEx64(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
171  IntRegIndex _result, IntRegIndex _dest, IntRegIndex _dest2,
172  IntRegIndex _base, int32_t _imm)
173  : MemoryDImm64(mnem, _machInst, __opClass, _dest, _dest2,
174  _base, _imm), result(_result)
175  {}
176 
177  std::string generateDisassembly(
178  Addr pc, const SymbolTable *symtab) const override;
179 };
180 
182 {
183  protected:
184  MemoryPreIndex64(const char *mnem, ExtMachInst _machInst,
185  OpClass __opClass, IntRegIndex _dest, IntRegIndex _base,
186  int64_t _imm)
187  : MemoryImm64(mnem, _machInst, __opClass, _dest, _base, _imm)
188  {}
189 
190  std::string generateDisassembly(
191  Addr pc, const SymbolTable *symtab) const override;
192 };
193 
195 {
196  protected:
197  MemoryPostIndex64(const char *mnem, ExtMachInst _machInst,
198  OpClass __opClass, IntRegIndex _dest, IntRegIndex _base,
199  int64_t _imm)
200  : MemoryImm64(mnem, _machInst, __opClass, _dest, _base, _imm)
201  {}
202 
203  std::string generateDisassembly(
204  Addr pc, const SymbolTable *symtab) const override;
205 };
206 
207 class MemoryReg64 : public Memory64
208 {
209  protected:
212  uint64_t shiftAmt;
213 
214  MemoryReg64(const char *mnem, ExtMachInst _machInst,
215  OpClass __opClass, IntRegIndex _dest, IntRegIndex _base,
216  IntRegIndex _offset, ArmExtendType _type,
217  uint64_t _shiftAmt)
218  : Memory64(mnem, _machInst, __opClass, _dest, _base),
219  offset(_offset), type(_type), shiftAmt(_shiftAmt)
220  {}
221 
222  std::string generateDisassembly(
223  Addr pc, const SymbolTable *symtab) const override;
224 };
225 
226 class MemoryRaw64 : public Memory64
227 {
228  protected:
229  MemoryRaw64(const char *mnem, ExtMachInst _machInst,
230  OpClass __opClass, IntRegIndex _dest, IntRegIndex _base)
231  : Memory64(mnem, _machInst, __opClass, _dest, _base)
232  {}
233 
234  std::string generateDisassembly(
235  Addr pc, const SymbolTable *symtab) const override;
236 };
237 
238 class MemoryEx64 : public Memory64
239 {
240  protected:
242 
243  MemoryEx64(const char *mnem, ExtMachInst _machInst,
244  OpClass __opClass, IntRegIndex _dest, IntRegIndex _base,
245  IntRegIndex _result)
246  : Memory64(mnem, _machInst, __opClass, _dest, _base), result(_result)
247  {}
248 
249  std::string generateDisassembly(
250  Addr pc, const SymbolTable *symtab) const override;
251 };
252 
253 class MemoryLiteral64 : public Memory64
254 {
255  protected:
256  int64_t imm;
257 
258  MemoryLiteral64(const char *mnem, ExtMachInst _machInst,
259  OpClass __opClass, IntRegIndex _dest, int64_t _imm)
260  : Memory64(mnem, _machInst, __opClass, _dest, INTREG_ZERO), imm(_imm)
261  {}
262 
263  std::string generateDisassembly(
264  Addr pc, const SymbolTable *symtab) const override;
265 };
266 
267 }
268 
269 #endif //__ARCH_ARM_INSTS_MEM_HH__
unsigned memAccessFlags
Definition: mem64.hh:130
IntRegIndex dest2
Definition: mem64.hh:152
MiscRegIndex
Definition: miscregs.hh:57
IntRegIndex
Definition: intregs.hh:53
IntRegIndex base
Definition: mem64.hh:51
MemoryPostIndex64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _base, int64_t _imm)
Definition: mem64.hh:197
SysDC64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _base, MiscRegIndex _dest, uint64_t _imm)
Definition: mem64.hh:58
MemoryPreIndex64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _base, int64_t _imm)
Definition: mem64.hh:184
IntRegIndex result
Definition: mem64.hh:168
uint64_t imm
Definition: mem64.hh:53
void advancePC(PCState &pcState) const
Definition: mem64.hh:76
MightBeMicro64(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: mem64.hh:71
MemoryDImmEx64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _result, IntRegIndex _dest, IntRegIndex _dest2, IntRegIndex _base, int32_t _imm)
Definition: mem64.hh:170
This class is implementing the Base class for a generic AArch64 instruction which is making use of sy...
Definition: misc64.hh:121
MemoryReg64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _base, IntRegIndex _offset, ArmExtendType _type, uint64_t _shiftAmt)
Definition: mem64.hh:214
MemoryLiteral64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, int64_t _imm)
Definition: mem64.hh:258
Definition: ccregs.hh:42
MemoryEx64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _base, IntRegIndex _result)
Definition: mem64.hh:243
Bitfield< 17 > os
Definition: misc.hh:805
StaticInstPtr fetchMicroop(MicroPC microPC) const override
Return the microop that goes with a particular micropc.
Definition: mem64.hh:122
virtual ~Memory64()
Definition: mem64.hh:116
std::bitset< Num_Flags > flags
Flag values for this instruction.
Definition: static_inst.hh:97
uint64_t shiftAmt
Definition: mem64.hh:212
Bitfield< 4 > pc
uint16_t MicroPC
Definition: types.hh:144
bool baseIsSP
True if the base register is SP (used for SP alignment checking).
Definition: mem64.hh:102
MemoryRaw64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _base)
Definition: mem64.hh:229
ArmExtendType type
Definition: mem64.hh:211
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
IntRegIndex result
Definition: mem64.hh:241
Memory64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _base)
Definition: mem64.hh:107
IntRegIndex base
Definition: mem64.hh:100
MiscRegIndex dest
Definition: mem64.hh:52
IntRegIndex offset
Definition: mem64.hh:210
GenericISA::SimplePCState< MachInst > PCState
Definition: types.hh:43
std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem64.cc:52
Addr faultAddr
Definition: mem64.hh:56
MemoryImm64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _base, int64_t _imm)
Definition: mem64.hh:140
ArmExtendType
Definition: types.hh:539
TheISA::ExtMachInst ExtMachInst
Binary extended machine instruction type.
Definition: static_inst.hh:87
static bool isSP(IntRegIndex reg)
Definition: intregs.hh:517
StaticInstPtr * uops
Definition: mem64.hh:105
MemoryDImm64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _dest2, IntRegIndex _base, int64_t _imm)
Definition: mem64.hh:154
IntRegIndex dest
Definition: mem64.hh:99

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