3 // Copyright (c) 2010-2013,2017-2020 ARM Limited
6 // The license below extends only to copyright in the software and shall
7 // not be construed as granting a license to any other intellectual
8 // property including but not limited to intellectual property relating
9 // to a hardware implementation of the functionality of the software
10 // licensed hereunder. You may use the software subject to the license
11 // terms below provided that you ensure that this notice is replicated
12 // unmodified and in its entirety in all distributions of the software,
13 // modified or unmodified, in source code or in binary form.
15 // Redistribution and use in source and binary forms, with or without
16 // modification, are permitted provided that the following conditions are
17 // met: redistributions of source code must retain the above copyright
18 // notice, this list of conditions and the following disclaimer;
19 // redistributions in binary form must reproduce the above copyright
20 // notice, this list of conditions and the following disclaimer in the
21 // documentation and/or other materials provided with the distribution;
22 // neither the name of the copyright holders nor the names of its
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
26 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 ThreadContext *tc = xc->tcBase();
43 bool have_semi = ArmSystem::haveSemihosting(tc);
44 if (have_semi && Thumb && imm == ArmSemihosting::T32Imm) {
45 // Enable gem5 extensions since we can't distinguish in thumb.
46 ArmSystem::callSemihosting32(tc, true);
47 } else if (have_semi && imm == ArmSemihosting::A32Imm) {
48 ArmSystem::callSemihosting32(tc);
49 } else if (have_semi && imm == ArmSemihosting::Gem5Imm) {
50 ArmSystem::callSemihosting32(tc, true);
52 fault = std::make_shared<SupervisorCall>(machInst, imm);
56 svcIop = InstObjParams("svc", "Svc", "ImmOp",
58 "predicate_test": predicateTest,
59 "thumb_semihost": '0xAB',
60 "arm_semihost": '0x123456' },
61 ["IsSyscall", "IsNonSpeculative",
63 header_output = ImmOpDeclare.subst(svcIop)
64 decoder_output = SemihostConstructor.subst(svcIop)
65 exec_output = PredOpExecute.subst(svcIop)
68 ThreadContext *tc = xc->tcBase();
70 const auto semihost_imm = Thumb? 0x3C : 0xF000;
72 if (ArmSystem::haveSemihosting(tc) && imm == semihost_imm) {
73 ArmSystem::callSemihosting32(tc);
75 // HLT instructions aren't implemented, so treat them as undefined
77 fault = std::make_shared<UndefinedInstruction>(
78 machInst, false, mnemonic);
82 hltIop = InstObjParams("hlt", "Hlt", "ImmOp",
84 "predicate_test": predicateTest,
85 "thumb_semihost": '0x3C',
86 "arm_semihost": '0xF000' },
87 ["IsNonSpeculative", "IsSerializeAfter"])
88 header_output += ImmOpDeclare.subst(hltIop)
89 decoder_output += SemihostConstructor.subst(hltIop)
90 exec_output += PredOpExecute.subst(hltIop)
97 if ((cpsr.mode != MODE_USER) && FullSystem) {
98 if (EL2Enabled(xc->tcBase()) && (cpsr.mode != MODE_HYP) && hcr.tsc) {
99 fault = std::make_shared<HypervisorTrap>(machInst, 0,
103 fault = disabledFault();
105 fault = std::make_shared<SecureMonitorCall>(machInst);
109 fault = disabledFault();
113 smcIop = InstObjParams("smc", "Smc", "PredOp",
115 "predicate_test": predicateTest },
116 ["IsNonSpeculative", "IsSerializeAfter"])
117 header_output += BasicDeclare.subst(smcIop)
118 decoder_output += BasicConstructor.subst(smcIop)
119 exec_output += PredOpExecute.subst(smcIop)
126 // Filter out the various cases where this instruction isn't defined
127 if (!FullSystem || !ArmSystem::haveVirtualization(xc->tcBase()) ||
128 (cpsr.mode == MODE_USER) ||
129 (isSecure(xc->tcBase()) && !IsSecureEL2Enabled(xc->tcBase())) ||
130 (ArmSystem::haveSecurity(xc->tcBase()) ? !scr.hce : hcr.hcd)) {
131 fault = disabledFault();
133 fault = std::make_shared<HypervisorCall>(machInst, imm);
137 hvcIop = InstObjParams("hvc", "Hvc", "ImmOp",
139 "predicate_test": predicateTest },
140 ["IsNonSpeculative", "IsSerializeAfter"])
141 header_output += ImmOpDeclare.subst(hvcIop)
142 decoder_output += ImmOpConstructor.subst(hvcIop)
143 exec_output += PredOpExecute.subst(hvcIop)
147 CPSR old_cpsr = Cpsr;
148 old_cpsr.nz = CondCodesNZ;
149 old_cpsr.c = CondCodesC;
150 old_cpsr.v = CondCodesV;
151 old_cpsr.ge = CondCodesGE;
153 CPSR new_cpsr = cpsrWriteByInstr(old_cpsr, Spsr, Scr, Nsacr, 0xF,
154 true, sctlr.nmfi, xc->tcBase());
155 Cpsr = ~CondCodesMask & new_cpsr;
156 CondCodesNZ = new_cpsr.nz;
157 CondCodesC = new_cpsr.c;
158 CondCodesV = new_cpsr.v;
159 CondCodesGE = new_cpsr.ge;
161 NextThumb = (new_cpsr).t;
162 NextJazelle = (new_cpsr).j;
163 NextItState = (((new_cpsr).it2 << 2) & 0xFC)
164 | ((new_cpsr).it1 & 0x3);
166 NPC = (old_cpsr.mode == MODE_HYP) ? ElrHyp : LR;
169 eretIop = InstObjParams("eret", "Eret", "PredOp",
171 "predicate_test": predicateTest },
172 ["IsNonSpeculative", "IsSerializeAfter",
174 header_output += BasicDeclare.subst(eretIop)
175 decoder_output += BasicConstructor.subst(eretIop)
176 exec_output += PredOpExecute.subst(eretIop)
179 constexpr uint8_t size_bytes = %(sz)d;
180 constexpr uint32_t poly = %(polynom)s;
182 uint32_t data = htole(Op2);
183 auto data_buffer = reinterpret_cast<uint8_t*>(&data);
186 data_buffer, /* Message Register */
187 Op1, /* Initial Value of the CRC */
188 size_bytes /* Size of the original Message */
192 def crc32Emit(mnem, implCode, castagnoli, size):
193 global header_output, decoder_output, exec_output
196 # crc32c instructions
202 data = {'sz' : size, 'polynom': poly}
204 instCode = implCode % data
206 crcIop = InstObjParams(mnem, mnem.capitalize(), "RegRegRegOp",
208 "predicate_test": predicateTest }, [])
209 header_output += RegRegRegOpDeclare.subst(crcIop)
210 decoder_output += RegRegRegOpConstructor.subst(crcIop)
211 exec_output += PredOpExecute.subst(crcIop)
213 crc32Emit("crc32b", crcCode, False, 1);
214 crc32Emit("crc32h", crcCode, False, 2);
215 crc32Emit("crc32w", crcCode, False, 4);
216 crc32Emit("crc32cb", crcCode, True, 1);
217 crc32Emit("crc32ch", crcCode, True, 2);
218 crc32Emit("crc32cw", crcCode, True, 4);
224 header_output = decoder_output = exec_output = ""
228 cpsr.nz = CondCodesNZ;
231 cpsr.ge = CondCodesGE;
232 Dest = cpsr & (cpsr.mode == MODE_USER ? ApsrMask : CpsrMask);
235 mrsCpsrIop = InstObjParams("mrs", "MrsCpsr", "MrsOp",
236 { "code": mrsCpsrCode,
237 "predicate_test": condPredicateTest },
238 ["IsSerializeBefore"])
239 header_output += MrsDeclare.subst(mrsCpsrIop)
240 decoder_output += MrsConstructor.subst(mrsCpsrIop)
241 exec_output += PredOpExecute.subst(mrsCpsrIop)
243 mrsSpsrCode = "Dest = Spsr"
244 mrsSpsrIop = InstObjParams("mrs", "MrsSpsr", "MrsOp",
245 { "code": mrsSpsrCode,
246 "predicate_test": predicateTest },
247 ["IsSerializeBefore"])
248 header_output += MrsDeclare.subst(mrsSpsrIop)
249 decoder_output += MrsConstructor.subst(mrsSpsrIop)
250 exec_output += PredOpExecute.subst(mrsSpsrIop)
252 mrsBankedRegCode = '''
256 if (decodeMrsMsrBankedReg(byteMask, r, isIntReg, regIdx, Cpsr, Scr, Nsacr)) {
258 Dest = DecodedBankedIntReg;
260 Dest = xc->readMiscReg(regIdx);
263 return std::make_shared<UndefinedInstruction>(machInst, false,
267 mrsBankedRegIop = InstObjParams("mrs", "MrsBankedReg", "MrsOp",
268 { "code": mrsBankedRegCode,
269 "predicate_test": predicateTest },
270 ["IsSerializeBefore"])
271 header_output += MrsBankedRegDeclare.subst(mrsBankedRegIop)
272 decoder_output += MrsBankedRegConstructor.subst(mrsBankedRegIop)
273 exec_output += PredOpExecute.subst(mrsBankedRegIop)
275 msrBankedRegCode = '''
279 if (decodeMrsMsrBankedReg(byteMask, r, isIntReg, regIdx, Cpsr, Scr, Nsacr)) {
281 // This is a bit nasty, you would have thought that
282 // DecodedBankedIntReg wouldn't be written to unless the
283 // conditions on the IF statements above are met, however if
284 // you look at the generated C code you'll find that they are.
285 // However this is safe as DecodedBankedIntReg (which is used
286 // in operands.isa to get the index of DecodedBankedIntReg)
287 // will return INTREG_DUMMY if its not a valid integer
288 // register, so redirecting the write to somewhere we don't
290 DecodedBankedIntReg = Op1;
292 xc->setMiscReg(regIdx, Op1);
295 return std::make_shared<UndefinedInstruction>(machInst, false,
299 msrBankedRegIop = InstObjParams("msr", "MsrBankedReg", "MsrRegOp",
300 { "code": msrBankedRegCode,
301 "predicate_test": predicateTest },
302 ["IsSerializeAfter", "IsNonSpeculative"])
303 header_output += MsrBankedRegDeclare.subst(msrBankedRegIop)
304 decoder_output += MsrBankedRegConstructor.subst(msrBankedRegIop)
305 exec_output += PredOpExecute.subst(msrBankedRegIop)
309 CPSR old_cpsr = Cpsr;
310 old_cpsr.nz = CondCodesNZ;
311 old_cpsr.c = CondCodesC;
312 old_cpsr.v = CondCodesV;
313 old_cpsr.ge = CondCodesGE;
316 cpsrWriteByInstr(old_cpsr, Op1, Scr, Nsacr, byteMask, false,
317 sctlr.nmfi, xc->tcBase());
318 Cpsr = ~CondCodesMask & new_cpsr;
319 CondCodesNZ = new_cpsr.nz;
320 CondCodesC = new_cpsr.c;
321 CondCodesV = new_cpsr.v;
322 CondCodesGE = new_cpsr.ge;
324 msrCpsrRegIop = InstObjParams("msr", "MsrCpsrReg", "MsrRegOp",
325 { "code": msrCpsrRegCode,
326 "predicate_test": condPredicateTest },
327 ["IsSerializeAfter","IsNonSpeculative"])
328 header_output += MsrRegDeclare.subst(msrCpsrRegIop)
329 decoder_output += MsrRegConstructor.subst(msrCpsrRegIop)
330 exec_output += PredOpExecute.subst(msrCpsrRegIop)
332 msrSpsrRegCode = "Spsr = spsrWriteByInstr(Spsr, Op1, byteMask, false);"
333 msrSpsrRegIop = InstObjParams("msr", "MsrSpsrReg", "MsrRegOp",
334 { "code": msrSpsrRegCode,
335 "predicate_test": predicateTest },
336 ["IsSerializeAfter","IsNonSpeculative"])
337 header_output += MsrRegDeclare.subst(msrSpsrRegIop)
338 decoder_output += MsrRegConstructor.subst(msrSpsrRegIop)
339 exec_output += PredOpExecute.subst(msrSpsrRegIop)
343 CPSR old_cpsr = Cpsr;
344 old_cpsr.nz = CondCodesNZ;
345 old_cpsr.c = CondCodesC;
346 old_cpsr.v = CondCodesV;
347 old_cpsr.ge = CondCodesGE;
349 cpsrWriteByInstr(old_cpsr, imm, Scr, Nsacr, byteMask, false,
350 sctlr.nmfi, xc->tcBase());
351 Cpsr = ~CondCodesMask & new_cpsr;
352 CondCodesNZ = new_cpsr.nz;
353 CondCodesC = new_cpsr.c;
354 CondCodesV = new_cpsr.v;
355 CondCodesGE = new_cpsr.ge;
357 msrCpsrImmIop = InstObjParams("msr", "MsrCpsrImm", "MsrImmOp",
358 { "code": msrCpsrImmCode,
359 "predicate_test": condPredicateTest },
360 ["IsSerializeAfter","IsNonSpeculative"])
361 header_output += MsrImmDeclare.subst(msrCpsrImmIop)
362 decoder_output += MsrImmConstructor.subst(msrCpsrImmIop)
363 exec_output += PredOpExecute.subst(msrCpsrImmIop)
365 msrSpsrImmCode = "Spsr = spsrWriteByInstr(Spsr, imm, byteMask, false);"
366 msrSpsrImmIop = InstObjParams("msr", "MsrSpsrImm", "MsrImmOp",
367 { "code": msrSpsrImmCode,
368 "predicate_test": predicateTest },
369 ["IsSerializeAfter","IsNonSpeculative"])
370 header_output += MsrImmDeclare.subst(msrSpsrImmIop)
371 decoder_output += MsrImmConstructor.subst(msrSpsrImmIop)
372 exec_output += PredOpExecute.subst(msrSpsrImmIop)
376 Dest = swap_byte(val);
378 revIop = InstObjParams("rev", "Rev", "RegRegOp",
380 "predicate_test": predicateTest }, [])
381 header_output += RegRegOpDeclare.subst(revIop)
382 decoder_output += RegRegOpConstructor.subst(revIop)
383 exec_output += PredOpExecute.subst(revIop)
387 Dest = (bits(val, 15, 8) << 0) |
388 (bits(val, 7, 0) << 8) |
389 (bits(val, 31, 24) << 16) |
390 (bits(val, 23, 16) << 24);
392 rev16Iop = InstObjParams("rev16", "Rev16", "RegRegOp",
394 "predicate_test": predicateTest }, [])
395 header_output += RegRegOpDeclare.subst(rev16Iop)
396 decoder_output += RegRegOpConstructor.subst(rev16Iop)
397 exec_output += PredOpExecute.subst(rev16Iop)
401 Dest = sext<16>(swap_byte(val));
403 revshIop = InstObjParams("revsh", "Revsh", "RegRegOp",
405 "predicate_test": predicateTest }, [])
406 header_output += RegRegOpDeclare.subst(revshIop)
407 decoder_output += RegRegOpConstructor.subst(revshIop)
408 exec_output += PredOpExecute.subst(revshIop)
411 Dest = reverseBits(Op1);
413 rbitIop = InstObjParams("rbit", "Rbit", "RegRegOp",
415 "predicate_test": predicateTest }, [])
416 header_output += RegRegOpDeclare.subst(rbitIop)
417 decoder_output += RegRegOpConstructor.subst(rbitIop)
418 exec_output += PredOpExecute.subst(rbitIop)
421 Dest = (Op1 == 0) ? 32 : (31 - findMsbSet(Op1));
423 clzIop = InstObjParams("clz", "Clz", "RegRegOp",
425 "predicate_test": predicateTest }, [])
426 header_output += RegRegOpDeclare.subst(clzIop)
427 decoder_output += RegRegOpConstructor.subst(clzIop)
428 exec_output += PredOpExecute.subst(clzIop)
431 int32_t operand = shift_rm_imm(Op1, shiftAmt, shiftType, 0);
433 if (satInt(res, operand, imm))
437 ssatIop = InstObjParams("ssat", "Ssat", "RegImmRegShiftOp",
439 "predicate_test": pickPredicate(ssatCode) }, [])
440 header_output += RegImmRegShiftOpDeclare.subst(ssatIop)
441 decoder_output += RegImmRegShiftOpConstructor.subst(ssatIop)
442 exec_output += PredOpExecute.subst(ssatIop)
445 int32_t operand = shift_rm_imm(Op1, shiftAmt, shiftType, 0);
447 if (uSatInt(res, operand, imm))
451 usatIop = InstObjParams("usat", "Usat", "RegImmRegShiftOp",
453 "predicate_test": pickPredicate(usatCode) }, [])
454 header_output += RegImmRegShiftOpDeclare.subst(usatIop)
455 decoder_output += RegImmRegShiftOpConstructor.subst(usatIop)
456 exec_output += PredOpExecute.subst(usatIop)
460 uint32_t resTemp = 0;
461 int32_t argLow = sext<16>(bits(Op1, 15, 0));
462 int32_t argHigh = sext<16>(bits(Op1, 31, 16));
463 if (satInt(res, argLow, imm))
465 replaceBits(resTemp, 15, 0, res);
466 if (satInt(res, argHigh, imm))
468 replaceBits(resTemp, 31, 16, res);
471 ssat16Iop = InstObjParams("ssat16", "Ssat16", "RegImmRegOp",
472 { "code": ssat16Code,
473 "predicate_test": pickPredicate(ssat16Code) }, [])
474 header_output += RegImmRegOpDeclare.subst(ssat16Iop)
475 decoder_output += RegImmRegOpConstructor.subst(ssat16Iop)
476 exec_output += PredOpExecute.subst(ssat16Iop)
480 uint32_t resTemp = 0;
481 int32_t argLow = sext<16>(bits(Op1, 15, 0));
482 int32_t argHigh = sext<16>(bits(Op1, 31, 16));
483 if (uSatInt(res, argLow, imm))
485 replaceBits(resTemp, 15, 0, res);
486 if (uSatInt(res, argHigh, imm))
488 replaceBits(resTemp, 31, 16, res);
491 usat16Iop = InstObjParams("usat16", "Usat16", "RegImmRegOp",
492 { "code": usat16Code,
493 "predicate_test": pickPredicate(usat16Code) }, [])
494 header_output += RegImmRegOpDeclare.subst(usat16Iop)
495 decoder_output += RegImmRegOpConstructor.subst(usat16Iop)
496 exec_output += PredOpExecute.subst(usat16Iop)
498 sxtbIop = InstObjParams("sxtb", "Sxtb", "RegImmRegOp",
500 "Dest = sext<8>((uint8_t)(Op1_ud >> imm));",
501 "predicate_test": predicateTest }, [])
502 header_output += RegImmRegOpDeclare.subst(sxtbIop)
503 decoder_output += RegImmRegOpConstructor.subst(sxtbIop)
504 exec_output += PredOpExecute.subst(sxtbIop)
506 sxtabIop = InstObjParams("sxtab", "Sxtab", "RegRegRegImmOp",
509 Dest = sext<8>((uint8_t)(Op2_ud >> imm)) +
512 "predicate_test": predicateTest }, [])
513 header_output += RegRegRegImmOpDeclare.subst(sxtabIop)
514 decoder_output += RegRegRegImmOpConstructor.subst(sxtabIop)
515 exec_output += PredOpExecute.subst(sxtabIop)
518 uint32_t resTemp = 0;
519 replaceBits(resTemp, 15, 0, sext<8>(bits(Op1, imm + 7, imm)));
520 replaceBits(resTemp, 31, 16,
521 sext<8>(bits(Op1, (imm + 23) % 32, (imm + 16) % 32)));
524 sxtb16Iop = InstObjParams("sxtb16", "Sxtb16", "RegImmRegOp",
525 { "code": sxtb16Code,
526 "predicate_test": predicateTest }, [])
527 header_output += RegImmRegOpDeclare.subst(sxtb16Iop)
528 decoder_output += RegImmRegOpConstructor.subst(sxtb16Iop)
529 exec_output += PredOpExecute.subst(sxtb16Iop)
532 uint32_t resTemp = 0;
533 replaceBits(resTemp, 15, 0, sext<8>(bits(Op2, imm + 7, imm)) +
535 replaceBits(resTemp, 31, 16,
536 sext<8>(bits(Op2, (imm + 23) % 32, (imm + 16) % 32)) +
540 sxtab16Iop = InstObjParams("sxtab16", "Sxtab16", "RegRegRegImmOp",
541 { "code": sxtab16Code,
542 "predicate_test": predicateTest }, [])
543 header_output += RegRegRegImmOpDeclare.subst(sxtab16Iop)
544 decoder_output += RegRegRegImmOpConstructor.subst(sxtab16Iop)
545 exec_output += PredOpExecute.subst(sxtab16Iop)
548 uint64_t rotated = (uint32_t)Op1;
549 rotated = (rotated | (rotated << 32)) >> imm;
550 Dest = sext<16>((uint16_t)rotated);
552 sxthIop = InstObjParams("sxth", "Sxth", "RegImmRegOp",
554 "predicate_test": predicateTest }, [])
555 header_output += RegImmRegOpDeclare.subst(sxthIop)
556 decoder_output += RegImmRegOpConstructor.subst(sxthIop)
557 exec_output += PredOpExecute.subst(sxthIop)
560 uint64_t rotated = (uint32_t)Op2;
561 rotated = (rotated | (rotated << 32)) >> imm;
562 Dest = sext<16>((uint16_t)rotated) + Op1;
564 sxtahIop = InstObjParams("sxtah", "Sxtah", "RegRegRegImmOp",
566 "predicate_test": predicateTest }, [])
567 header_output += RegRegRegImmOpDeclare.subst(sxtahIop)
568 decoder_output += RegRegRegImmOpConstructor.subst(sxtahIop)
569 exec_output += PredOpExecute.subst(sxtahIop)
571 uxtbIop = InstObjParams("uxtb", "Uxtb", "RegImmRegOp",
572 { "code": "Dest = (uint8_t)(Op1_ud >> imm);",
573 "predicate_test": predicateTest }, [])
574 header_output += RegImmRegOpDeclare.subst(uxtbIop)
575 decoder_output += RegImmRegOpConstructor.subst(uxtbIop)
576 exec_output += PredOpExecute.subst(uxtbIop)
578 uxtabIop = InstObjParams("uxtab", "Uxtab", "RegRegRegImmOp",
580 "Dest = (uint8_t)(Op2_ud >> imm) + Op1;",
581 "predicate_test": predicateTest }, [])
582 header_output += RegRegRegImmOpDeclare.subst(uxtabIop)
583 decoder_output += RegRegRegImmOpConstructor.subst(uxtabIop)
584 exec_output += PredOpExecute.subst(uxtabIop)
587 uint32_t resTemp = 0;
588 replaceBits(resTemp, 15, 0, (uint8_t)(bits(Op1, imm + 7, imm)));
589 replaceBits(resTemp, 31, 16,
590 (uint8_t)(bits(Op1, (imm + 23) % 32, (imm + 16) % 32)));
593 uxtb16Iop = InstObjParams("uxtb16", "Uxtb16", "RegImmRegOp",
594 { "code": uxtb16Code,
595 "predicate_test": predicateTest }, [])
596 header_output += RegImmRegOpDeclare.subst(uxtb16Iop)
597 decoder_output += RegImmRegOpConstructor.subst(uxtb16Iop)
598 exec_output += PredOpExecute.subst(uxtb16Iop)
601 uint32_t resTemp = 0;
602 replaceBits(resTemp, 15, 0, (uint8_t)(bits(Op2, imm + 7, imm)) +
604 replaceBits(resTemp, 31, 16,
605 (uint8_t)(bits(Op2, (imm + 23) % 32, (imm + 16) % 32)) +
609 uxtab16Iop = InstObjParams("uxtab16", "Uxtab16", "RegRegRegImmOp",
610 { "code": uxtab16Code,
611 "predicate_test": predicateTest }, [])
612 header_output += RegRegRegImmOpDeclare.subst(uxtab16Iop)
613 decoder_output += RegRegRegImmOpConstructor.subst(uxtab16Iop)
614 exec_output += PredOpExecute.subst(uxtab16Iop)
617 uint64_t rotated = (uint32_t)Op1;
618 rotated = (rotated | (rotated << 32)) >> imm;
619 Dest = (uint16_t)rotated;
621 uxthIop = InstObjParams("uxth", "Uxth", "RegImmRegOp",
623 "predicate_test": predicateTest }, [])
624 header_output += RegImmRegOpDeclare.subst(uxthIop)
625 decoder_output += RegImmRegOpConstructor.subst(uxthIop)
626 exec_output += PredOpExecute.subst(uxthIop)
629 uint64_t rotated = (uint32_t)Op2;
630 rotated = (rotated | (rotated << 32)) >> imm;
631 Dest = (uint16_t)rotated + Op1;
633 uxtahIop = InstObjParams("uxtah", "Uxtah", "RegRegRegImmOp",
635 "predicate_test": predicateTest }, [])
636 header_output += RegRegRegImmOpDeclare.subst(uxtahIop)
637 decoder_output += RegRegRegImmOpConstructor.subst(uxtahIop)
638 exec_output += PredOpExecute.subst(uxtahIop)
641 uint32_t resTemp = 0;
642 for (unsigned i = 0; i < 4; i++) {
645 replaceBits(resTemp, high, low,
646 bits(CondCodesGE, i) ?
647 bits(Op1, high, low) : bits(Op2, high, low));
651 selIop = InstObjParams("sel", "Sel", "RegRegRegOp",
653 "predicate_test": predicateTest }, [])
654 header_output += RegRegRegOpDeclare.subst(selIop)
655 decoder_output += RegRegRegOpConstructor.subst(selIop)
656 exec_output += PredOpExecute.subst(selIop)
659 uint32_t resTemp = 0;
660 for (unsigned i = 0; i < 4; i++) {
663 int32_t diff = bits(Op1, high, low) -
664 bits(Op2, high, low);
665 resTemp += ((diff < 0) ? -diff : diff);
669 usad8Iop = InstObjParams("usad8", "Usad8", "RegRegRegOp",
671 "predicate_test": predicateTest }, [])
672 header_output += RegRegRegOpDeclare.subst(usad8Iop)
673 decoder_output += RegRegRegOpConstructor.subst(usad8Iop)
674 exec_output += PredOpExecute.subst(usad8Iop)
677 uint32_t resTemp = 0;
678 for (unsigned i = 0; i < 4; i++) {
681 int32_t diff = bits(Op1, high, low) -
682 bits(Op2, high, low);
683 resTemp += ((diff < 0) ? -diff : diff);
685 Dest = Op3 + resTemp;
687 usada8Iop = InstObjParams("usada8", "Usada8", "RegRegRegRegOp",
688 { "code": usada8Code,
689 "predicate_test": predicateTest }, [])
690 header_output += RegRegRegRegOpDeclare.subst(usada8Iop)
691 decoder_output += RegRegRegRegOpConstructor.subst(usada8Iop)
692 exec_output += PredOpExecute.subst(usada8Iop)
697 imm16 = ((bits(machInst, 19, 8) << 4) | bits(machInst, 3, 0));
699 imm16 = bits(machInst, 7, 0);
701 return softwareBreakpoint32(xc, imm16);
703 bkptIop = InstObjParams("bkpt", "BkptInst", "PredOp", bkptCode)
704 header_output += BasicDeclare.subst(bkptIop)
705 decoder_output += BasicConstructor.subst(bkptIop)
706 exec_output += BasicExecute.subst(bkptIop)
708 nopIop = InstObjParams("nop", "NopInst", "ArmStaticInst", "", ['IsNop'])
709 header_output += BasicDeclare.subst(nopIop)
710 decoder_output += BasicConstructor64.subst(nopIop)
711 exec_output += BasicExecute.subst(nopIop)
713 yieldIop = InstObjParams("yield", "YieldInst", "PredOp", \
714 { "code" : "", "predicate_test" : predicateTest })
715 header_output += BasicDeclare.subst(yieldIop)
716 decoder_output += BasicConstructor.subst(yieldIop)
717 exec_output += PredOpExecute.subst(yieldIop)
723 // WFE Sleeps if SevMailbox==0 and no unmasked interrupts are pending,
724 ThreadContext *tc = xc->tcBase();
725 Tick next_cycle = tc->getCpuPtr()->nextCycle();
726 if (SevMailbox == 1) {
728 tc->quiesceTick(next_cycle + 1);
729 } else if (tc->getCpuPtr()->getInterruptController(
730 tc->threadId())->checkInterrupts()) {
731 tc->quiesceTick(next_cycle + 1);
733 fault = trapWFx(tc, cpsr, scr, true);
734 if (fault == NoFault) {
737 tc->quiesceTick(next_cycle + 1);
741 wfePredFixUpCode = '''
742 // WFE is predicated false, reset SevMailbox to reduce spurious sleeps
743 // and SEV interrupts
746 wfeIop = InstObjParams("wfe", "WfeInst", "PredOp", \
748 "pred_fixup" : wfePredFixUpCode,
749 "predicate_test" : predicateTest },
750 ["IsNonSpeculative", "IsQuiesce",
751 "IsSerializeAfter", "IsUnverifiable"])
752 header_output += BasicDeclare.subst(wfeIop)
753 decoder_output += BasicConstructor.subst(wfeIop)
754 exec_output += QuiescePredOpExecuteWithFixup.subst(wfeIop)
761 // WFI doesn't sleep if interrupts are pending (masked or not)
762 ThreadContext *tc = xc->tcBase();
763 auto *ic = dynamic_cast<ArmISA::Interrupts *>(
764 tc->getCpuPtr()->getInterruptController(tc->threadId()));
765 Tick next_cycle = tc->getCpuPtr()->nextCycle();
766 if (ic->checkWfiWake(hcr, cpsr, scr)) {
767 tc->quiesceTick(next_cycle + 1);
769 fault = trapWFx(tc, cpsr, scr, false);
770 if (fault == NoFault) {
772 ArmSystem::callSetStandByWfi(tc);
774 tc->quiesceTick(next_cycle + 1);
777 tc->getCpuPtr()->clearInterrupt(tc->threadId(), INT_ABT, 0);
779 wfiIop = InstObjParams("wfi", "WfiInst", "PredOp", \
780 { "code" : wfiCode, "predicate_test" : predicateTest },
781 ["IsNonSpeculative", "IsQuiesce",
782 "IsSerializeAfter", "IsUnverifiable"])
783 header_output += BasicDeclare.subst(wfiIop)
784 decoder_output += BasicConstructor.subst(wfiIop)
785 exec_output += QuiescePredOpExecute.subst(wfiIop)
789 System *sys = xc->tcBase()->getSystemPtr();
790 for (int x = 0; x < sys->threads.size(); x++) {
791 ThreadContext *oc = sys->threads[x];
792 if (oc == xc->tcBase())
795 // Wake CPU with interrupt if they were sleeping
799 sevIop = InstObjParams("sev", "SevInst", "PredOp", \
800 { "code" : sevCode, "predicate_test" : predicateTest },
801 ["IsNonSpeculative", "IsSquashAfter", "IsUnverifiable"])
802 header_output += BasicDeclare.subst(sevIop)
803 decoder_output += BasicConstructor.subst(sevIop)
804 exec_output += PredOpExecute.subst(sevIop)
809 sevlIop = InstObjParams("sevl", "SevlInst", "PredOp", \
810 { "code" : sevlCode, "predicate_test" : predicateTest },
811 ["IsNonSpeculative", "IsSquashAfter", "IsUnverifiable"])
812 header_output += BasicDeclare.subst(sevlIop)
813 decoder_output += BasicConstructor.subst(sevlIop)
814 exec_output += BasicExecute.subst(sevlIop)
816 itIop = InstObjParams("it", "ItInst", "PredOp", \
818 "predicate_test" : predicateTest }, [])
819 header_output += BasicDeclare.subst(itIop)
820 decoder_output += BasicConstructor.subst(itIop)
821 exec_output += PredOpExecute.subst(itIop)
823 return std::make_shared<UndefinedInstruction>(machInst, true);
825 unknownIop = InstObjParams("unknown", "Unknown", "UnknownOp", \
826 { "code": unknownCode,
827 "predicate_test": predicateTest })
828 header_output += BasicDeclare.subst(unknownIop)
829 decoder_output += BasicConstructor.subst(unknownIop)
830 exec_output += PredOpExecute.subst(unknownIop)
833 Dest = bits(Op1, imm2, imm1);
835 ubfxIop = InstObjParams("ubfx", "Ubfx", "RegRegImmImmOp",
837 "predicate_test": predicateTest }, [])
838 header_output += RegRegImmImmOpDeclare.subst(ubfxIop)
839 decoder_output += RegRegImmImmOpConstructor.subst(ubfxIop)
840 exec_output += PredOpExecute.subst(ubfxIop)
843 int32_t resTemp = bits(Op1, imm2, imm1);
844 Dest = resTemp | -(resTemp & (1 << (imm2 - imm1)));
846 sbfxIop = InstObjParams("sbfx", "Sbfx", "RegRegImmImmOp",
848 "predicate_test": predicateTest }, [])
849 header_output += RegRegImmImmOpDeclare.subst(sbfxIop)
850 decoder_output += RegRegImmImmOpConstructor.subst(sbfxIop)
851 exec_output += PredOpExecute.subst(sbfxIop)
854 Dest = Op1 & ~(mask(imm2 - imm1 + 1) << imm1);
856 bfcIop = InstObjParams("bfc", "Bfc", "RegRegImmImmOp",
858 "predicate_test": predicateTest }, [])
859 header_output += RegRegImmImmOpDeclare.subst(bfcIop)
860 decoder_output += RegRegImmImmOpConstructor.subst(bfcIop)
861 exec_output += PredOpExecute.subst(bfcIop)
864 uint32_t bitMask = (mask(imm2 - imm1 + 1) << imm1);
865 Dest = ((Op1 << imm1) & bitMask) | (Dest & ~bitMask);
867 bfiIop = InstObjParams("bfi", "Bfi", "RegRegImmImmOp",
869 "predicate_test": predicateTest }, [])
870 header_output += RegRegImmImmOpDeclare.subst(bfiIop)
871 decoder_output += RegRegImmImmOpConstructor.subst(bfiIop)
872 exec_output += PredOpExecute.subst(bfiIop)
875 MiscRegIndex miscReg = (MiscRegIndex) xc->tcBase()->flattenRegId(
876 RegId(MiscRegClass, op1)).index();
877 bool can_read, undefined;
878 std::tie(can_read, undefined) = canReadCoprocReg(miscReg, Scr, Cpsr,
880 if (!can_read || undefined) {
881 return std::make_shared<UndefinedInstruction>(machInst, false,
884 if (mcrMrc14TrapToHyp((MiscRegIndex) op1, Hcr, Cpsr, Scr, Hdcr,
886 return std::make_shared<HypervisorTrap>(machInst, imm,
887 EC_TRAPPED_CP14_MCR_MRC);
892 mrc14Iop = InstObjParams("mrc", "Mrc14", "RegMiscRegImmOp",
894 "predicate_test": predicateTest }, [])
895 header_output += RegMiscRegImmOpDeclare.subst(mrc14Iop)
896 decoder_output += RegMiscRegImmOpConstructor.subst(mrc14Iop)
897 exec_output += PredOpExecute.subst(mrc14Iop)
901 MiscRegIndex miscReg = (MiscRegIndex) xc->tcBase()->flattenRegId(
902 RegId(MiscRegClass, dest)).index();
903 bool can_write, undefined;
904 std::tie(can_write, undefined) = canWriteCoprocReg(miscReg, Scr, Cpsr,
906 if (undefined || !can_write) {
907 return std::make_shared<UndefinedInstruction>(machInst, false,
910 if (mcrMrc14TrapToHyp(miscReg, Hcr, Cpsr, Scr, Hdcr,
912 return std::make_shared<HypervisorTrap>(machInst, imm,
913 EC_TRAPPED_CP14_MCR_MRC);
917 mcr14Iop = InstObjParams("mcr", "Mcr14", "MiscRegRegImmOp",
919 "predicate_test": predicateTest },
920 ["IsSerializeAfter","IsNonSpeculative"])
921 header_output += MiscRegRegImmOpDeclare.subst(mcr14Iop)
922 decoder_output += MiscRegRegImmOpConstructor.subst(mcr14Iop)
923 exec_output += PredOpExecute.subst(mcr14Iop)
926 int preFlatOp1 = snsBankedIndex(op1, xc->tcBase());
927 MiscRegIndex miscReg = (MiscRegIndex)
928 xc->tcBase()->flattenRegId(RegId(MiscRegClass,
929 preFlatOp1)).index();
931 Fault fault = mcrMrc15Trap(miscReg, machInst, xc->tcBase(), imm);
933 bool can_read, undefined;
934 std::tie(can_read, undefined) = canReadCoprocReg(miscReg, Scr, Cpsr,
936 // if we're in non secure PL1 mode then we can trap regargless of whether
937 // the register is accessable, in other modes we trap if only if the register
939 if (undefined || (!can_read && !(fault != NoFault && !inUserMode(Cpsr) &&
940 !isSecure(xc->tcBase())))) {
941 return std::make_shared<UndefinedInstruction>(machInst, false,
944 if (fault != NoFault) {
947 Dest = MiscNsBankedOp1;
950 mrc15Iop = InstObjParams("mrc", "Mrc15", "RegMiscRegImmOp",
952 "predicate_test": predicateTest }, [])
953 header_output += RegMiscRegImmOpDeclare.subst(mrc15Iop)
954 decoder_output += RegMiscRegImmOpConstructor.subst(mrc15Iop)
955 exec_output += PredOpExecute.subst(mrc15Iop)
959 int preFlatDest = snsBankedIndex(dest, xc->tcBase());
960 MiscRegIndex miscReg = (MiscRegIndex)
961 xc->tcBase()->flattenRegId(RegId(MiscRegClass,
962 preFlatDest)).index();
964 Fault fault = mcrMrc15Trap(miscReg, machInst, xc->tcBase(), imm);
966 bool can_write, undefined;
967 std::tie(can_write, undefined) = canWriteCoprocReg(miscReg, Scr, Cpsr,
970 // if we're in non secure PL1 mode then we can trap regargless of whether
971 // the register is accessable, in other modes we trap if only if the register
973 if (undefined || (!can_write && !(fault != NoFault && !inUserMode(Cpsr) &&
974 !isSecure(xc->tcBase())))) {
975 return std::make_shared<UndefinedInstruction>(machInst, false,
978 if (fault != NoFault) {
981 MiscNsBankedDest = Op1;
983 mcr15Iop = InstObjParams("mcr", "Mcr15", "MiscRegRegImmOp",
985 "predicate_test": predicateTest },
986 ["IsSerializeAfter","IsNonSpeculative"])
987 header_output += MiscRegRegImmOpDeclare.subst(mcr15Iop)
988 decoder_output += MiscRegRegImmOpConstructor.subst(mcr15Iop)
989 exec_output += PredOpExecute.subst(mcr15Iop)
993 int preFlatOp1 = snsBankedIndex(op1, xc->tcBase());
994 MiscRegIndex miscReg = (MiscRegIndex)
995 xc->tcBase()->flattenRegId(RegId(MiscRegClass,
996 preFlatOp1)).index();
998 Fault fault = mcrrMrrc15Trap(miscReg, machInst, xc->tcBase(), imm);
1000 bool can_read, undefined;
1001 std::tie(can_read, undefined) = canReadCoprocReg(miscReg, Scr, Cpsr,
1003 // if we're in non secure PL1 mode then we can trap regargless of whether
1004 // the register is accessable, in other modes we trap if only if the register
1006 if (undefined || (!can_read && !(fault != NoFault && !inUserMode(Cpsr) &&
1007 !isSecure(xc->tcBase())))) {
1008 return std::make_shared<UndefinedInstruction>(machInst, false,
1011 if (fault != NoFault) {
1014 Dest = bits(MiscNsBankedOp164, 63, 32);
1015 Dest2 = bits(MiscNsBankedOp164, 31, 0);
1017 mrrc15Iop = InstObjParams("mrrc", "Mrrc15", "MrrcOp",
1018 { "code": mrrc15code,
1019 "predicate_test": predicateTest }, [])
1020 header_output += MrrcOpDeclare.subst(mrrc15Iop)
1021 decoder_output += MrrcOpConstructor.subst(mrrc15Iop)
1022 exec_output += PredOpExecute.subst(mrrc15Iop)
1026 int preFlatDest = snsBankedIndex(dest, xc->tcBase());
1027 MiscRegIndex miscReg = (MiscRegIndex)
1028 xc->tcBase()->flattenRegId(RegId(MiscRegClass,
1029 preFlatDest)).index();
1031 Fault fault = mcrrMrrc15Trap(miscReg, machInst, xc->tcBase(), imm);
1033 bool can_write, undefined;
1034 std::tie(can_write, undefined) = canWriteCoprocReg(miscReg, Scr, Cpsr,
1037 // if we're in non secure PL1 mode then we can trap regargless of whether
1038 // the register is accessable, in other modes we trap if only if the register
1040 if (undefined || (!can_write && !(fault != NoFault && !inUserMode(Cpsr) &&
1041 !isSecure(xc->tcBase())))) {
1042 return std::make_shared<UndefinedInstruction>(machInst, false,
1045 if (fault != NoFault) {
1048 MiscNsBankedDest64 = ((uint64_t) Op1 << 32) | Op2;
1050 mcrr15Iop = InstObjParams("mcrr", "Mcrr15", "McrrOp",
1051 { "code": mcrr15code,
1052 "predicate_test": predicateTest }, [])
1053 header_output += McrrOpDeclare.subst(mcrr15Iop)
1054 decoder_output += McrrOpConstructor.subst(mcrr15Iop)
1055 exec_output += PredOpExecute.subst(mcrr15Iop)
1062 enterxIop = InstObjParams("enterx", "Enterx", "PredOp",
1063 { "code": enterxCode,
1064 "predicate_test": predicateTest }, [])
1065 header_output += BasicDeclare.subst(enterxIop)
1066 decoder_output += BasicConstructor.subst(enterxIop)
1067 exec_output += PredOpExecute.subst(enterxIop)
1071 NextJazelle = false;
1073 leavexIop = InstObjParams("leavex", "Leavex", "PredOp",
1074 { "code": leavexCode,
1075 "predicate_test": predicateTest }, [])
1076 header_output += BasicDeclare.subst(leavexIop)
1077 decoder_output += BasicConstructor.subst(leavexIop)
1078 exec_output += PredOpExecute.subst(leavexIop)
1084 fault = checkSETENDEnabled(xc->tcBase(), cpsr);
1086 setendIop = InstObjParams("setend", "Setend", "ImmOp",
1087 { "code": setendCode,
1088 "predicate_test": predicateTest },
1089 ["IsSerializeAfter","IsNonSpeculative"])
1090 header_output += ImmOpDeclare.subst(setendIop)
1091 decoder_output += ImmOpConstructor.subst(setendIop)
1092 exec_output += PredOpExecute.subst(setendIop)
1097 clrexIop = InstObjParams("clrex", "Clrex","PredOp",
1098 { "code": clrexCode,
1099 "predicate_test": predicateTest },[])
1100 header_output += BasicDeclare.subst(clrexIop)
1101 decoder_output += BasicConstructor.subst(clrexIop)
1102 exec_output += PredOpExecute.subst(clrexIop)
1104 McrDcCheckCode = '''
1105 int preFlatDest = snsBankedIndex(dest, xc->tcBase());
1106 MiscRegIndex miscReg = (MiscRegIndex) xc->tcBase()->flattenRegId(
1107 RegId(MiscRegClass, preFlatDest)).index();
1109 bool hypTrap = mcrMrc15TrapToHyp(miscReg, xc->tcBase(), imm);
1111 bool can_write, undefined;
1112 std::tie(can_write, undefined) = canWriteCoprocReg(miscReg, Scr, Cpsr,
1115 // if we're in non secure PL1 mode then we can trap regardless
1116 // of whether the register is accessible, in other modes we
1117 // trap if only if the register IS accessible.
1118 if (undefined || (!can_write & !(hypTrap & !inUserMode(Cpsr) &
1119 !isSecure(xc->tcBase())))) {
1120 return std::make_shared<UndefinedInstruction>(machInst, false,
1124 return std::make_shared<HypervisorTrap>(machInst, imm,
1125 EC_TRAPPED_CP15_MCR_MRC);
1129 McrDcimvacCode = '''
1130 const Request::Flags memAccessFlags(Request::INVALIDATE |
1134 McrDcimvacIop = InstObjParams("mcr", "McrDcimvac",
1136 {"memacc_code": McrDcCheckCode,
1138 "ea_code": McrDcimvacCode,
1139 "predicate_test": predicateTest},
1140 ['IsMemRef', 'IsStore'])
1141 header_output += MiscRegRegImmMemOpDeclare.subst(McrDcimvacIop)
1142 decoder_output += MiscRegRegImmOpConstructor.subst(McrDcimvacIop)
1143 exec_output += Mcr15Execute.subst(McrDcimvacIop) + \
1144 Mcr15InitiateAcc.subst(McrDcimvacIop) + \
1145 Mcr15CompleteAcc.subst(McrDcimvacIop)
1147 McrDccmvacCode = '''
1148 const Request::Flags memAccessFlags(Request::CLEAN |
1152 McrDccmvacIop = InstObjParams("mcr", "McrDccmvac",
1154 {"memacc_code": McrDcCheckCode,
1156 "ea_code": McrDccmvacCode,
1157 "predicate_test": predicateTest},
1158 ['IsMemRef', 'IsStore'])
1159 header_output += MiscRegRegImmMemOpDeclare.subst(McrDccmvacIop)
1160 decoder_output += MiscRegRegImmOpConstructor.subst(McrDccmvacIop)
1161 exec_output += Mcr15Execute.subst(McrDccmvacIop) + \
1162 Mcr15InitiateAcc.subst(McrDccmvacIop) + \
1163 Mcr15CompleteAcc.subst(McrDccmvacIop)
1165 McrDccmvauCode = '''
1166 const Request::Flags memAccessFlags(Request::CLEAN |
1170 McrDccmvauIop = InstObjParams("mcr", "McrDccmvau",
1172 {"memacc_code": McrDcCheckCode,
1174 "ea_code": McrDccmvauCode,
1175 "predicate_test": predicateTest},
1176 ['IsMemRef', 'IsStore'])
1177 header_output += MiscRegRegImmMemOpDeclare.subst(McrDccmvauIop)
1178 decoder_output += MiscRegRegImmOpConstructor.subst(McrDccmvauIop)
1179 exec_output += Mcr15Execute.subst(McrDccmvauIop) + \
1180 Mcr15InitiateAcc.subst(McrDccmvauIop) + \
1181 Mcr15CompleteAcc.subst(McrDccmvauIop)
1183 McrDccimvacCode = '''
1184 const Request::Flags memAccessFlags(Request::CLEAN |
1185 Request::INVALIDATE |
1189 McrDccimvacIop = InstObjParams("mcr", "McrDccimvac",
1191 {"memacc_code": McrDcCheckCode,
1193 "ea_code": McrDccimvacCode,
1194 "predicate_test": predicateTest},
1195 ['IsMemRef', 'IsStore'])
1196 header_output += MiscRegRegImmMemOpDeclare.subst(McrDccimvacIop)
1197 decoder_output += MiscRegRegImmOpConstructor.subst(McrDccimvacIop)
1198 exec_output += Mcr15Execute.subst(McrDccimvacIop) + \
1199 Mcr15InitiateAcc.subst(McrDccimvacIop) + \
1200 Mcr15CompleteAcc.subst(McrDccimvacIop)
1203 // If the barrier is due to a CP15 access check for hyp traps
1204 if ((imm != 0) && mcrMrc15TrapToHyp(MISCREG_CP15ISB,
1205 xc->tcBase(), imm)) {
1206 return std::make_shared<HypervisorTrap>(machInst, imm,
1207 EC_TRAPPED_CP15_MCR_MRC);
1210 isbIop = InstObjParams("isb", "Isb", "ImmOp",
1212 "predicate_test": predicateTest},
1214 header_output += ImmOpDeclare.subst(isbIop)
1215 decoder_output += ImmOpConstructor.subst(isbIop)
1216 exec_output += PredOpExecute.subst(isbIop)
1219 // If the barrier is due to a CP15 access check for hyp traps
1220 if ((imm != 0) && mcrMrc15TrapToHyp(MISCREG_CP15DSB,
1221 xc->tcBase(), imm)) {
1222 return std::make_shared<HypervisorTrap>(machInst, imm,
1223 EC_TRAPPED_CP15_MCR_MRC);
1226 dsbIop = InstObjParams("dsb", "Dsb", "ImmOp",
1228 "predicate_test": predicateTest},
1229 ['IsMemBarrier', 'IsSerializeAfter'])
1230 header_output += ImmOpDeclare.subst(dsbIop)
1231 decoder_output += ImmOpConstructor.subst(dsbIop)
1232 exec_output += PredOpExecute.subst(dsbIop)
1235 // If the barrier is due to a CP15 access check for hyp traps
1236 if ((imm != 0) && mcrMrc15TrapToHyp(MISCREG_CP15DMB,
1237 xc->tcBase(), imm)) {
1238 return std::make_shared<HypervisorTrap>(machInst, imm,
1239 EC_TRAPPED_CP15_MCR_MRC);
1242 dmbIop = InstObjParams("dmb", "Dmb", "ImmOp",
1244 "predicate_test": predicateTest},
1246 header_output += ImmOpDeclare.subst(dmbIop)
1247 decoder_output += ImmOpConstructor.subst(dmbIop)
1248 exec_output += PredOpExecute.subst(dmbIop)
1252 dbgIop = InstObjParams("dbg", "Dbg", "PredOp",
1254 "predicate_test": predicateTest})
1255 header_output += BasicDeclare.subst(dbgIop)
1256 decoder_output += BasicConstructor.subst(dbgIop)
1257 exec_output += PredOpExecute.subst(dbgIop)
1260 uint32_t mode = bits(imm, 4, 0);
1261 uint32_t f = bits(imm, 5);
1262 uint32_t i = bits(imm, 6);
1263 uint32_t a = bits(imm, 7);
1264 bool setMode = bits(imm, 8);
1265 bool enable = bits(imm, 9);
1267 SCTLR sctlr = Sctlr;
1268 if (cpsr.mode != MODE_USER) {
1274 if (f && !sctlr.nmfi) cpsr.f = 1;
1284 cpsIop = InstObjParams("cps", "Cps", "ImmOp",
1286 "predicate_test": predicateTest },
1287 ["IsSerializeAfter","IsNonSpeculative"])
1288 header_output += ImmOpDeclare.subst(cpsIop)
1289 decoder_output += ImmOpConstructor.subst(cpsIop)
1290 exec_output += PredOpExecute.subst(cpsIop)