gem5 v24.0.0.0
Loading...
Searching...
No Matches
isa.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010-2024 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#include "arch/arm/isa.hh"
39
40#include "arch/arm/decoder.hh"
41#include "arch/arm/faults.hh"
42#include "arch/arm/htm.hh"
44#include "arch/arm/mmu.hh"
45#include "arch/arm/pmu.hh"
46#include "arch/arm/regs/misc.hh"
49#include "arch/arm/system.hh"
50#include "arch/arm/utility.hh"
52#include "base/cprintf.hh"
53#include "base/random.hh"
54#include "cpu/base.hh"
55#include "cpu/checker/cpu.hh"
56#include "cpu/reg_class.hh"
57#include "debug/Arm.hh"
58#include "debug/LLSC.hh"
59#include "debug/MatRegs.hh"
60#include "debug/VecPredRegs.hh"
61#include "debug/VecRegs.hh"
63#include "dev/arm/gic_v3.hh"
65#include "params/ArmISA.hh"
66#include "sim/faults.hh"
67#include "sim/stat_control.hh"
68#include "sim/system.hh"
69
70namespace gem5
71{
72
73namespace ArmISA
74{
75
76using namespace misc_regs;
77
78namespace
79{
80
81/* Not applicable to ARM */
82RegClass floatRegClass(FloatRegClass, FloatRegClassName, 0, debug::FloatRegs);
83
84} // anonymous namespace
85
86ISA::ISA(const Params &p) : BaseISA(p, "arm"), system(NULL),
87 _decoderFlavor(p.decoderFlavor), pmu(p.pmu), impdefAsNop(p.impdef_nop)
88{
89 _regClasses.push_back(&flatIntRegClass);
90 _regClasses.push_back(&floatRegClass);
91 _regClasses.push_back(&vecRegClass);
92 _regClasses.push_back(&vecElemClass);
93 _regClasses.push_back(&vecPredRegClass);
94 _regClasses.push_back(&matRegClass);
95 _regClasses.push_back(&ccRegClass);
96 _regClasses.push_back(&miscRegClass);
97
98 // Hook up a dummy device if we haven't been configured with a
99 // real PMU. By using a dummy device, we don't need to check that
100 // the PMU exist every time we try to access a PMU register.
101 if (!pmu)
102 pmu = &dummyDevice;
103
104 // Give all ISA devices a pointer to this ISA
105 pmu->setISA(this);
106
107 system = dynamic_cast<ArmSystem *>(p.system);
108
109 // Cache system-level properties
110 if (FullSystem && system) {
115 sveVL = system->sveVL();
116 smeVL = system->smeVL();
117
119 } else {
120 highestELIs64 = true; // ArmSystem::highestELIs64 does the same
121 highestEL = EL1; // ArmSystem::highestEL does the same
122 haveLargeAsid64 = false;
123 physAddrRange = 32; // dummy value
124 sveVL = p.sve_vl_se;
125 smeVL = p.sme_vl_se;
126
127 release = p.release_se;
128 }
129
130 selfDebug = new SelfDebug();
133
134 clear();
135}
136
137void
139{
140 // Invalidate cached copies of miscregs in the TLBs
141 if (tc) {
143 }
144
145 for (auto idx = 0; idx < NUM_MISCREGS; idx++) {
146 miscRegs[idx] = lookUpMiscReg[idx].reset();
147 }
148
150}
151
152void
154{
156
157 if (tc) {
159
160 if (release->has(ArmExtension::TME)) {
161 std::unique_ptr<BaseHTMCheckpoint> cpt(new HTMCheckpoint());
162 tc->setHtmCheckpointPtr(std::move(cpt));
163 }
164 }
165}
166
167void
169{
171
172 if (!system)
173 return;
174
175 selfDebug->init(tc);
176
177 if (auto gicv3_ifc = getGICv3CPUInterface(tc); gicv3_ifc) {
178 gicv3_ifc->setISA(this);
179 gicv3_ifc->setThreadContext(tc);
180 }
181}
182
183void
185{
186 tc = new_tc;
188}
189
190void
192{
193 for (auto &id: flatIntRegClass)
194 tc->setReg(id, src->getReg(id));
195
196 for (auto &id: ccRegClass)
197 tc->setReg(id, src->getReg(id));
198
199 for (int i = 0; i < NUM_MISCREGS; i++)
201
203 for (auto &id: vecRegClass) {
204 src->getReg(id, &vc);
205 tc->setReg(id, &vc);
206 }
207
208 for (auto &id: vecElemClass)
209 tc->setReg(id, src->getReg(id));
210
212 for (auto &id: matRegClass) {
213 src->getReg(id, &mc);
214 tc->setReg(id, &mc);
215 }
216
217 // setMiscReg "with effect" will set the misc register mapping correctly.
218 // e.g. updateRegMap(val)
220
221 // Copy over the PC State
222 tc->pcState(src->pcState());
223
224 // Invalidate the tlb misc register cache
225 static_cast<MMU *>(tc->getMMUPtr())->invalidateMiscReg();
226}
227
232int
234{
235 const HCR hcr = readMiscRegNoEffect(MISCREG_HCR_EL2);
236 if (hcr.e2h == 0x0)
237 return misc_reg;
239 bool sec_el2 = scr.eel2 && release->has(ArmExtension::FEAT_SEL2);
240 switch(misc_reg) {
241 case MISCREG_SPSR_EL1:
242 return currEL() == EL2 ? MISCREG_SPSR_EL2 : misc_reg;
243 case MISCREG_ELR_EL1:
244 return currEL() == EL2 ? MISCREG_ELR_EL2 : misc_reg;
246 return currEL() == EL2 ? MISCREG_SCTLR_EL2 : misc_reg;
248 return currEL() == EL2 ? MISCREG_CPTR_EL2 : misc_reg;
249// case MISCREG_TRFCR_EL1:
250// return currEL() == EL2 ? MISCREG_TRFCR_EL2 : misc_reg;
252 return currEL() == EL2 ? MISCREG_TTBR0_EL2 : misc_reg;
254 return currEL() == EL2 ? MISCREG_TTBR1_EL2 : misc_reg;
255 case MISCREG_TCR_EL1:
256 return currEL() == EL2 ? MISCREG_TCR_EL2 : misc_reg;
258 return currEL() == EL2 ? MISCREG_AFSR0_EL2 : misc_reg;
260 return currEL() == EL2 ? MISCREG_AFSR1_EL2 : misc_reg;
261 case MISCREG_ESR_EL1:
262 return currEL() == EL2 ? MISCREG_ESR_EL2 : misc_reg;
263 case MISCREG_FAR_EL1:
264 return currEL() == EL2 ? MISCREG_FAR_EL2 : misc_reg;
265 case MISCREG_MAIR_EL1:
266 return currEL() == EL2 ? MISCREG_MAIR_EL2 : misc_reg;
268 return currEL() == EL2 ? MISCREG_AMAIR_EL2 : misc_reg;
269 case MISCREG_VBAR_EL1:
270 return currEL() == EL2 ? MISCREG_VBAR_EL2 : misc_reg;
272 return currEL() == EL2 ? MISCREG_CONTEXTIDR_EL2 : misc_reg;
274 return currEL() == EL2 ? MISCREG_CNTHCTL_EL2 : misc_reg;
276 return currEL() == EL2 ? MISCREG_MPAM2_EL2 : misc_reg;
279 if (ELIsInHost(tc, currEL())) {
280 return sec_el2 && !scr.ns ? MISCREG_CNTHPS_TVAL_EL2:
282 } else {
283 return misc_reg;
284 }
285 case MISCREG_CNTP_CTL:
287 if (ELIsInHost(tc, currEL())) {
288 return sec_el2 && !scr.ns ? MISCREG_CNTHPS_CTL_EL2:
290 } else {
291 return misc_reg;
292 }
295 if (ELIsInHost(tc, currEL())) {
296 return sec_el2 && !scr.ns ? MISCREG_CNTHPS_CVAL_EL2:
298 } else {
299 return misc_reg;
300 }
303 if (ELIsInHost(tc, currEL())) {
304 return sec_el2 && !scr.ns ? MISCREG_CNTHVS_TVAL_EL2:
306 } else {
307 return misc_reg;
308 }
309 case MISCREG_CNTV_CTL:
311 if (ELIsInHost(tc, currEL())) {
312 return sec_el2 && !scr.ns ? MISCREG_CNTHVS_CTL_EL2:
314 } else {
315 return misc_reg;
316 }
319 if (ELIsInHost(tc, currEL())) {
320 return sec_el2 && !scr.ns ? MISCREG_CNTHVS_CVAL_EL2:
322 } else {
323 return misc_reg;
324 }
325 case MISCREG_CNTVCT:
327 return ELIsInHost(tc, currEL()) ? MISCREG_CNTPCT_EL0 : misc_reg;
329 return MISCREG_SCTLR_EL1;
331 return MISCREG_SCTLR2_EL1;
333 return MISCREG_CPACR_EL1;
334 case MISCREG_ZCR_EL12:
335 return MISCREG_ZCR_EL1;
337 return MISCREG_TTBR0_EL1;
339 return MISCREG_TTBR1_EL1;
340 case MISCREG_TCR_EL12:
341 return MISCREG_TCR_EL1;
343 return MISCREG_TCR2_EL1;
345 return MISCREG_SPSR_EL1;
346 case MISCREG_ELR_EL12:
347 return MISCREG_ELR_EL1;
349 return MISCREG_AFSR0_EL1;
351 return MISCREG_AFSR1_EL1;
352 case MISCREG_ESR_EL12:
353 return MISCREG_ESR_EL1;
354 case MISCREG_FAR_EL12:
355 return MISCREG_FAR_EL1;
357 return MISCREG_MAIR_EL1;
359 return MISCREG_AMAIR_EL1;
361 return MISCREG_VBAR_EL1;
365 return MISCREG_CNTKCTL_EL1;
367 return MISCREG_MPAM1_EL1;
368 // _EL02 registers
381 default:
382 return misc_reg;
383 }
384}
385
386RegVal
388{
389 assert(idx < NUM_MISCREGS);
390
391 const auto &reg = lookUpMiscReg[idx]; // bit masks
392 const auto &map = getMiscIndices(idx);
393 int lower = map.first, upper = map.second;
394 // NB!: apply architectural masks according to desired register,
395 // despite possibly getting value from different (mapped) register.
396 auto val = !upper ? miscRegs[lower] : ((miscRegs[lower] & mask(32))
397 |(miscRegs[upper] << 32));
398 if (val & reg.res0()) {
399 DPRINTF(MiscRegs, "Reading MiscReg %s with set res0 bits: %#x\n",
400 miscRegName[idx], val & reg.res0());
401 }
402 if ((val & reg.res1()) != reg.res1()) {
403 DPRINTF(MiscRegs, "Reading MiscReg %s with clear res1 bits: %#x\n",
404 miscRegName[idx], (val & reg.res1()) ^ reg.res1());
405 }
406 return (val & ~reg.raz()) | reg.rao(); // enforce raz/rao
407}
408
409
410RegVal
412{
413 CPSR cpsr = 0;
414 SCR scr = 0;
415
416 if (idx == MISCREG_CPSR) {
417 cpsr = miscRegs[idx];
418 auto pc = tc->pcState().as<PCState>();
419 cpsr.t = pc.thumb() ? 1 : 0;
420 return cpsr;
421 }
422
423#ifndef NDEBUG
424 auto& miscreg_info = lookUpMiscReg[idx].info;
425 if (!miscreg_info[MISCREG_IMPLEMENTED]) {
426 if (miscreg_info[MISCREG_WARN_NOT_FAIL])
427 warn("Unimplemented system register %s read.\n",
428 miscRegName[idx]);
429 else
430 panic("Unimplemented system register %s read.\n",
431 miscRegName[idx]);
432 }
433#endif
434 idx = redirectRegVHE(idx);
435
436 switch (unflattenMiscReg(idx)) {
437 case MISCREG_CPACR:
438 {
439 const uint32_t ones = (uint32_t)(-1);
440 CPACR cpacrMask = 0;
441 // Only cp10, cp11, and ase are implemented, nothing else should
442 // be readable? (straight copy from the write code)
443 cpacrMask.cp10 = ones;
444 cpacrMask.cp11 = ones;
445 cpacrMask.asedis = ones;
446
447 // Security Extensions may limit the readability of CPACR
448 if (release->has(ArmExtension::SECURITY)) {
451 if (scr.ns && (cpsr.mode != MODE_MON) && ELIs32(tc, EL3)) {
452 NSACR nsacr = readMiscRegNoEffect(MISCREG_NSACR);
453 // NB: Skipping the full loop, here
454 if (!nsacr.cp10) cpacrMask.cp10 = 0;
455 if (!nsacr.cp11) cpacrMask.cp11 = 0;
456 }
457 }
459 val &= cpacrMask;
460 DPRINTF(MiscRegs, "Reading misc reg %s: %#x\n",
461 miscRegName[idx], val);
462 return val;
463 }
464 case MISCREG_MPIDR:
466 return readMPIDR(system, tc);
467 case MISCREG_ID_AFR0: // not implemented, so alias MIDR
468 case MISCREG_REVIDR: // not implemented, so alias MIDR
469 case MISCREG_MIDR:
470 case MISCREG_MIDR_EL1:
471 if (currEL() == EL1 && EL2Enabled(tc)) {
473 } else {
474 return readMiscRegNoEffect(idx);
475 }
476 break;
477
478 case MISCREG_CLIDR:
479 warn_once("The clidr register always reports 0 caches.\n");
480 warn_once("clidr LoUIS field of 0b001 to match current "
481 "ARM implementations.\n");
482 return 0x00200000;
483 case MISCREG_CCSIDR:
484 warn_once("The ccsidr register isn't implemented and "
485 "always reads as 0.\n");
486 break;
487 case MISCREG_ACTLR:
488 warn("Not doing anything for miscreg ACTLR\n");
489 break;
490
495 return pmu->readMiscReg(idx);
496
497 case MISCREG_CPSR_Q:
498 panic("shouldn't be reading this register seperately\n");
499 case MISCREG_FPSCR_QC:
500 return readMiscRegNoEffect(MISCREG_FPSCR) & ~FpscrQcMask;
502 return readMiscRegNoEffect(MISCREG_FPSCR) & ~FpscrExcMask;
503 case MISCREG_FPSR:
504 {
505 const uint32_t ones = (uint32_t)(-1);
506 FPSCR fpscrMask = 0;
507 fpscrMask.ioc = ones;
508 fpscrMask.dzc = ones;
509 fpscrMask.ofc = ones;
510 fpscrMask.ufc = ones;
511 fpscrMask.ixc = ones;
512 fpscrMask.idc = ones;
513 fpscrMask.qc = ones;
514 fpscrMask.v = ones;
515 fpscrMask.c = ones;
516 fpscrMask.z = ones;
517 fpscrMask.n = ones;
518 return readMiscRegNoEffect(MISCREG_FPSCR) & (uint32_t)fpscrMask;
519 }
520 case MISCREG_FPCR:
521 {
522 const uint32_t ones = (uint32_t)(-1);
523 FPSCR fpscrMask = 0;
524 fpscrMask.len = ones;
525 fpscrMask.fz16 = ones;
526 fpscrMask.stride = ones;
527 fpscrMask.rMode = ones;
528 fpscrMask.fz = ones;
529 fpscrMask.dn = ones;
530 fpscrMask.ahp = ones;
531 return readMiscRegNoEffect(MISCREG_FPSCR) & (uint32_t)fpscrMask;
532 }
533 case MISCREG_NZCV:
534 {
535 CPSR cpsr = 0;
536 cpsr.nz = tc->getReg(cc_reg::Nz);
537 cpsr.c = tc->getReg(cc_reg::C);
538 cpsr.v = tc->getReg(cc_reg::V);
539 return cpsr;
540 }
541 case MISCREG_DAIF:
542 {
543 CPSR cpsr = 0;
544 cpsr.daif = (uint8_t) ((CPSR) miscRegs[MISCREG_CPSR]).daif;
545 return cpsr;
546 }
547 case MISCREG_SP_EL0:
548 {
549 return tc->getReg(int_reg::Sp0);
550 }
551 case MISCREG_SP_EL1:
552 {
553 return tc->getReg(int_reg::Sp1);
554 }
555 case MISCREG_SP_EL2:
556 {
557 return tc->getReg(int_reg::Sp2);
558 }
559 case MISCREG_SPSEL:
560 {
561 return miscRegs[MISCREG_CPSR] & 0x1;
562 }
564 {
565 return miscRegs[MISCREG_CPSR] & 0xc;
566 }
567 case MISCREG_PAN:
568 {
569 return miscRegs[MISCREG_CPSR] & 0x400000;
570 }
571 case MISCREG_UAO:
572 {
573 return miscRegs[MISCREG_CPSR] & 0x800000;
574 }
575 case MISCREG_L2CTLR:
576 {
577 // mostly unimplemented, just set NumCPUs field from sim and return
578 L2CTLR l2ctlr = 0;
579 // b00:1CPU to b11:4CPUs
580 l2ctlr.numCPUs = tc->getSystemPtr()->threads.size() - 1;
581 return l2ctlr;
582 }
583 case MISCREG_ISR:
584 case MISCREG_ISR_EL1:
585 {
586 auto ic = dynamic_cast<ArmISA::Interrupts *>(
588 return ic->getISR(
592 }
593 case MISCREG_HCPTR:
594 {
595 HCPTR val = readMiscRegNoEffect(idx);
596 bool secure_lookup = release->has(ArmExtension::SECURITY) &&
597 isSecure(tc);
598 if (!secure_lookup) {
599 NSACR nsacr = readMiscRegNoEffect(MISCREG_NSACR);
600 if (!nsacr.cp10) {
601 val.tcp10 = 1;
602 val.tcp11 = 1;
603 }
604 }
605 return val;
606 }
607 case MISCREG_HDFAR: // alias for secure DFAR
609 case MISCREG_HIFAR: // alias for secure IFAR
611
613 {
616 tc, highestEL).mpamEn;
617 mpam1.el1.forcedNs = isSecure(tc) ?
618 readRegisterNoEffect<MpamAccessor>(tc, EL3).el3.forceNs : 0;
619 return mpam1;
620 }
622 {
625 tc, highestEL).mpamEn;
626 return mpam2;
627 }
628
629 case MISCREG_RNDR:
633 return random_mt.random<RegVal>();
634 case MISCREG_RNDRRS:
638 // Note: we are not reseeding
639 // The random number generator already has an hardcoded
640 // seed for the sake of determinism. There is no point
641 // in simulating non-determinism here
642 return random_mt.random<RegVal>();
643
644 // Generic Timer registers
647 return getGenericTimer().readMiscReg(idx);
648
652 return getGICv3CPUInterface().readMiscReg(idx);
653
654 default:
655 break;
656
657 }
658 return readMiscRegNoEffect(idx);
659}
660
661void
663{
664 assert(idx < NUM_MISCREGS);
665
666 const auto &reg = lookUpMiscReg[idx]; // bit masks
667 const auto &map = getMiscIndices(idx);
668 int lower = map.first, upper = map.second;
669
670 auto v = (val & ~reg.wi()) | reg.rao();
671 if (upper > 0) {
672 miscRegs[lower] = bits(v, 31, 0);
673 miscRegs[upper] = bits(v, 63, 32);
674 DPRINTF(MiscRegs, "Writing MiscReg %s (%d %d:%d) : %#x\n",
675 miscRegName[idx], idx, lower, upper, v);
676 } else {
677 miscRegs[lower] = v;
678 DPRINTF(MiscRegs, "Writing MiscReg %s (%d %d) : %#x\n",
679 miscRegName[idx], idx, lower, v);
680 }
681}
682
683void
685{
686
687 RegVal newVal = val;
688 bool secure_lookup;
689 SCR scr;
690
691 if (idx == MISCREG_CPSR) {
693
694
695 CPSR old_cpsr = miscRegs[MISCREG_CPSR];
696 int old_mode = old_cpsr.mode;
697 CPSR cpsr = val;
698 if (cpsr.pan != old_cpsr.pan || cpsr.il != old_cpsr.il) {
700 }
701
702 DPRINTF(Arm, "Updating CPSR from %#x to %#x f:%d i:%d a:%d mode:%#x\n",
703 miscRegs[idx], cpsr, cpsr.f, cpsr.i, cpsr.a, cpsr.mode);
704 PCState pc = tc->pcState().as<PCState>();
705 pc.nextThumb(cpsr.t);
706 pc.illegalExec(cpsr.il == 1);
707 selfDebug->setDebugMask(cpsr.d == 1);
708
709 tc->getDecoderPtr()->as<Decoder>().setSveLen(
710 (getCurSveVecLenInBits() >> 7) - 1);
711 tc->getDecoderPtr()->as<Decoder>().setSmeLen(
712 (getCurSmeVecLenInBits() >> 7) - 1);
713
714 // Follow slightly different semantics if a CheckerCPU object
715 // is connected
716 CheckerCPU *checker = tc->getCheckerCpuPtr();
717 if (checker) {
719 } else {
720 tc->pcState(pc);
721 }
722
723 setMiscRegNoEffect(idx, newVal);
724
725 if (old_mode != cpsr.mode) {
727 if (gicv3CpuInterface) {
728 // The assertion and de-assertion of IRQs and FIQs are
729 // affected by the current Exception level and Security
730 // state of the PE. As part of the Context
731 // Synchronization that occurs as the result of taking
732 // or returning from an exception, the CPU interface
733 // ensures that IRQ and FIQ are both appropriately
734 // asserted or deasserted for the Exception level and
735 // Security state that the PE is entering.
736 static_cast<Gicv3CPUInterface&>(
737 getGICv3CPUInterface()).update();
738 }
739 }
740 } else {
741#ifndef NDEBUG
742 auto& miscreg_info = lookUpMiscReg[idx].info;
743 if (!miscreg_info[MISCREG_IMPLEMENTED]) {
744 if (miscreg_info[MISCREG_WARN_NOT_FAIL])
745 warn("Unimplemented system register %s write with %#x.\n",
746 miscRegName[idx], val);
747 else
748 panic("Unimplemented system register %s write with %#x.\n",
749 miscRegName[idx], val);
750 }
751#endif
752 idx = redirectRegVHE(idx);
753
754 switch (unflattenMiscReg(idx)) {
755 case MISCREG_CPACR:
756 {
757
758 const uint32_t ones = (uint32_t)(-1);
759 CPACR cpacrMask = 0;
760 // Only cp10, cp11, and ase are implemented
761 // nothing else should be writable
762 cpacrMask.cp10 = ones;
763 cpacrMask.cp11 = ones;
764 cpacrMask.asedis = ones;
765
766 // Security Extensions may limit the writability of CPACR
767 if (release->has(ArmExtension::SECURITY)) {
770 if (scr.ns && (cpsr.mode != MODE_MON) && ELIs32(tc, EL3)) {
771 NSACR nsacr = readMiscRegNoEffect(MISCREG_NSACR);
772 // NB: Skipping the full loop, here
773 if (!nsacr.cp10) cpacrMask.cp10 = 0;
774 if (!nsacr.cp11) cpacrMask.cp11 = 0;
775 }
776 }
777
779 newVal &= cpacrMask;
780 newVal |= old_val & ~cpacrMask;
781 DPRINTF(MiscRegs, "Writing misc reg %s: %#x\n",
782 miscRegName[idx], newVal);
783 }
784 break;
786 {
787 const uint32_t ones = (uint32_t)(-1);
788 CPACR cpacrMask = 0;
789 cpacrMask.tta = ones;
790 cpacrMask.fpen = ones;
791 if (release->has(ArmExtension::FEAT_SVE)) {
792 cpacrMask.zen = ones;
793 }
794 if (release->has(ArmExtension::FEAT_SME)) {
795 cpacrMask.smen = ones;
796 }
797 newVal &= cpacrMask;
798 DPRINTF(MiscRegs, "Writing misc reg %s: %#x\n",
799 miscRegName[idx], newVal);
800 }
801 break;
802 case MISCREG_CPTR_EL2:
803 {
804 const HCR hcr = readMiscRegNoEffect(MISCREG_HCR_EL2);
805 const uint32_t ones = (uint32_t)(-1);
806 CPTR cptrMask = 0;
807 cptrMask.tcpac = ones;
808 cptrMask.tta = ones;
809 cptrMask.tfp = ones;
810 if (release->has(ArmExtension::FEAT_SVE)) {
811 cptrMask.tz = ones;
812 cptrMask.zen = hcr.e2h ? ones : 0;
813 }
814 if (release->has(ArmExtension::FEAT_SME)) {
815 cptrMask.tsm = ones;
816 cptrMask.smen = hcr.e2h ? ones : 0;
817 }
818 cptrMask.fpen = hcr.e2h ? ones : 0;
819 newVal &= cptrMask;
820 cptrMask = 0;
821 cptrMask.res1_13_el2 = ones;
822 cptrMask.res1_7_0_el2 = ones;
823 if (!release->has(ArmExtension::FEAT_SVE)) {
824 cptrMask.res1_8_el2 = ones;
825 }
826 if (!release->has(ArmExtension::FEAT_SME)) {
827 cptrMask.res1_12_el2 = ones;
828 }
829 cptrMask.res1_9_el2 = ones;
830 newVal |= cptrMask;
831 DPRINTF(MiscRegs, "Writing misc reg %s: %#x\n",
832 miscRegName[idx], newVal);
833 }
834 break;
835 case MISCREG_CPTR_EL3:
836 {
837 const uint32_t ones = (uint32_t)(-1);
838 CPTR cptrMask = 0;
839 cptrMask.tcpac = ones;
840 cptrMask.tta = ones;
841 cptrMask.tfp = ones;
842 if (release->has(ArmExtension::FEAT_SVE)) {
843 cptrMask.ez = ones;
844 }
845 if (release->has(ArmExtension::FEAT_SME)) {
846 cptrMask.esm = ones;
847 }
848 newVal &= cptrMask;
849 DPRINTF(MiscRegs, "Writing misc reg %s: %#x\n",
850 miscRegName[idx], newVal);
851 }
852 break;
853 case MISCREG_CSSELR:
854 warn_once("The csselr register isn't implemented.\n");
855 return;
856
858 warn("Calling DC ZVA! Not Implemeted! Expect WEIRD results\n");
859 return;
860
861 case MISCREG_FPSCR:
862 tc->getDecoderPtr()->as<Decoder>().setContext(newVal);
863 break;
864 case MISCREG_FPSR:
865 {
866 const uint32_t ones = (uint32_t)(-1);
867 FPSCR fpscrMask = 0;
868 fpscrMask.ioc = ones;
869 fpscrMask.dzc = ones;
870 fpscrMask.ofc = ones;
871 fpscrMask.ufc = ones;
872 fpscrMask.ixc = ones;
873 fpscrMask.idc = ones;
874 fpscrMask.qc = ones;
875 fpscrMask.v = ones;
876 fpscrMask.c = ones;
877 fpscrMask.z = ones;
878 fpscrMask.n = ones;
879 newVal = (newVal & (uint32_t)fpscrMask) |
881 ~(uint32_t)fpscrMask);
882 idx = MISCREG_FPSCR;
883 }
884 break;
885 case MISCREG_FPCR:
886 {
887 const uint32_t ones = (uint32_t)(-1);
888 FPSCR fpscrMask = 0;
889 fpscrMask.len = ones;
890 fpscrMask.fz16 = ones;
891 fpscrMask.stride = ones;
892 fpscrMask.rMode = ones;
893 fpscrMask.fz = ones;
894 fpscrMask.dn = ones;
895 fpscrMask.ahp = ones;
896 newVal = (newVal & (uint32_t)fpscrMask) |
898 ~(uint32_t)fpscrMask);
899 idx = MISCREG_FPSCR;
900 }
901 break;
902 case MISCREG_CPSR_Q:
903 {
904 assert(!(newVal & ~CpsrMaskQ));
905 newVal = readMiscRegNoEffect(MISCREG_CPSR) | newVal;
906 idx = MISCREG_CPSR;
907 }
908 break;
909 case MISCREG_FPSCR_QC:
910 {
912 (newVal & FpscrQcMask);
913 idx = MISCREG_FPSCR;
914 }
915 break;
917 {
919 (newVal & FpscrExcMask);
920 idx = MISCREG_FPSCR;
921 }
922 break;
923 case MISCREG_FPEXC:
924 {
925 // vfpv3 architecture, section B.6.1 of DDI04068
926 // bit 29 - valid only if fpexc[31] is 0
927 const uint32_t fpexcMask = 0x60000000;
928 newVal = (newVal & fpexcMask) |
929 (readMiscRegNoEffect(MISCREG_FPEXC) & ~fpexcMask);
930 }
931 break;
932 case MISCREG_HCR:
933 {
934 const HDCR mdcr = tc->readMiscRegNoEffect(MISCREG_MDCR_EL2);
935 selfDebug->setenableTDETGE((HCR)val, mdcr);
936 }
937 break;
938
939 case MISCREG_HDCR:
940 {
941 const HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
942 selfDebug->setenableTDETGE(hcr, (HDCR)val);
943 }
944 break;
945 case MISCREG_DBGOSLAR:
946 {
948 const uint32_t temp = (val == 0xC5ACCE55)? 0x1 : 0x0;
950 r.oslk = bits(temp,0);
952 }
953 break;
956 break;
959 break;
960
961 case MISCREG_MDCR_EL2:
962 {
963 const HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
964 selfDebug->setenableTDETGE(hcr, (HDCR)val);
965 }
966 break;
967 case MISCREG_SDCR:
968 case MISCREG_MDCR_EL3:
969 {
971 }
972 break;
974 {
977 DBGDS32 v = val;
978 r.moe = v.moe;
979 r.udccdis = v.udccdis;
980 r.mdbgen = v.mdbgen;
983 }
984
985 break;
987 {
989 }
990 break;
991
993 {
996 r.oslk = bits(val, 0);
997 r.oslm_3 = 1;
999 }
1000 break;
1001
1004 break;
1007 break;
1008 case MISCREG_SCR:
1010 break;
1011 case MISCREG_SCTLR:
1012 {
1013 DPRINTF(MiscRegs, "Writing SCTLR: %#x\n", newVal);
1015
1016 MiscRegIndex sctlr_idx;
1017 if (release->has(ArmExtension::SECURITY) &&
1018 !highestELIs64 && !scr.ns) {
1019 sctlr_idx = MISCREG_SCTLR_S;
1020 } else {
1021 sctlr_idx = MISCREG_SCTLR_NS;
1022 }
1023
1024 SCTLR sctlr = miscRegs[sctlr_idx];
1025 SCTLR new_sctlr = newVal;
1026 new_sctlr.nmfi = ((bool)sctlr.nmfi) &&
1027 !release->has(ArmExtension::VIRTUALIZATION);
1028 miscRegs[sctlr_idx] = (RegVal)new_sctlr;
1030 }
1031 case MISCREG_MIDR:
1032 case MISCREG_ID_PFR0:
1033 case MISCREG_ID_PFR1:
1034 case MISCREG_ID_DFR0:
1035 case MISCREG_ID_MMFR0:
1036 case MISCREG_ID_MMFR1:
1037 case MISCREG_ID_MMFR2:
1038 case MISCREG_ID_MMFR3:
1039 case MISCREG_ID_MMFR4:
1040 case MISCREG_ID_ISAR0:
1041 case MISCREG_ID_ISAR1:
1042 case MISCREG_ID_ISAR2:
1043 case MISCREG_ID_ISAR3:
1044 case MISCREG_ID_ISAR4:
1045 case MISCREG_ID_ISAR5:
1046
1047 case MISCREG_MPIDR:
1048 case MISCREG_FPSID:
1049 case MISCREG_TLBTR:
1050 case MISCREG_MVFR0:
1051 case MISCREG_MVFR1:
1052
1064 // ID registers are constants.
1065 return;
1066
1067 // TLB Invalidate All
1068 case MISCREG_ACTLR:
1069 warn("Not doing anything for write of miscreg ACTLR\n");
1070 break;
1071
1076 pmu->setMiscReg(idx, newVal);
1077 break;
1078
1079
1080 case MISCREG_HSTR: // TJDBX, now redifined to be RES0
1081 {
1082 HSTR hstrMask = 0;
1083 hstrMask.tjdbx = 1;
1084 newVal &= ~((uint32_t) hstrMask);
1085 break;
1086 }
1087 case MISCREG_HCPTR:
1088 {
1089 // If a CP bit in NSACR is 0 then the corresponding bit in
1090 // HCPTR is RAO/WI. Same applies to NSASEDIS
1091 secure_lookup = release->has(ArmExtension::SECURITY) &&
1092 isSecure(tc);
1093 if (!secure_lookup) {
1095 RegVal mask =
1096 (readMiscRegNoEffect(MISCREG_NSACR) ^ 0x7FFF) & 0xBFFF;
1097 newVal = (newVal & ~mask) | (oldValue & mask);
1098 }
1099 break;
1100 }
1101 case MISCREG_HDFAR: // alias for secure DFAR
1102 idx = MISCREG_DFAR_S;
1103 break;
1104 case MISCREG_HIFAR: // alias for secure IFAR
1105 idx = MISCREG_IFAR_S;
1106 break;
1107 case MISCREG_ATS1CPR:
1109 return;
1110 case MISCREG_ATS1CPW:
1112 return;
1113 case MISCREG_ATS1CUR:
1116 return;
1117 case MISCREG_ATS1CUW:
1120 return;
1121 case MISCREG_ATS12NSOPR:
1122 if (!release->has(ArmExtension::SECURITY))
1123 panic("Security Extensions required for ATS12NSOPR");
1125 return;
1126 case MISCREG_ATS12NSOPW:
1127 if (!release->has(ArmExtension::SECURITY))
1128 panic("Security Extensions required for ATS12NSOPW");
1130 return;
1131 case MISCREG_ATS12NSOUR:
1132 if (!release->has(ArmExtension::SECURITY))
1133 panic("Security Extensions required for ATS12NSOUR");
1136 return;
1137 case MISCREG_ATS12NSOUW:
1138 if (!release->has(ArmExtension::SECURITY))
1139 panic("Security Extensions required for ATS12NSOUW");
1142 return;
1143 case MISCREG_ATS1HR:
1145 return;
1146 case MISCREG_ATS1HW:
1148 return;
1149 case MISCREG_TTBCR:
1150 {
1151 TTBCR ttbcr = readMiscRegNoEffect(MISCREG_TTBCR);
1152 const uint32_t ones = (uint32_t)(-1);
1153 TTBCR ttbcrMask = 0;
1154 TTBCR ttbcrNew = newVal;
1155
1156 // ARM DDI 0406C.b, ARMv7-32
1157 ttbcrMask.n = ones; // T0SZ
1158 if (release->has(ArmExtension::SECURITY)) {
1159 ttbcrMask.pd0 = ones;
1160 ttbcrMask.pd1 = ones;
1161 }
1162 ttbcrMask.epd0 = ones;
1163 ttbcrMask.irgn0 = ones;
1164 ttbcrMask.orgn0 = ones;
1165 ttbcrMask.sh0 = ones;
1166 ttbcrMask.ps = ones; // T1SZ
1167 ttbcrMask.a1 = ones;
1168 ttbcrMask.epd1 = ones;
1169 ttbcrMask.irgn1 = ones;
1170 ttbcrMask.orgn1 = ones;
1171 ttbcrMask.sh1 = ones;
1172 if (release->has(ArmExtension::LPAE))
1173 ttbcrMask.eae = ones;
1174
1175 if (release->has(ArmExtension::LPAE) && ttbcrNew.eae) {
1176 newVal = newVal & ttbcrMask;
1177 } else {
1178 newVal = (newVal & ttbcrMask) | (ttbcr & (~ttbcrMask));
1179 }
1180 // Invalidate TLB MiscReg
1182 break;
1183 }
1184 case MISCREG_TTBR0:
1185 case MISCREG_TTBR1:
1186 {
1187 TTBCR ttbcr = readMiscRegNoEffect(MISCREG_TTBCR);
1188 if (release->has(ArmExtension::LPAE)) {
1189 if (ttbcr.eae) {
1190 // ARMv7 bit 63-56, 47-40 reserved, UNK/SBZP
1191 // ARMv8 AArch32 bit 63-56 only
1192 uint64_t ttbrMask = mask(63,56) | mask(47,40);
1193 newVal = (newVal & (~ttbrMask));
1194 }
1195 }
1196 // Invalidate TLB MiscReg
1198 break;
1199 }
1200 case MISCREG_SCTLR_EL1:
1201 case MISCREG_CONTEXTIDR:
1202 case MISCREG_PRRR:
1203 case MISCREG_NMRR:
1204 case MISCREG_MAIR0:
1205 case MISCREG_MAIR1:
1206 case MISCREG_DACR:
1207 case MISCREG_VTTBR:
1208 case MISCREG_SCR_EL3:
1209 case MISCREG_TCR_EL1:
1210 case MISCREG_TCR_EL2:
1211 case MISCREG_TCR_EL3:
1212 case MISCREG_VTCR_EL2:
1213 case MISCREG_SCTLR_EL2:
1214 case MISCREG_SCTLR_EL3:
1215 case MISCREG_HSCTLR:
1216 case MISCREG_TTBR0_EL1:
1217 case MISCREG_TTBR1_EL1:
1218 case MISCREG_TTBR0_EL2:
1219 case MISCREG_TTBR1_EL2:
1220 case MISCREG_TTBR0_EL3:
1222 break;
1223 case MISCREG_HCR_EL2:
1224 {
1225 const HDCR mdcr = tc->readMiscRegNoEffect(MISCREG_MDCR_EL2);
1226 selfDebug->setenableTDETGE((HCR)val, mdcr);
1228 }
1229 break;
1230 case MISCREG_NZCV:
1231 {
1232 CPSR cpsr = val;
1233
1234 tc->setReg(cc_reg::Nz, cpsr.nz);
1235 tc->setReg(cc_reg::C, cpsr.c);
1236 tc->setReg(cc_reg::V, cpsr.v);
1237 }
1238 break;
1239 case MISCREG_DAIF:
1240 {
1241 CPSR cpsr = miscRegs[MISCREG_CPSR];
1242 cpsr.daif = (uint8_t) ((CPSR) newVal).daif;
1243 newVal = cpsr;
1244 idx = MISCREG_CPSR;
1245 }
1246 break;
1247 case MISCREG_SP_EL0:
1248 tc->setReg(int_reg::Sp0, newVal);
1249 break;
1250 case MISCREG_SP_EL1:
1251 tc->setReg(int_reg::Sp1, newVal);
1252 break;
1253 case MISCREG_SP_EL2:
1254 tc->setReg(int_reg::Sp2, newVal);
1255 break;
1256 case MISCREG_SPSEL:
1257 {
1258 CPSR cpsr = miscRegs[MISCREG_CPSR];
1259 cpsr.sp = (uint8_t) ((CPSR) newVal).sp;
1260 newVal = cpsr;
1261 idx = MISCREG_CPSR;
1262 }
1263 break;
1264 case MISCREG_CURRENTEL:
1265 {
1266 CPSR cpsr = miscRegs[MISCREG_CPSR];
1267 cpsr.el = (uint8_t) ((CPSR) newVal).el;
1268 newVal = cpsr;
1269 idx = MISCREG_CPSR;
1270 }
1271 break;
1272 case MISCREG_PAN:
1273 {
1274 // PAN is affecting data accesses
1276
1277 CPSR cpsr = miscRegs[MISCREG_CPSR];
1278 cpsr.pan = (uint8_t) ((CPSR) newVal).pan;
1279 newVal = cpsr;
1280 idx = MISCREG_CPSR;
1281 }
1282 break;
1283 case MISCREG_UAO:
1284 {
1285 // UAO is affecting data accesses
1287
1288 CPSR cpsr = miscRegs[MISCREG_CPSR];
1289 cpsr.uao = (uint8_t) ((CPSR) newVal).uao;
1290 newVal = cpsr;
1291 idx = MISCREG_CPSR;
1292 }
1293 break;
1296 return;
1299 return;
1303 return;
1307 return;
1310 return;
1313 return;
1316 return;
1319 return;
1323 return;
1327 return;
1330 return;
1333 return;
1334 case MISCREG_L2CTLR:
1335 warn("miscreg L2CTLR (%s) written with %#x. ignored...\n",
1336 miscRegName[idx], uint32_t(val));
1337 break;
1338
1339 // Generic Timer registers
1342 getGenericTimer().setMiscReg(idx, newVal);
1343 break;
1347 getGICv3CPUInterface().setMiscReg(idx, newVal);
1348 return;
1349 case MISCREG_ZCR_EL3:
1350 case MISCREG_ZCR_EL2:
1351 case MISCREG_ZCR_EL1:
1352 // Set the value here as we need to update the regs before
1353 // reading them back in getCurSveVecLenInBits to avoid
1354 // setting stale vector lengths in the decoder.
1355 setMiscRegNoEffect(idx, newVal);
1356 tc->getDecoderPtr()->as<Decoder>().setSveLen(
1357 (getCurSveVecLenInBits() >> 7) - 1);
1358 return;
1359 case MISCREG_SMCR_EL3:
1360 case MISCREG_SMCR_EL2:
1361 case MISCREG_SMCR_EL1:
1362 // Set the value here as we need to update the regs before
1363 // reading them back in getCurSmeVecLenInBits to avoid
1364 // setting stale vector lengths in the decoder.
1365 setMiscRegNoEffect(idx, newVal);
1366 tc->getDecoderPtr()->as<Decoder>().setSmeLen(
1367 (getCurSmeVecLenInBits() >> 7) - 1);
1368 return;
1369 }
1370 setMiscRegNoEffect(idx, newVal);
1371 }
1372}
1373
1374RegVal
1376{
1377 int flat_idx = flattenMiscIndex(idx);
1378 return lookUpMiscReg[flat_idx].reset();
1379}
1380
1381void
1383{
1384 int flat_idx = flattenMiscIndex(idx);
1385 InitReg(flat_idx).reset(val);
1386}
1387
1390{
1391 // We only need to create an ISA interface the first time we try
1392 // to access the timer.
1393 if (timer)
1394 return *timer.get();
1395
1396 assert(system);
1397 GenericTimer *generic_timer(system->getGenericTimer());
1398 if (!generic_timer) {
1399 panic("Trying to get a generic timer from a system that hasn't "
1400 "been configured to use a generic timer.\n");
1401 }
1402
1403 timer.reset(new GenericTimerISA(*generic_timer, tc->contextId()));
1404 timer->setThreadContext(tc);
1405
1406 return *timer.get();
1407}
1408
1411{
1413 return *gicv3CpuInterface.get();
1414
1415 auto gicv3_ifc = getGICv3CPUInterface(tc);
1416 panic_if(!gicv3_ifc, "The system does not have a GICv3 irq controller\n");
1417 gicv3CpuInterface.reset(gicv3_ifc);
1418
1419 return *gicv3CpuInterface.get();
1420}
1421
1424{
1425 assert(system);
1426 Gicv3 *gicv3 = dynamic_cast<Gicv3 *>(system->getGIC());
1427 if (gicv3) {
1428 return gicv3->getCPUInterface(tc->contextId());
1429 } else {
1430 return nullptr;
1431 }
1432}
1433
1434bool
1436{
1437 if (!release->has(ArmExtension::SECURITY)) {
1438 return false;
1439 }
1440
1441 SCR scr = miscRegs[MISCREG_SCR];
1442 CPSR cpsr = miscRegs[MISCREG_CPSR];
1443
1444 switch ((OperatingMode) (uint8_t) cpsr.mode) {
1445 case MODE_MON:
1446 case MODE_EL3T:
1447 case MODE_EL3H:
1448 return true;
1449 case MODE_HYP:
1450 case MODE_EL2T:
1451 case MODE_EL2H:
1452 return false;
1453 default:
1454 return !scr.ns;
1455 }
1456}
1457
1460{
1461 CPSR cpsr = readMiscRegNoEffect(MISCREG_CPSR);
1462
1463 return opModeToEL((OperatingMode)(uint8_t)cpsr.mode);
1464}
1465
1466unsigned
1468{
1469 SVCR svcr = miscRegs[MISCREG_SVCR];
1470 // If we are in Streaming Mode, we should return the Streaming Mode vector
1471 // length instead.
1472 if (svcr.sm) {
1473 return getCurSmeVecLenInBits();
1474 }
1475
1476 if (!FullSystem) {
1477 return sveVL * 128;
1478 }
1479
1480 panic_if(!tc,
1481 "A ThreadContext is needed to determine the SVE vector length "
1482 "in full-system mode");
1483
1484 CPSR cpsr = miscRegs[MISCREG_CPSR];
1485 ExceptionLevel el = (ExceptionLevel) (uint8_t) cpsr.el;
1486
1487 unsigned len = 0;
1488
1489 if (el == EL1 || (el == EL0 && !ELIsInHost(tc, el))) {
1490 len = static_cast<ZCR>(miscRegs[MISCREG_ZCR_EL1]).len;
1491 }
1492
1493 if (el == EL2 || (el == EL0 && ELIsInHost(tc, el))) {
1494 len = static_cast<ZCR>(miscRegs[MISCREG_ZCR_EL2]).len;
1495 } else if (release->has(ArmExtension::VIRTUALIZATION) && !isSecure(tc) &&
1496 (el == EL0 || el == EL1)) {
1497 len = std::min(
1498 len,
1499 static_cast<unsigned>(
1500 static_cast<ZCR>(miscRegs[MISCREG_ZCR_EL2]).len));
1501 }
1502
1503 if (el == EL3) {
1504 len = static_cast<ZCR>(miscRegs[MISCREG_ZCR_EL3]).len;
1505 } else if (release->has(ArmExtension::SECURITY)) {
1506 len = std::min(
1507 len,
1508 static_cast<unsigned>(
1509 static_cast<ZCR>(miscRegs[MISCREG_ZCR_EL3]).len));
1510 }
1511
1512 len = std::min(len, sveVL - 1);
1513
1514 return (len + 1) * 128;
1515}
1516
1517unsigned
1519{
1520 if (!FullSystem) {
1521 return smeVL * 128;
1522 }
1523
1524 panic_if(!tc,
1525 "A ThreadContext is needed to determine the SME vector length "
1526 "in full-system mode");
1527
1528 CPSR cpsr = miscRegs[MISCREG_CPSR];
1529 ExceptionLevel el = (ExceptionLevel) (uint8_t) cpsr.el;
1530
1531 unsigned len = 0;
1532
1533 if (el == EL1 || (el == EL0 && !ELIsInHost(tc, el))) {
1534 len = static_cast<SMCR>(miscRegs[MISCREG_SMCR_EL1]).len;
1535 }
1536
1537 if (el == EL2 || (el == EL0 && ELIsInHost(tc, el))) {
1538 len = static_cast<SMCR>(miscRegs[MISCREG_SMCR_EL2]).len;
1539 } else if (release->has(ArmExtension::VIRTUALIZATION) && !isSecure(tc) &&
1540 (el == EL0 || el == EL1)) {
1541 len = std::min(
1542 len,
1543 static_cast<unsigned>(
1544 static_cast<SMCR>(miscRegs[MISCREG_SMCR_EL2]).len));
1545 }
1546
1547 if (el == EL3) {
1548 len = static_cast<SMCR>(miscRegs[MISCREG_SMCR_EL3]).len;
1549 } else if (release->has(ArmExtension::SECURITY)) {
1550 len = std::min(
1551 len,
1552 static_cast<unsigned>(
1553 static_cast<SMCR>(miscRegs[MISCREG_SMCR_EL3]).len));
1554 }
1555
1556 len = std::min(len, smeVL - 1);
1557
1558 // len + 1 must be a power of 2! Round down to the nearest whole power of
1559 // two.
1560 static const unsigned LUT[16] = {0, 1, 1, 3, 3, 3, 3, 7,
1561 7, 7, 7, 7, 7, 7, 7, 15};
1562 len = LUT[len];
1563
1564 return (len + 1) * 128;
1565}
1566
1567void
1569{
1571
1572 DPRINTF(Checkpoint, "Serializing Arm Misc Registers\n");
1574}
1575
1576void
1578{
1579 DPRINTF(Checkpoint, "Unserializing Arm Misc Registers\n");
1581
1582 for (auto idx = 0; idx < NUM_MISCREGS; idx++) {
1583 if (!lookUpMiscReg[idx].info[MISCREG_UNSERIALIZE] &&
1584 miscRegs[idx] != lookUpMiscReg[idx].reset()) {
1585 warn("Checkpoint value for register %s does not match "
1586 "current configuration (checkpointed: %#x, current: %#x)",
1587 miscRegName[idx], miscRegs[idx],
1588 lookUpMiscReg[idx].reset());
1589 miscRegs[idx] = lookUpMiscReg[idx].reset();
1590 }
1591 }
1592
1593 CPSR tmp_cpsr = miscRegs[MISCREG_CPSR];
1594 updateRegMap(tmp_cpsr);
1595}
1596
1597void
1600{
1601 // If we're in timing mode then doing the translation in
1602 // functional mode then we're slightly distorting performance
1603 // results obtained from simulations. The translation should be
1604 // done in the same mode the core is running in. NOTE: This
1605 // can't be an atomic translation because that causes problems
1606 // with unexpected atomic snoop requests.
1607 warn_once("Doing AT (address translation) in functional mode! Fix Me!\n");
1608
1609 auto req = std::make_shared<Request>(
1611 tc->pcState().instAddr(), tc->contextId());
1612
1614 req, tc, mode, tran_type);
1615
1616 PAR par = 0;
1617 if (fault == NoFault) {
1618 Addr paddr = req->getPaddr();
1619 uint64_t attr = getMMUPtr(tc)->getAttr();
1620 uint64_t attr1 = attr >> 56;
1621 if (!attr1 || attr1 ==0x44) {
1622 attr |= 0x100;
1623 attr &= ~ uint64_t(0x80);
1624 }
1625 par = (paddr & mask(47, 12)) | attr;
1626 DPRINTF(MiscRegs,
1627 "MISCREG: Translated addr %#x: PAR_EL1: %#xx\n",
1628 val, par);
1629 } else {
1630 ArmFault *arm_fault = static_cast<ArmFault *>(fault.get());
1631 arm_fault->update(tc);
1632 // Set fault bit and FSR
1633 FSR fsr = arm_fault->getFsr(tc);
1634
1635 par.f = 1; // F bit
1636 par.fst = fsr.status; // FST
1637 par.ptw = (arm_fault->iss() >> 7) & 0x1; // S1PTW
1638 par.s = arm_fault->isStage2() ? 1 : 0; // S
1639
1640 DPRINTF(MiscRegs,
1641 "MISCREG: Translated addr %#x fault fsr %#x: PAR: %#x\n",
1642 val, fsr, par);
1643 }
1645 return;
1646}
1647
1648void
1651{
1652 // If we're in timing mode then doing the translation in
1653 // functional mode then we're slightly distorting performance
1654 // results obtained from simulations. The translation should be
1655 // done in the same mode the core is running in. NOTE: This
1656 // can't be an atomic translation because that causes problems
1657 // with unexpected atomic snoop requests.
1658 warn_once("Doing AT (address translation) in functional mode! Fix Me!\n");
1659
1660 auto req = std::make_shared<Request>(
1662 tc->pcState().instAddr(), tc->contextId());
1663
1665 req, tc, mode, tran_type);
1666
1667 PAR par = 0;
1668 if (fault == NoFault) {
1669 Addr paddr = req->getPaddr();
1670 TTBCR ttbcr = readMiscRegNoEffect(MISCREG_TTBCR);
1672
1673 uint8_t max_paddr_bit = 0;
1674 if (release->has(ArmExtension::LPAE) &&
1675 (ttbcr.eae || tran_type & MMU::HypMode ||
1676 ((tran_type & MMU::S1S2NsTran) && hcr.vm) )) {
1677
1678 max_paddr_bit = 39;
1679 } else {
1680 max_paddr_bit = 31;
1681 }
1682
1683 par = (paddr & mask(max_paddr_bit, 12)) |
1684 (getMMUPtr(tc)->getAttr());
1685
1686 DPRINTF(MiscRegs,
1687 "MISCREG: Translated addr 0x%08x: PAR: 0x%08x\n",
1688 val, par);
1689 } else {
1690 ArmFault *arm_fault = static_cast<ArmFault *>(fault.get());
1691 arm_fault->update(tc);
1692 // Set fault bit and FSR
1693 FSR fsr = arm_fault->getFsr(tc);
1694
1695 par.f = 0x1; // F bit
1696 par.lpae = fsr.lpae;
1697 par.ptw = (arm_fault->iss() >> 7) & 0x1;
1698 par.s = arm_fault->isStage2() ? 1 : 0;
1699
1700 if (par.lpae) {
1701 // LPAE - rearange fault status
1702 par.fst = fsr.status;
1703 } else {
1704 // VMSA - rearange fault status
1705 par.fs4_0 = fsr.fsLow | (fsr.fsHigh << 5);
1706 par.fs5 = fsr.ext;
1707 }
1708 DPRINTF(MiscRegs,
1709 "MISCREG: Translated addr 0x%08x fault fsr %#x: PAR: 0x%08x\n",
1710 val, fsr, par);
1711 }
1713 return;
1714}
1715
1716template <class XC>
1717static inline void
1719 Addr cacheBlockMask)
1720{
1721 // Should only every see invalidations / direct writes
1722 assert(pkt->isInvalidate() || pkt->isWrite());
1723
1724 DPRINTF(LLSC, "%s: handling snoop for address: %#x locked: %d\n",
1725 tc->getCpuPtr()->name(), pkt->getAddr(),
1726 xc->readMiscReg(MISCREG_LOCKFLAG));
1727 if (!xc->readMiscReg(MISCREG_LOCKFLAG))
1728 return;
1729
1730 Addr locked_addr = xc->readMiscReg(MISCREG_LOCKADDR) & cacheBlockMask;
1731 // If no caches are attached, the snoop address always needs to be masked
1732 Addr snoop_addr = pkt->getAddr() & cacheBlockMask;
1733
1734 DPRINTF(LLSC, "%s: handling snoop for address: %#x locked addr: %#x\n",
1735 tc->getCpuPtr()->name(), snoop_addr, locked_addr);
1736 if (locked_addr == snoop_addr) {
1737 DPRINTF(LLSC, "%s: address match, clearing lock and signaling sev\n",
1738 tc->getCpuPtr()->name());
1739 xc->setMiscReg(MISCREG_LOCKFLAG, false);
1740 // Implement ARMv8 WFE/SEV semantics
1741 sendEvent(tc);
1742 xc->setMiscReg(MISCREG_SEV_MAILBOX, true);
1743 }
1744}
1745
1746void
1748{
1749 lockedSnoopHandler(tc, tc, pkt, cacheBlockMask);
1750}
1751
1752void
1754{
1755 lockedSnoopHandler(xc->tcBase(), xc, pkt, cacheBlockMask);
1756}
1757
1758void
1760{
1761 tc->setMiscReg(MISCREG_LOCKADDR, req->getPaddr());
1763 DPRINTF(LLSC, "%s: Placing address %#x in monitor\n",
1764 tc->getCpuPtr()->name(), req->getPaddr());
1765}
1766
1767void
1769{
1770 xc->setMiscReg(MISCREG_LOCKADDR, req->getPaddr());
1771 xc->setMiscReg(MISCREG_LOCKFLAG, true);
1772 DPRINTF(LLSC, "%s: Placing address %#x in monitor\n",
1773 xc->tcBase()->getCpuPtr()->name(), req->getPaddr());
1774}
1775
1776void
1778{
1779 DPRINTF(LLSC, "%s: handling snoop lock hit address: %#x\n",
1783}
1784
1785void
1787{
1788 DPRINTF(LLSC, "%s: handling snoop lock hit address: %#x\n",
1789 xc->tcBase()->getCpuPtr()->name(),
1791 xc->setMiscReg(MISCREG_LOCKFLAG, false);
1793}
1794
1795template <class XC>
1796static inline bool
1798 Addr cacheBlockMask)
1799{
1800 if (req->isSwap())
1801 return true;
1802
1803 DPRINTF(LLSC, "Handling locked write for address %#x in monitor.\n",
1804 req->getPaddr());
1805 // Verify that the lock flag is still set and the address
1806 // is correct
1807 bool lock_flag = xc->readMiscReg(MISCREG_LOCKFLAG);
1808 Addr lock_addr = xc->readMiscReg(MISCREG_LOCKADDR) & cacheBlockMask;
1809 if (!lock_flag || (req->getPaddr() & cacheBlockMask) != lock_addr) {
1810 // Lock flag not set or addr mismatch in CPU;
1811 // don't even bother sending to memory system
1812 req->setExtraData(0);
1813 xc->setMiscReg(MISCREG_LOCKFLAG, false);
1814 DPRINTF(LLSC, "clearing lock flag in handle locked write\n",
1815 tc->getCpuPtr()->name());
1816 // the rest of this code is not architectural;
1817 // it's just a debugging aid to help detect
1818 // livelock by warning on long sequences of failed
1819 // store conditionals
1820 int stCondFailures = xc->readStCondFailures();
1821 stCondFailures++;
1822 xc->setStCondFailures(stCondFailures);
1823 if (stCondFailures % 100000 == 0) {
1824 warn("context %d: %d consecutive "
1825 "store conditional failures\n",
1826 tc->contextId(), stCondFailures);
1827 }
1828
1829 // store conditional failed already, so don't issue it to mem
1830 return false;
1831 }
1832 return true;
1833}
1834
1835bool
1836ISA::handleLockedWrite(const RequestPtr &req, Addr cacheBlockMask)
1837{
1838 return lockedWriteHandler(tc, tc, req, cacheBlockMask);
1839}
1840
1841bool
1843 Addr cacheBlockMask)
1844{
1845 return lockedWriteHandler(xc->tcBase(), xc, req, cacheBlockMask);
1846}
1847
1848void
1850{
1851 // A spinlock would typically include a Wait For Event (WFE) to
1852 // conserve energy. The ARMv8 architecture specifies that an event
1853 // is automatically generated when clearing the exclusive monitor
1854 // to wake up the processor in WFE.
1855 DPRINTF(LLSC, "Clearing lock and signaling sev\n");
1857 // Implement ARMv8 WFE/SEV semantics
1858 sendEvent(tc);
1860}
1861
1862void
1864{
1865 // A spinlock would typically include a Wait For Event (WFE) to
1866 // conserve energy. The ARMv8 architecture specifies that an event
1867 // is automatically generated when clearing the exclusive monitor
1868 // to wake up the processor in WFE.
1869 DPRINTF(LLSC, "Clearing lock and signaling sev\n");
1870 xc->setMiscReg(MISCREG_LOCKFLAG, false);
1871 // Implement ARMv8 WFE/SEV semantics
1872 sendEvent(xc->tcBase());
1874}
1875
1876} // namespace ArmISA
1877} // namespace gem5
ISA-specific types for hardware transactional memory.
#define DPRINTF(x,...)
Definition trace.hh:210
virtual FSR getFsr(ThreadContext *tc) const
Definition faults.hh:253
virtual uint32_t iss() const =0
void update(ThreadContext *tc)
Definition faults.cc:413
virtual bool isStage2() const
Definition faults.hh:252
Base class for devices that use the MiscReg interfaces.
Definition isa_device.hh:62
virtual void setMiscReg(int misc_reg, RegVal val)=0
Write to a system register belonging to this device.
virtual void setISA(ISA *isa)
Definition isa_device.cc:55
virtual void setThreadContext(ThreadContext *tc)
Definition isa_device.hh:68
virtual RegVal readMiscReg(int misc_reg)=0
Read a system register belonging to this device.
bool inSecureState() const
Return true if the PE is in Secure state.
Definition isa.cc:1435
void setMiscRegReset(RegIndex, RegVal val)
Definition isa.cc:1382
unsigned getCurSveVecLenInBits() const
Definition isa.cc:1467
ExceptionLevel currEL() const
Returns the current Exception Level (EL) of the ISA object.
Definition isa.cc:1459
void takeOverFrom(ThreadContext *new_tc, ThreadContext *old_tc) override
Definition isa.cc:184
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition isa.cc:1568
void copyRegsFrom(ThreadContext *src) override
Definition isa.cc:191
DummyISADevice dummyDevice
Dummy device for to handle non-existing ISA devices.
Definition isa.hh:80
RegVal readMiscRegReset(RegIndex) const
Definition isa.cc:1375
void setupThreadContext()
Definition isa.cc:168
void setMiscRegNoEffect(RegIndex idx, RegVal val) override
Definition isa.cc:662
uint8_t physAddrRange
Definition isa.hh:95
void addressTranslation64(MMU::ArmTranslationType tran_type, BaseMMU::Mode mode, Request::Flags flags, RegVal val)
Definition isa.cc:1598
bool haveLargeAsid64
Definition isa.hh:94
void handleLockedSnoop(PacketPtr pkt, Addr cacheBlockMask) override
Definition isa.cc:1747
void clear() override
Definition isa.cc:138
int flattenMiscIndex(int reg) const
Definition isa.hh:204
std::pair< int, int > getMiscIndices(int misc_reg) const
Definition isa.hh:337
RegVal miscRegs[NUM_MISCREGS]
Definition isa.hh:126
unsigned smeVL
SME vector length in quadwords.
Definition isa.hh:101
BaseISADevice * pmu
Definition isa.hh:83
std::unique_ptr< BaseISADevice > timer
Definition isa.hh:86
bool handleLockedWrite(const RequestPtr &req, Addr cacheBlockMask) override
Definition isa.cc:1836
SelfDebug * selfDebug
Definition isa.hh:112
void globalClearExclusive() override
Definition isa.cc:1849
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition isa.cc:1577
void updateRegMap(CPSR cpsr)
Definition isa.hh:130
void startup() override
startup() is the final initialization call before simulation.
Definition isa.cc:153
int redirectRegVHE(int misc_reg)
Returns the enconcing equivalent when VHE is implemented and HCR_EL2.E2H is enabled and executing at ...
Definition isa.cc:233
BaseISADevice & getGICv3CPUInterface()
Definition isa.cc:1410
ArmSystem * system
Definition isa.hh:74
BaseISADevice & getGenericTimer()
Definition isa.cc:1389
RegVal readMiscRegNoEffect(RegIndex idx) const override
Definition isa.cc:387
void setMiscReg(RegIndex, RegVal val) override
Definition isa.cc:684
unsigned sveVL
SVE vector length in quadwords.
Definition isa.hh:98
const MiscRegLUTEntryInitializer InitReg(uint32_t reg)
Definition isa.hh:115
void handleLockedRead(const RequestPtr &req) override
Definition isa.cc:1759
void addressTranslation(MMU::ArmTranslationType tran_type, BaseMMU::Mode mode, Request::Flags flags, RegVal val)
Definition isa.cc:1649
void initializeMiscRegMetadata()
Definition misc.cc:2876
const ArmRelease * release
This could be either a FS or a SE release.
Definition isa.hh:104
bool highestELIs64
Definition isa.hh:92
RegVal readMiscReg(RegIndex idx) override
Definition isa.cc:411
void handleLockedSnoopHit() override
Definition isa.cc:1777
ISA(const Params &p)
Definition isa.cc:86
std::unique_ptr< BaseISADevice > gicv3CpuInterface
Definition isa.hh:89
ExceptionLevel highestEL
Definition isa.hh:93
unsigned getCurSmeVecLenInBits() const
Definition isa.cc:1518
void invalidateMiscReg()
Definition mmu.cc:196
uint64_t getAttr() const
Definition mmu.hh:369
TranslationGenPtr translateFunctional(Addr start, Addr size, ThreadContext *tc, Mode mode, Request::Flags flags) override
Returns a translation generator for a region of virtual addresses, instead of directly translating a ...
Definition mmu.hh:91
chain reset(uint64_t res_val) const
Definition misc.hh:1312
void setenableTDETGE(HCR hcr, HDCR mdcr)
void init(ThreadContext *tc)
void updateOSLock(RegVal val)
void setMDSCRvals(RegVal val)
void updateDBGBCR(int index, DBGBCR val)
void setbSDD(RegVal val)
void updateDBGWCR(int index, DBGWCR val)
void setMDBGen(RegVal val)
void setDebugMask(bool mask)
bool has(ArmExtension ext) const
Definition system.hh:76
GenericTimer * getGenericTimer() const
Get a pointer to the system's generic timer model.
Definition system.hh:177
bool highestELIs64() const
Returns true if the register width of the highest implemented exception level is 64 bits (ARMv8)
Definition system.hh:187
ArmISA::ExceptionLevel highestEL() const
Returns the highest implemented exception level.
Definition system.hh:191
unsigned smeVL() const
Returns the SME vector length at reset, in quadwords.
Definition system.hh:212
BaseGic * getGIC() const
Get a pointer to the system's GIC.
Definition system.hh:180
uint8_t physAddrRange() const
Returns the supported physical address range in bits.
Definition system.hh:220
bool haveLargeAsid64() const
Returns true if ASID is 16 bits in AArch64 (ARMv8)
Definition system.hh:206
const ArmRelease * releaseFS() const
Definition system.hh:156
unsigned sveVL() const
Returns the SVE vector length at reset, in quadwords.
Definition system.hh:209
BaseInterrupts * getInterruptController(ThreadID tid)
Definition base.hh:228
ThreadContext * tc
Definition isa.hh:68
RegClasses _regClasses
Definition isa.hh:70
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition isa.hh:136
CheckerCPU class.
Definition cpu.hh:85
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
virtual ThreadContext * tcBase() const =0
Returns a pointer to the ThreadContext.
virtual RegVal readMiscReg(int misc_reg)=0
Reads a miscellaneous register, handling any architectural side effects due to reading that register.
virtual void setMiscReg(int misc_reg, RegVal val)=0
Sets a miscellaneous register, handling any architectural side effects due to writing that register.
Gicv3CPUInterface * getCPUInterface(int cpu_id) const
Definition gic_v3.hh:189
Backing store for matrices.
Definition matrix.hh:381
virtual std::string name() const
Definition named.hh:47
Target & as()
Definition pcstate.hh:73
Addr instAddr() const
Returns the memory address of the instruction this PC points to.
Definition pcstate.hh:108
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
Addr getAddr() const
Definition packet.hh:807
bool isWrite() const
Definition packet.hh:594
bool isInvalidate() const
Definition packet.hh:609
@ funcRequestorId
This requestor id is used for functional requests that don't come from a particular device.
Definition request.hh:279
SimObjectParams Params
int size() const
Definition system.hh:210
Threads threads
Definition system.hh:310
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual RegVal readMiscReg(RegIndex misc_reg)=0
virtual void setHtmCheckpointPtr(BaseHTMCheckpointPtr cpt)=0
virtual void pcStateNoRecord(const PCStateBase &val)=0
virtual void setMiscReg(RegIndex misc_reg, RegVal val)=0
virtual RegVal getReg(const RegId &reg) const
virtual void setMiscRegNoEffect(RegIndex misc_reg, RegVal val)=0
virtual System * getSystemPtr()=0
virtual BaseCPU * getCpuPtr()=0
virtual void setReg(const RegId &reg, RegVal val)
virtual CheckerCPU * getCheckerCpuPtr()=0
virtual InstDecoder * getDecoderPtr()=0
virtual const PCStateBase & pcState() const =0
virtual int threadId() const =0
virtual RegVal readMiscRegNoEffect(RegIndex misc_reg) const =0
virtual BaseMMU * getMMUPtr()=0
virtual ContextID contextId() const =0
Vector Register Abstraction This generic class is the model in a particularization of MVC,...
Definition vec_reg.hh:126
This module implements the global system counter and the local per-CPU architected timers as specifie...
Random random_mt
Definition random.cc:99
std::enable_if_t< std::is_integral_v< T >, T > random()
Use the SFINAE idiom to choose an implementation based on whether the type is integral or floating po...
Definition random.hh:90
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Definition bitfield.hh:79
#define panic(...)
This implements a cprintf based panic() function.
Definition logging.hh:188
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Definition logging.hh:214
virtual void startup()
startup() is the final initialization call before simulation.
Definition sim_object.cc:96
uint8_t flags
Definition helpers.cc:87
#define warn(...)
Definition logging.hh:256
#define warn_once(...)
Definition logging.hh:260
constexpr RegId V
Definition cc.hh:96
constexpr RegId C
Definition cc.hh:95
constexpr RegId Nz
Definition cc.hh:94
constexpr RegId Sp2
Definition int.hh:235
constexpr RegId Sp0
Definition int.hh:233
constexpr RegId Sp1
Definition int.hh:234
RegAccessor::type readRegisterNoEffect(ThreadContext *tc, ExceptionLevel el)
bool ELIs32(ThreadContext *tc, ExceptionLevel el)
Definition utility.cc:282
Bitfield< 28 > v
Definition misc_types.hh:54
constexpr RegClass flatIntRegClass
Definition int.hh:178
static const uint32_t FpscrQcMask
Definition misc.hh:2962
bool ELIsInHost(ThreadContext *tc, ExceptionLevel el)
Returns true if the current exception level el is executing a Host OS or an application of a Host OS ...
Definition utility.cc:290
Bitfield< 3, 0 > mask
Definition pcstate.hh:63
Bitfield< 18, 16 > len
Bitfield< 4, 0 > mode
Definition misc_types.hh:74
bool isSecure(ThreadContext *tc)
Definition utility.cc:74
Bitfield< 22 > pan
Definition misc_types.hh:59
static const uint32_t FpscrExcMask
Definition misc.hh:2966
Bitfield< 7 > i
Definition misc_types.hh:67
void sendEvent(ThreadContext *tc)
Send an event (SEV) to a specific PE if there isn't already a pending event.
Definition utility.cc:65
constexpr RegClass matRegClass
Definition mat.hh:92
MMU * getMMUPtr(T *tc)
Definition mmu.hh:510
constexpr RegClass vecElemClass
Definition vec.hh:105
static const uint32_t CpsrMaskQ
Definition misc.hh:2945
bool EL2Enabled(ThreadContext *tc)
Definition utility.cc:267
void preUnflattenMiscReg()
Definition misc.cc:708
constexpr RegClass vecPredRegClass
Definition vec.hh:109
constexpr RegClass ccRegClass
Definition cc.hh:87
@ MISCREG_NSACR
Definition misc.hh:251
@ MISCREG_ID_AA64PFR0_EL1
Definition misc.hh:567
@ MISCREG_DBGBCR15
Definition misc.hh:143
@ MISCREG_DBGOSLSR
Definition misc.hh:194
@ MISCREG_TTBR1_EL12
Definition misc.hh:611
@ MISCREG_CNTV_CTL_EL0
Definition misc.hh:819
@ MISCREG_HCR
Definition misc.hh:254
@ MISCREG_HDFAR
Definition misc.hh:295
@ MISCREG_MPIDR_EL1
Definition misc.hh:546
@ MISCREG_ATS1HR
Definition misc.hh:325
@ MISCREG_SCTLR_EL2
Definition misc.hh:592
@ MISCREG_CNTV_CVAL_EL02
Definition misc.hh:826
@ MISCREG_CNTP_CTL_EL0
Definition misc.hh:816
@ MISCREG_PMOVSSET
Definition misc.hh:372
@ MISCREG_FPEXC
Definition misc.hh:81
@ MISCREG_CNTP_CTL_EL02
Definition misc.hh:822
@ MISCREG_SPSEL
Definition misc.hh:631
@ MISCREG_TCR_EL2
Definition misc.hh:617
@ MISCREG_AT_S1E1W_Xt
Definition misc.hh:674
@ MISCREG_RNDRRS
Definition misc.hh:1136
@ MISCREG_DBGDSCRint
Definition misc.hh:102
@ MISCREG_MVFR1
Definition misc.hh:79
@ MISCREG_MIDR_EL1
Definition misc.hh:545
@ MISCREG_ZCR_EL2
Definition misc.hh:1117
@ MISCREG_ICC_IGRPEN1_EL3
Definition misc.hh:943
@ MISCREG_CNTFRQ
Definition misc.hh:419
@ MISCREG_AFSR1_EL12
Definition misc.hh:652
@ MISCREG_CPSR_Q
Definition misc.hh:85
@ MISCREG_MAIR_EL1
Definition misc.hh:786
@ MISCREG_ICC_PMR_EL1
Definition misc.hh:898
@ MISCREG_CONTEXTIDR_EL1
Definition misc.hh:805
@ MISCREG_CNTV_TVAL
Definition misc.hh:433
@ MISCREG_HCPTR
Definition misc.hh:257
@ MISCREG_SPSR_EL2
Definition misc.hh:639
@ MISCREG_ID_MMFR1
Definition misc.hh:222
@ MISCREG_AT_S1E2W_Xt
Definition misc.hh:685
@ MISCREG_LOCKFLAG
Definition misc.hh:89
@ MISCREG_ICH_LR15_EL2
Definition misc.hh:975
@ MISCREG_FPSID
Definition misc.hh:77
@ MISCREG_MAIR_EL12
Definition misc.hh:787
@ MISCREG_SCTLR
Definition misc.hh:241
@ MISCREG_PAR_EL1
Definition misc.hh:669
@ MISCREG_TTBCR
Definition misc.hh:266
@ MISCREG_AT_S12E1W_Xt
Definition misc.hh:687
@ MISCREG_ATS12NSOUW
Definition misc.hh:317
@ MISCREG_MAIR_EL2
Definition misc.hh:790
@ MISCREG_CNTV_CVAL
Definition misc.hh:432
@ MISCREG_CSSELR
Definition misc.hh:236
@ MISCREG_CPACR
Definition misc.hh:247
@ MISCREG_SCR_EL3
Definition misc.hh:604
@ MISCREG_CNTKCTL_EL12
Definition misc.hh:829
@ MISCREG_ID_AA64DFR0_EL1
Definition misc.hh:569
@ MISCREG_DBGOSLAR
Definition misc.hh:193
@ MISCREG_DBGDSCRext
Definition misc.hh:109
@ MISCREG_SCTLR2_EL12
Definition misc.hh:588
@ MISCREG_SCTLR2_EL1
Definition misc.hh:587
@ MISCREG_TCR_EL3
Definition misc.hh:624
@ MISCREG_SMCR_EL1
Definition misc.hh:1130
@ MISCREG_FPSR
Definition misc.hh:636
@ MISCREG_CPACR_EL12
Definition misc.hh:591
@ MISCREG_HDCR
Definition misc.hh:256
@ MISCREG_ESR_EL1
Definition misc.hh:653
@ MISCREG_CNTP_TVAL
Definition misc.hh:428
@ MISCREG_AT_S12E0W_Xt
Definition misc.hh:689
@ MISCREG_TCR_EL1
Definition misc.hh:612
@ MISCREG_CNTVCT
Definition misc.hh:421
@ MISCREG_ESR_EL12
Definition misc.hh:654
@ MISCREG_AFSR0_EL1
Definition misc.hh:649
@ MISCREG_ID_ISAR5
Definition misc.hh:231
@ MISCREG_ATS1CUR
Definition misc.hh:312
@ MISCREG_OSLAR_EL1
Definition misc.hh:534
@ MISCREG_CNTPCT_EL0
Definition misc.hh:814
@ MISCREG_MPAM1_EL1
Definition misc.hh:1148
@ MISCREG_AFSR1_EL2
Definition misc.hh:657
@ MISCREG_CNTV_CTL_EL02
Definition misc.hh:825
@ MISCREG_DBGBCR0_EL1
Definition misc.hh:480
@ MISCREG_ID_ISAR4
Definition misc.hh:230
@ MISCREG_SCTLR_EL1
Definition misc.hh:585
@ MISCREG_CNTP_TVAL_EL02
Definition misc.hh:824
@ MISCREG_PRRR
Definition misc.hh:375
@ MISCREG_CPTR_EL2
Definition misc.hh:598
@ MISCREG_CCSIDR
Definition misc.hh:233
@ MISCREG_FAR_EL1
Definition misc.hh:663
@ MISCREG_DBGWCR0
Definition misc.hh:160
@ MISCREG_AT_S1E2R_Xt
Definition misc.hh:684
@ MISCREG_PMCR
Definition misc.hh:357
@ MISCREG_CNTHV_CTL_EL2
Definition misc.hh:841
@ MISCREG_CNTV_CTL
Definition misc.hh:431
@ MISCREG_ID_AA64DFR1_EL1
Definition misc.hh:570
@ MISCREG_ID_AA64ISAR1_EL1
Definition misc.hh:574
@ MISCREG_SMCR_EL3
Definition misc.hh:1127
@ MISCREG_ELR_EL12
Definition misc.hh:629
@ MISCREG_PMEVCNTR0_EL0
Definition misc.hh:850
@ MISCREG_VBAR_EL12
Definition misc.hh:797
@ MISCREG_ID_AA64MMFR1_EL1
Definition misc.hh:576
@ MISCREG_TTBR0_EL12
Definition misc.hh:609
@ MISCREG_ATS12NSOUR
Definition misc.hh:316
@ MISCREG_CNTVCT_EL0
Definition misc.hh:815
@ MISCREG_SP_EL0
Definition misc.hh:630
@ MISCREG_DFAR_S
Definition misc.hh:291
@ MISCREG_CPSR
Definition misc.hh:67
@ MISCREG_FPCR
Definition misc.hh:635
@ MISCREG_SDCR
Definition misc.hh:248
@ MISCREG_CPACR_EL1
Definition misc.hh:590
@ MISCREG_ID_MMFR0
Definition misc.hh:221
@ MISCREG_PMEVTYPER5_EL0
Definition misc.hh:861
@ MISCREG_CNTP_CVAL
Definition misc.hh:425
@ MISCREG_ID_ISAR0
Definition misc.hh:226
@ MISCREG_CNTKCTL_EL1
Definition misc.hh:828
@ MISCREG_SP_EL2
Definition misc.hh:648
@ MISCREG_NMRR
Definition misc.hh:381
@ MISCREG_SCTLR_EL12
Definition misc.hh:586
@ MISCREG_TTBR1_EL1
Definition misc.hh:610
@ MISCREG_MAIR1
Definition misc.hh:384
@ MISCREG_DAIF
Definition misc.hh:634
@ MISCREG_SEV_MAILBOX
Definition misc.hh:97
@ MISCREG_SPSR_EL12
Definition misc.hh:627
@ MISCREG_CNTP_CVAL_EL02
Definition misc.hh:823
@ MISCREG_PMINTENSET_EL1
Definition misc.hh:770
@ MISCREG_CNTHPS_CVAL_EL2
Definition misc.hh:838
@ MISCREG_REVIDR
Definition misc.hh:216
@ MISCREG_ID_MMFR3
Definition misc.hh:224
@ MISCREG_ICH_LRC15
Definition misc.hh:1112
@ MISCREG_TCR2_EL12
Definition misc.hh:615
@ MISCREG_ISR
Definition misc.hh:402
@ MISCREG_CONTEXTIDR
Definition misc.hh:405
@ MISCREG_CNTHPS_TVAL_EL2
Definition misc.hh:839
@ MISCREG_SCR
Definition misc.hh:249
@ MISCREG_ELR_EL2
Definition misc.hh:640
@ MISCREG_CONTEXTIDR_EL2
Definition misc.hh:877
@ MISCREG_TCR_EL12
Definition misc.hh:613
@ MISCREG_CNTHCTL_EL2
Definition misc.hh:833
@ MISCREG_MDSCR_EL1
Definition misc.hh:461
@ MISCREG_ID_DFR0
Definition misc.hh:219
@ MISCREG_TTBR1_EL2
Definition misc.hh:880
@ MISCREG_ID_AA64MMFR0_EL1
Definition misc.hh:575
@ MISCREG_AT_S1E1R_Xt
Definition misc.hh:673
@ MISCREG_AMAIR_EL1
Definition misc.hh:788
@ MISCREG_ATS1HW
Definition misc.hh:326
@ MISCREG_AT_S1E3R_Xt
Definition misc.hh:690
@ MISCREG_DC_ZVA_Xt
Definition misc.hh:679
@ MISCREG_CNTHVS_TVAL_EL2
Definition misc.hh:846
@ MISCREG_ATS1CPR
Definition misc.hh:310
@ MISCREG_NZCV
Definition misc.hh:633
@ MISCREG_SPSR_EL1
Definition misc.hh:626
@ MISCREG_FAR_EL12
Definition misc.hh:664
@ MISCREG_CNTP_CVAL_EL0
Definition misc.hh:817
@ MISCREG_HCR_EL2
Definition misc.hh:595
@ MISCREG_CNTHVS_CVAL_EL2
Definition misc.hh:845
@ MISCREG_SMCR_EL2
Definition misc.hh:1128
@ MISCREG_ATS1CPW
Definition misc.hh:311
@ MISCREG_TTBR1
Definition misc.hh:263
@ MISCREG_AT_S12E0R_Xt
Definition misc.hh:688
@ MISCREG_MPIDR
Definition misc.hh:215
@ MISCREG_ZCR_EL1
Definition misc.hh:1119
@ MISCREG_ID_AA64MMFR2_EL1
Definition misc.hh:882
@ MISCREG_VTCR_EL2
Definition misc.hh:620
@ MISCREG_VTTBR
Definition misc.hh:454
@ MISCREG_CNTVOFF_EL2
Definition misc.hh:848
@ MISCREG_VPIDR
Definition misc.hh:239
@ MISCREG_DBGWCR15
Definition misc.hh:175
@ MISCREG_CNTHPS_CTL_EL2
Definition misc.hh:837
@ MISCREG_VBAR_EL2
Definition misc.hh:800
@ MISCREG_CLIDR
Definition misc.hh:234
@ MISCREG_SCTLR_S
Definition misc.hh:243
@ MISCREG_MDCR_EL2
Definition misc.hh:597
@ MISCREG_CNTHV_TVAL_EL2
Definition misc.hh:843
@ MISCREG_VBAR_EL1
Definition misc.hh:796
@ MISCREG_MIDR
Definition misc.hh:211
@ MISCREG_AMAIR_EL2
Definition misc.hh:791
@ MISCREG_L2CTLR
Definition misc.hh:373
@ MISCREG_CNTP_CTL
Definition misc.hh:422
@ MISCREG_TTBR0_EL3
Definition misc.hh:623
@ MISCREG_DBGWCR0_EL1
Definition misc.hh:512
@ MISCREG_ATS12NSOPW
Definition misc.hh:315
@ MISCREG_ISR_EL1
Definition misc.hh:799
@ MISCREG_CNTVOFF
Definition misc.hh:439
@ MISCREG_AT_S1E0W_Xt
Definition misc.hh:676
@ MISCREG_AT_S12E1R_Xt
Definition misc.hh:686
@ MISCREG_TLBTR
Definition misc.hh:214
@ MISCREG_ID_AA64AFR1_EL1
Definition misc.hh:572
@ MISCREG_AFSR0_EL12
Definition misc.hh:650
@ MISCREG_ELR_EL1
Definition misc.hh:628
@ MISCREG_AMAIR_EL12
Definition misc.hh:789
@ NUM_PHYS_MISCREGS
Definition misc.hh:1168
@ MISCREG_DBGWCR15_EL1
Definition misc.hh:527
@ MISCREG_TCR2_EL1
Definition misc.hh:614
@ MISCREG_ID_PFR1
Definition misc.hh:218
@ MISCREG_CNTHP_CVAL_EL2
Definition misc.hh:835
@ MISCREG_CNTV_TVAL_EL0
Definition misc.hh:821
@ MISCREG_MPAM2_EL2
Definition misc.hh:1149
@ MISCREG_ZCR_EL3
Definition misc.hh:1116
@ MISCREG_FPSCR
Definition misc.hh:78
@ MISCREG_TTBR0
Definition misc.hh:260
@ MISCREG_DACR
Definition misc.hh:271
@ MISCREG_TTBR0_EL2
Definition misc.hh:616
@ MISCREG_HSCTLR
Definition misc.hh:252
@ MISCREG_SCTLR_NS
Definition misc.hh:242
@ MISCREG_ICC_AP0R0
Definition misc.hh:1020
@ MISCREG_TTBR0_EL1
Definition misc.hh:608
@ MISCREG_SCTLR_EL3
Definition misc.hh:601
@ MISCREG_CNTP_TVAL_EL0
Definition misc.hh:818
@ MISCREG_FPSCR_QC
Definition misc.hh:87
@ MISCREG_CURRENTEL
Definition misc.hh:632
@ MISCREG_ICH_AP0R0_EL2
Definition misc.hh:946
@ MISCREG_ID_ISAR1
Definition misc.hh:227
@ MISCREG_DBGBCR0
Definition misc.hh:128
@ MISCREG_ID_AA64AFR0_EL1
Definition misc.hh:571
@ MISCREG_ATS12NSOPR
Definition misc.hh:314
@ MISCREG_OSLSR_EL1
Definition misc.hh:535
@ MISCREG_DBGBCR15_EL1
Definition misc.hh:495
@ MISCREG_MVFR0
Definition misc.hh:80
@ MISCREG_ID_AA64ISAR0_EL1
Definition misc.hh:573
@ MISCREG_HIFAR
Definition misc.hh:296
@ MISCREG_CNTHP_TVAL_EL2
Definition misc.hh:836
@ MISCREG_AT_S1E3W_Xt
Definition misc.hh:691
@ MISCREG_ID_MMFR2
Definition misc.hh:223
@ MISCREG_FAR_EL2
Definition misc.hh:665
@ MISCREG_CNTHVS_CTL_EL2
Definition misc.hh:844
@ MISCREG_FPSCR_EXC
Definition misc.hh:86
@ MISCREG_CNTV_TVAL_EL02
Definition misc.hh:827
@ MISCREG_AT_S1E0R_Xt
Definition misc.hh:675
@ MISCREG_MPAM1_EL12
Definition misc.hh:1151
@ MISCREG_ID_ISAR3
Definition misc.hh:229
@ MISCREG_CNTHP_CTL_EL2
Definition misc.hh:834
@ MISCREG_PAR
Definition misc.hh:300
@ MISCREG_CONTEXTIDR_EL12
Definition misc.hh:806
@ MISCREG_CPTR_EL3
Definition misc.hh:606
@ MISCREG_ESR_EL2
Definition misc.hh:658
@ MISCREG_ID_PFR0
Definition misc.hh:217
@ MISCREG_IFAR_S
Definition misc.hh:294
@ MISCREG_ID_MMFR4
Definition misc.hh:225
@ MISCREG_AFSR1_EL1
Definition misc.hh:651
@ MISCREG_CNTHV_CVAL_EL2
Definition misc.hh:842
@ MISCREG_LOCKADDR
Definition misc.hh:88
@ MISCREG_CNTFRQ_EL0
Definition misc.hh:813
@ MISCREG_ID_AFR0
Definition misc.hh:220
@ MISCREG_ACTLR
Definition misc.hh:244
@ MISCREG_PMXEVTYPER_PMCCFILTR
Definition misc.hh:96
@ MISCREG_ID_AA64PFR1_EL1
Definition misc.hh:568
@ MISCREG_HSTR
Definition misc.hh:258
@ MISCREG_MDCR_EL3
Definition misc.hh:607
@ MISCREG_AFSR0_EL2
Definition misc.hh:656
@ MISCREG_ID_ISAR2
Definition misc.hh:228
@ MISCREG_CNTV_CVAL_EL0
Definition misc.hh:820
@ MISCREG_ZCR_EL12
Definition misc.hh:1118
@ MISCREG_SP_EL1
Definition misc.hh:641
@ MISCREG_ATS1CUW
Definition misc.hh:313
@ MISCREG_MAIR0
Definition misc.hh:378
@ MISCREG_PMOVSSET_EL0
Definition misc.hh:785
Bitfield< 9, 6 > daif
Definition misc_types.hh:70
Bitfield< 3, 2 > el
Definition misc_types.hh:73
@ MISCREG_WARN_NOT_FAIL
Definition misc.hh:1207
@ MISCREG_UNSERIALIZE
Definition misc.hh:1206
@ MISCREG_IMPLEMENTED
Definition misc.hh:1203
int unflattenMiscReg(int reg)
Definition misc.cc:724
Bitfield< 0 > sp
Definition misc_types.hh:75
static bool lockedWriteHandler(ThreadContext *tc, XC *xc, const RequestPtr &req, Addr cacheBlockMask)
Definition isa.cc:1797
static ExceptionLevel opModeToEL(OperatingMode mode)
Definition types.hh:400
constexpr RegClass miscRegClass
Definition misc.hh:2937
const char *const miscRegName[]
Definition misc.hh:1815
RegVal readMPIDR(ArmSystem *arm_sys, ThreadContext *tc)
This helper function is either returing the value of MPIDR_EL1 (by calling getMPIDR),...
Definition utility.cc:147
static void lockedSnoopHandler(ThreadContext *tc, XC *xc, PacketPtr pkt, Addr cacheBlockMask)
Definition isa.cc:1718
std::vector< struct MiscRegLUTEntry > lookUpMiscReg(NUM_MISCREGS)
Definition misc.hh:1694
Bitfield< 23 > uao
Definition misc_types.hh:58
constexpr RegClass vecRegClass
Definition vec.hh:101
Bitfield< 4 > pc
Bitfield< 0 > p
Bitfield< 5, 3 > reg
Definition types.hh:92
Bitfield< 15 > system
Definition misc.hh:1032
Bitfield< 63 > val
Definition misc.hh:804
constexpr RegClass floatRegClass
Definition float.hh:143
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
uint16_t RegIndex
Definition types.hh:176
std::shared_ptr< FaultBase > Fault
Definition types.hh:249
std::shared_ptr< Request > RequestPtr
Definition request.hh:94
uint64_t RegVal
Definition types.hh:173
std::ostream CheckpointOut
Definition serialize.hh:66
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
Definition root.cc:220
constexpr decltype(nullptr) NoFault
Definition types.hh:253
@ FloatRegClass
Floating-point register.
Definition reg_class.hh:62
constexpr char FloatRegClassName[]
Definition reg_class.hh:76
#define UNSERIALIZE_MAPPING(member, names, size)
Definition serialize.hh:666
#define SERIALIZE_MAPPING(member, names, size)
Definition serialize.hh:660

Generated on Tue Jun 18 2024 16:23:57 for gem5 by doxygen 1.11.0