gem5 [DEVELOP-FOR-25.1]
Loading...
Searching...
No Matches
isa.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010-2025 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),
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) {
111 highestELIs64 = system->highestELIs64();
112 highestEL = system->highestEL();
113 haveLargeAsid64 = system->haveLargeAsid64();
114 physAddrRange = system->physAddrRange();
115 sveVL = system->sveVL();
116 smeVL = system->smeVL();
117
118 release = system->releaseFS();
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{
170 pmu->setThreadContext(tc);
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++)
200 tc->setMiscRegNoEffect(i, src->readMiscRegNoEffect(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;
257 case MISCREG_TCR2_EL1:
258 return currEL() == EL2 ? MISCREG_TCR2_EL2 : misc_reg;
260 return currEL() == EL2 ? MISCREG_AFSR0_EL2 : misc_reg;
262 return currEL() == EL2 ? MISCREG_AFSR1_EL2 : misc_reg;
263 case MISCREG_ESR_EL1:
264 return currEL() == EL2 ? MISCREG_ESR_EL2 : misc_reg;
265 case MISCREG_FAR_EL1:
266 return currEL() == EL2 ? MISCREG_FAR_EL2 : misc_reg;
267 case MISCREG_MAIR_EL1:
268 return currEL() == EL2 ? MISCREG_MAIR_EL2 : misc_reg;
270 return currEL() == EL2 ? MISCREG_AMAIR_EL2 : misc_reg;
271 case MISCREG_VBAR_EL1:
272 return currEL() == EL2 ? MISCREG_VBAR_EL2 : misc_reg;
276 return currEL() == EL2 ? MISCREG_CNTHCTL_EL2 : misc_reg;
278 return currEL() == EL2 ? MISCREG_MPAM2_EL2 : misc_reg;
279 case MISCREG_ZCR_EL1:
280 return currEL() == EL2 ? MISCREG_ZCR_EL2 : misc_reg;
281 case MISCREG_PIR_EL1:
282 return currEL() == EL2 ? MISCREG_PIR_EL2 : misc_reg;
284 return currEL() == EL2 ? MISCREG_PIRE0_EL2 : misc_reg;
287 if (ELIsInHost(tc, currEL())) {
288 return sec_el2 && !scr.ns ? MISCREG_CNTHPS_TVAL_EL2:
290 } else {
291 return misc_reg;
292 }
293 case MISCREG_CNTP_CTL:
295 if (ELIsInHost(tc, currEL())) {
296 return sec_el2 && !scr.ns ? MISCREG_CNTHPS_CTL_EL2:
298 } else {
299 return misc_reg;
300 }
303 if (ELIsInHost(tc, currEL())) {
304 return sec_el2 && !scr.ns ? MISCREG_CNTHPS_CVAL_EL2:
306 } else {
307 return misc_reg;
308 }
311 if (ELIsInHost(tc, currEL())) {
312 return sec_el2 && !scr.ns ? MISCREG_CNTHVS_TVAL_EL2:
314 } else {
315 return misc_reg;
316 }
317 case MISCREG_CNTV_CTL:
319 if (ELIsInHost(tc, currEL())) {
320 return sec_el2 && !scr.ns ? MISCREG_CNTHVS_CTL_EL2:
322 } else {
323 return misc_reg;
324 }
327 if (ELIsInHost(tc, currEL())) {
328 return sec_el2 && !scr.ns ? MISCREG_CNTHVS_CVAL_EL2:
330 } else {
331 return misc_reg;
332 }
333 case MISCREG_CNTVCT:
337 return MISCREG_SCTLR_EL1;
339 return MISCREG_SCTLR2_EL1;
341 return MISCREG_CPACR_EL1;
342 case MISCREG_ZCR_EL12:
343 return MISCREG_ZCR_EL1;
345 return MISCREG_TTBR0_EL1;
347 return MISCREG_TTBR1_EL1;
348 case MISCREG_TCR_EL12:
349 return MISCREG_TCR_EL1;
351 return MISCREG_TCR2_EL1;
353 return MISCREG_SPSR_EL1;
354 case MISCREG_ELR_EL12:
355 return MISCREG_ELR_EL1;
357 return MISCREG_AFSR0_EL1;
359 return MISCREG_AFSR1_EL1;
360 case MISCREG_ESR_EL12:
361 return MISCREG_ESR_EL1;
362 case MISCREG_FAR_EL12:
363 return MISCREG_FAR_EL1;
365 return MISCREG_MAIR_EL1;
367 return MISCREG_AMAIR_EL1;
369 return MISCREG_VBAR_EL1;
373 return MISCREG_CNTKCTL_EL1;
375 return MISCREG_MPAM1_EL1;
376 case MISCREG_PIR_EL12:
377 return MISCREG_PIR_EL1;
379 return MISCREG_PIRE0_EL1;
380 // _EL02 registers
393 default:
394 return misc_reg;
395 }
396}
397
398RegVal
400{
401 assert(idx < NUM_MISCREGS);
402
403 const auto &reg = lookUpMiscReg[idx]; // bit masks
404 const auto &map = getMiscIndices(idx);
405 int lower = map.first, upper = map.second;
406 // NB!: apply architectural masks according to desired register,
407 // despite possibly getting value from different (mapped) register.
408 auto val = !upper ? miscRegs[lower] : ((miscRegs[lower] & mask(32))
409 |(miscRegs[upper] << 32));
410 if (val & reg.res0()) {
411 DPRINTF(MiscRegs, "Reading MiscReg %s with set res0 bits: %#x\n",
412 miscRegName[idx], val & reg.res0());
413 }
414 if ((val & reg.res1()) != reg.res1()) {
415 DPRINTF(MiscRegs, "Reading MiscReg %s with clear res1 bits: %#x\n",
416 miscRegName[idx], (val & reg.res1()) ^ reg.res1());
417 }
418 return (val & ~reg.raz()) | reg.rao(); // enforce raz/rao
419}
420
421
422RegVal
424{
425 CPSR cpsr = 0;
426 SCR scr = 0;
427
428 if (idx == MISCREG_CPSR) {
429 cpsr = miscRegs[idx];
430 auto pc = tc->pcState().as<PCState>();
431 cpsr.t = pc.thumb() ? 1 : 0;
432 return cpsr;
433 }
434
435#ifndef NDEBUG
436 auto& miscreg_info = lookUpMiscReg[idx].info;
437 if (!miscreg_info[MISCREG_IMPLEMENTED]) {
438 if (miscreg_info[MISCREG_WARN_NOT_FAIL])
439 warn("Unimplemented system register %s read.\n",
440 miscRegName[idx]);
441 else
442 panic("Unimplemented system register %s read.\n",
443 miscRegName[idx]);
444 }
445#endif
446 idx = redirectRegVHE(idx);
447
448 switch (unflattenMiscReg(idx)) {
449 case MISCREG_CPACR:
450 {
451 const uint32_t ones = (uint32_t)(-1);
452 CPACR cpacrMask = 0;
453 // Only cp10, cp11, and ase are implemented, nothing else should
454 // be readable? (straight copy from the write code)
455 cpacrMask.cp10 = ones;
456 cpacrMask.cp11 = ones;
457 cpacrMask.asedis = ones;
458
459 // Security Extensions may limit the readability of CPACR
460 if (release->has(ArmExtension::SECURITY)) {
463 if (scr.ns && (cpsr.mode != MODE_MON) && ELIs32(tc, EL3)) {
464 NSACR nsacr = readMiscRegNoEffect(MISCREG_NSACR);
465 // NB: Skipping the full loop, here
466 if (!nsacr.cp10) cpacrMask.cp10 = 0;
467 if (!nsacr.cp11) cpacrMask.cp11 = 0;
468 }
469 }
471 val &= cpacrMask;
472 DPRINTF(MiscRegs, "Reading misc reg %s: %#x\n",
473 miscRegName[idx], val);
474 return val;
475 }
476 case MISCREG_MPIDR:
478 return readMPIDR(system, tc);
479 case MISCREG_ID_AFR0: // not implemented, so alias MIDR
480 case MISCREG_REVIDR: // not implemented, so alias MIDR
481 case MISCREG_MIDR:
482 case MISCREG_MIDR_EL1:
483 if (currEL() == EL1 && EL2Enabled(tc)) {
485 } else {
486 return readMiscRegNoEffect(idx);
487 }
488 break;
489
490 case MISCREG_CLIDR:
491 warn_once("The clidr register always reports 0 caches.\n");
492 warn_once("clidr LoUIS field of 0b001 to match current "
493 "ARM implementations.\n");
494 return 0x00200000;
495 case MISCREG_CCSIDR:
496 warn_once("The ccsidr register isn't implemented and "
497 "always reads as 0.\n");
498 break;
499 case MISCREG_ACTLR:
500 warn("Not doing anything for miscreg ACTLR\n");
501 break;
502
507 return pmu->readMiscReg(idx);
508
509 case MISCREG_CPSR_Q:
510 panic("shouldn't be reading this register seperately\n");
511 case MISCREG_FPCR:
512 {
514 if (!release->has(ArmExtension::FEAT_AFP)) {
515 fpcr.nep = 0;
516 fpcr.ah = 0;
517 fpcr.fiz = 0;
518 }
519 if (!release->has(ArmExtension::FEAT_EBF16)) {
520 fpcr.ebf = 0;
521 }
522 return fpcr;
523 }
524 case MISCREG_FPSCR:
525 {
527 FPSCR fpsr = readMiscRegNoEffect(MISCREG_FPSR);
528 FPSCR fpscr = (fpsr & FpscrFpsrMask) | (fpcr & FpscrFpcrMask);
529 return fpscr;
530 }
531 case MISCREG_FPSCR_QC:
532 {
534 FPSCR fpsr = readMiscRegNoEffect(MISCREG_FPSR);
535 FPSCR fpscr = (fpsr & FpscrFpsrMask) | (fpcr & FpscrFpcrMask);
536 return fpscr & ~FpscrQcMask;
537 }
539 {
541 FPSCR fpsr = readMiscRegNoEffect(MISCREG_FPSR);
542 FPSCR fpscr = (fpsr & FpscrFpsrMask) | (fpcr & FpscrFpcrMask);
543 return fpscr & ~FpscrExcMask;
544 }
545 case MISCREG_NZCV:
546 {
547 CPSR cpsr = 0;
548 cpsr.nz = tc->getReg(cc_reg::Nz);
549 cpsr.c = tc->getReg(cc_reg::C);
550 cpsr.v = tc->getReg(cc_reg::V);
551 return cpsr;
552 }
553 case MISCREG_DAIF:
554 {
555 CPSR cpsr = 0;
556 cpsr.daif = (uint8_t) ((CPSR) miscRegs[MISCREG_CPSR]).daif;
557 return cpsr;
558 }
559 case MISCREG_SP_EL0:
560 {
561 return tc->getReg(int_reg::Sp0);
562 }
563 case MISCREG_SP_EL1:
564 {
565 return tc->getReg(int_reg::Sp1);
566 }
567 case MISCREG_SP_EL2:
568 {
569 return tc->getReg(int_reg::Sp2);
570 }
571 case MISCREG_SPSEL:
572 {
573 return miscRegs[MISCREG_CPSR] & 0x1;
574 }
576 {
577 return miscRegs[MISCREG_CPSR] & 0xc;
578 }
579 case MISCREG_PAN:
580 {
581 return miscRegs[MISCREG_CPSR] & 0x400000;
582 }
583 case MISCREG_UAO:
584 {
585 return miscRegs[MISCREG_CPSR] & 0x800000;
586 }
587 case MISCREG_L2CTLR:
588 {
589 // mostly unimplemented, just set NumCPUs field from sim and return
590 L2CTLR l2ctlr = 0;
591 // b00:1CPU to b11:4CPUs
592 l2ctlr.numCPUs = tc->getSystemPtr()->threads.size() - 1;
593 return l2ctlr;
594 }
595 case MISCREG_ISR:
596 case MISCREG_ISR_EL1:
597 {
598 auto ic = dynamic_cast<ArmISA::Interrupts *>(
599 tc->getCpuPtr()->getInterruptController(tc->threadId()));
600 return ic->getISR(
604 }
605 case MISCREG_HCPTR:
606 {
607 HCPTR val = readMiscRegNoEffect(idx);
608 bool secure_lookup = release->has(ArmExtension::SECURITY) &&
609 isSecure(tc);
610 if (!secure_lookup) {
611 NSACR nsacr = readMiscRegNoEffect(MISCREG_NSACR);
612 if (!nsacr.cp10) {
613 val.tcp10 = 1;
614 val.tcp11 = 1;
615 }
616 }
617 return val;
618 }
619 case MISCREG_HDFAR: // alias for secure DFAR
621 case MISCREG_HIFAR: // alias for secure IFAR
623
625 {
628 tc, highestEL).mpamEn;
629 mpam1.el1.forcedNs = isSecure(tc) ?
630 readRegisterNoEffect<MpamAccessor>(tc, EL3).el3.forceNs : 0;
631 return mpam1;
632 }
634 {
637 tc, highestEL).mpamEn;
638 return mpam2;
639 }
640
641 case MISCREG_RNDR:
642 tc->setReg(cc_reg::Nz, (RegVal)0);
643 tc->setReg(cc_reg::C, (RegVal)0);
644 tc->setReg(cc_reg::V, (RegVal)0);
645 return rng->random<RegVal>();
646 case MISCREG_RNDRRS:
647 tc->setReg(cc_reg::Nz, (RegVal)0);
648 tc->setReg(cc_reg::C, (RegVal)0);
649 tc->setReg(cc_reg::V, (RegVal)0);
650 // Note: we are not reseeding
651 // The random number generator already has an hardcoded
652 // seed for the sake of determinism. There is no point
653 // in simulating non-determinism here
654 return rng->random<RegVal>();
655
656 // Generic Timer registers
659 if (FullSystem) {
660 return getGenericTimer().readMiscReg(idx);
661 } else {
662 warn("Call to %s attempts to access a system timer which is "
663 "inaccessible within SE mode. Divergent behaviour is "
664 "possible.",
665 miscRegName[idx]);
666 return 0;
667 }
671 return getGICv3CPUInterface().readMiscReg(idx);
672
673 default:
674 break;
675
676 }
677 return readMiscRegNoEffect(idx);
678}
679
680void
682{
683 assert(idx < NUM_MISCREGS);
684
685 const auto &reg = lookUpMiscReg[idx]; // bit masks
686 const auto &map = getMiscIndices(idx);
687 int lower = map.first, upper = map.second;
688
689 auto v = (val & ~reg.wi()) | reg.rao();
690 if (upper > 0) {
691 miscRegs[lower] = bits(v, 31, 0);
692 miscRegs[upper] = bits(v, 63, 32);
693 DPRINTF(MiscRegs, "Writing MiscReg %s (%d %d:%d) : %#x\n",
694 miscRegName[idx], idx, lower, upper, v);
695 } else {
696 miscRegs[lower] = v;
697 DPRINTF(MiscRegs, "Writing MiscReg %s (%d %d) : %#x\n",
698 miscRegName[idx], idx, lower, v);
699 }
700}
701
702void
704{
705
706 RegVal newVal = val;
707 bool secure_lookup;
708 SCR scr;
709
710 if (idx == MISCREG_CPSR) {
712
713
714 CPSR old_cpsr = miscRegs[MISCREG_CPSR];
715 int old_mode = old_cpsr.mode;
716 CPSR cpsr = val;
717 if (cpsr.pan != old_cpsr.pan || cpsr.il != old_cpsr.il) {
719 }
720
721 DPRINTF(Arm, "Updating CPSR from %#x to %#x f:%d i:%d a:%d d:%d "
722 "mode:%#x\n", miscRegs[idx], cpsr, cpsr.f, cpsr.i, cpsr.a,
723 cpsr.d, cpsr.mode);
724 PCState pc = tc->pcState().as<PCState>();
725 pc.nextThumb(cpsr.t);
726 pc.illegalExec(cpsr.il == 1);
727 selfDebug->setDebugMask(cpsr.d == 1);
728
729 tc->getDecoderPtr()->as<Decoder>().setSveLen(
730 (getCurSveVecLenInBits() >> 7) - 1);
731 tc->getDecoderPtr()->as<Decoder>().setSmeLen(
732 (getCurSmeVecLenInBits() >> 7) - 1);
733
734 // Follow slightly different semantics if a CheckerCPU object
735 // is connected
736 CheckerCPU *checker = tc->getCheckerCpuPtr();
737 if (checker) {
738 tc->pcStateNoRecord(pc);
739 } else {
740 tc->pcState(pc);
741 }
742
743 setMiscRegNoEffect(idx, newVal);
744
745 if (old_mode != cpsr.mode) {
747 if (gicv3CpuInterface) {
748 // The assertion and de-assertion of IRQs and FIQs are
749 // affected by the current Exception level and Security
750 // state of the PE. As part of the Context
751 // Synchronization that occurs as the result of taking
752 // or returning from an exception, the CPU interface
753 // ensures that IRQ and FIQ are both appropriately
754 // asserted or deasserted for the Exception level and
755 // Security state that the PE is entering.
756 static_cast<Gicv3CPUInterface&>(
757 getGICv3CPUInterface()).update();
758 }
759 }
760 } else {
761#ifndef NDEBUG
762 auto& miscreg_info = lookUpMiscReg[idx].info;
763 if (!miscreg_info[MISCREG_IMPLEMENTED]) {
764 if (miscreg_info[MISCREG_WARN_NOT_FAIL])
765 warn("Unimplemented system register %s write with %#x.\n",
766 miscRegName[idx], val);
767 else
768 panic("Unimplemented system register %s write with %#x.\n",
769 miscRegName[idx], val);
770 }
771#endif
772 idx = redirectRegVHE(idx);
773
774 switch (unflattenMiscReg(idx)) {
775 case MISCREG_CPACR:
776 {
777
778 const uint32_t ones = (uint32_t)(-1);
779 CPACR cpacrMask = 0;
780 // Only cp10, cp11, and ase are implemented
781 // nothing else should be writable
782 cpacrMask.cp10 = ones;
783 cpacrMask.cp11 = ones;
784 cpacrMask.asedis = ones;
785
786 // Security Extensions may limit the writability of CPACR
787 if (release->has(ArmExtension::SECURITY)) {
790 if (scr.ns && (cpsr.mode != MODE_MON) && ELIs32(tc, EL3)) {
791 NSACR nsacr = readMiscRegNoEffect(MISCREG_NSACR);
792 // NB: Skipping the full loop, here
793 if (!nsacr.cp10) cpacrMask.cp10 = 0;
794 if (!nsacr.cp11) cpacrMask.cp11 = 0;
795 }
796 }
797
799 newVal &= cpacrMask;
800 newVal |= old_val & ~cpacrMask;
801 DPRINTF(MiscRegs, "Writing misc reg %s: %#x\n",
802 miscRegName[idx], newVal);
803 }
804 break;
806 {
807 const uint32_t ones = (uint32_t)(-1);
808 CPACR cpacrMask = 0;
809 cpacrMask.tta = ones;
810 cpacrMask.fpen = ones;
811 if (release->has(ArmExtension::FEAT_SVE)) {
812 cpacrMask.zen = ones;
813 }
814 if (release->has(ArmExtension::FEAT_SME)) {
815 cpacrMask.smen = ones;
816 }
817 newVal &= cpacrMask;
818 DPRINTF(MiscRegs, "Writing misc reg %s: %#x\n",
819 miscRegName[idx], newVal);
820 }
821 break;
822 case MISCREG_CPTR_EL2:
823 {
824 const HCR hcr = readMiscRegNoEffect(MISCREG_HCR_EL2);
825 const uint32_t ones = (uint32_t)(-1);
826 CPTR cptrMask = 0;
827 cptrMask.tcpac = ones;
828 cptrMask.tta = ones;
829 cptrMask.tfp = ones;
830 if (release->has(ArmExtension::FEAT_SVE)) {
831 cptrMask.tz = ones;
832 cptrMask.zen = hcr.e2h ? ones : 0;
833 }
834 if (release->has(ArmExtension::FEAT_SME)) {
835 cptrMask.tsm = ones;
836 cptrMask.smen = hcr.e2h ? ones : 0;
837 }
838 cptrMask.fpen = hcr.e2h ? ones : 0;
839 newVal &= cptrMask;
840 cptrMask = 0;
841 cptrMask.res1_13_el2 = ones;
842 cptrMask.res1_7_0_el2 = ones;
843 if (!release->has(ArmExtension::FEAT_SVE)) {
844 cptrMask.res1_8_el2 = ones;
845 }
846 if (!release->has(ArmExtension::FEAT_SME)) {
847 cptrMask.res1_12_el2 = ones;
848 }
849 cptrMask.res1_9_el2 = ones;
850 newVal |= cptrMask;
851 DPRINTF(MiscRegs, "Writing misc reg %s: %#x\n",
852 miscRegName[idx], newVal);
853 }
854 break;
855 case MISCREG_CPTR_EL3:
856 {
857 const uint32_t ones = (uint32_t)(-1);
858 CPTR cptrMask = 0;
859 cptrMask.tcpac = ones;
860 cptrMask.tta = ones;
861 cptrMask.tfp = ones;
862 if (release->has(ArmExtension::FEAT_SVE)) {
863 cptrMask.ez = ones;
864 }
865 if (release->has(ArmExtension::FEAT_SME)) {
866 cptrMask.esm = ones;
867 }
868 newVal &= cptrMask;
869 DPRINTF(MiscRegs, "Writing misc reg %s: %#x\n",
870 miscRegName[idx], newVal);
871 }
872 break;
873 case MISCREG_CSSELR:
874 warn_once("The csselr register isn't implemented.\n");
875 return;
876
878 warn("Calling DC ZVA! Not Implemeted! Expect WEIRD results\n");
879 return;
880
881 case MISCREG_FPCR:
882 {
883 FPCR fpcr_val = (FPCR)newVal;
884 if (!release->has(ArmExtension::FEAT_AFP)) {
885 fpcr_val.nep = 0;
886 fpcr_val.ah = 0;
887 fpcr_val.fiz = 0;
888 }
889 if (!release->has(ArmExtension::FEAT_EBF16)) {
890 fpcr_val.ebf = 0;
891 }
893 }
894 break;
895 case MISCREG_FPSCR:
896 tc->getDecoderPtr()->as<Decoder>().setContext(newVal);
897 {
898 FPCR fpcr_val = (newVal & FpscrFpcrMask) |
900 ~(uint32_t)FpscrFpcrMask);
902 FPSCR fpsr_val = (newVal & FpscrFpsrMask) |
904 ~(uint32_t)FpscrFpsrMask);
906 }
907 break;
908 case MISCREG_CPSR_Q:
909 {
910 assert(!(newVal & ~CpsrMaskQ));
911 newVal = readMiscRegNoEffect(MISCREG_CPSR) | newVal;
912 idx = MISCREG_CPSR;
913 }
914 break;
915 case MISCREG_FPSCR_QC:
916 {
918 (newVal & FpscrQcMask);
919 idx = MISCREG_FPSR;
920 }
921 break;
923 {
925 (newVal & FpscrExcMask);
926 idx = MISCREG_FPSR;
927 }
928 break;
929 case MISCREG_FPEXC:
930 {
931 // vfpv3 architecture, section B.6.1 of DDI04068
932 // bit 29 - valid only if fpexc[31] is 0
933 const uint32_t fpexcMask = 0x60000000;
934 newVal = (newVal & fpexcMask) |
935 (readMiscRegNoEffect(MISCREG_FPEXC) & ~fpexcMask);
936 }
937 break;
938 case MISCREG_HCR:
939 {
940 const HDCR mdcr = tc->readMiscRegNoEffect(MISCREG_MDCR_EL2);
941 selfDebug->setenableTDETGE((HCR)val, mdcr);
942 }
943 break;
944
945 case MISCREG_HDCR:
946 {
947 const HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
948 selfDebug->setenableTDETGE(hcr, (HDCR)val);
949 }
950 break;
951 case MISCREG_DBGOSLAR:
952 {
953 OSL r = tc->readMiscReg(MISCREG_DBGOSLSR);
954 const uint32_t temp = (val == 0xC5ACCE55)? 0x1 : 0x0;
955 selfDebug->updateOSLock((RegVal) temp);
956 r.oslk = bits(temp,0);
957 tc->setMiscReg(MISCREG_DBGOSLSR, r);
958 }
959 break;
961 selfDebug->updateDBGBCR(idx - MISCREG_DBGBCR0, val);
962 break;
964 selfDebug->updateDBGWCR(idx - MISCREG_DBGWCR0, val);
965 break;
966
967 case MISCREG_MDCR_EL2:
968 {
969 const HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
970 selfDebug->setenableTDETGE(hcr, (HDCR)val);
971 }
972 break;
973 case MISCREG_SDCR:
974 case MISCREG_MDCR_EL3:
975 {
976 selfDebug->setbSDD(val);
977 }
978 break;
980 {
981 selfDebug->setMDBGen(val);
982 DBGDS32 r = tc->readMiscReg(MISCREG_DBGDSCRint);
983 DBGDS32 v = val;
984 r.moe = v.moe;
985 r.udccdis = v.udccdis;
986 r.mdbgen = v.mdbgen;
987 tc->setMiscReg(MISCREG_DBGDSCRint, r);
988 r = tc->readMiscReg(MISCREG_DBGDSCRint);
989 }
990
991 break;
993 {
994 selfDebug->setMDSCRvals(val);
995 }
996 break;
997
999 {
1000 selfDebug->updateOSLock(val);
1001 OSL r = tc->readMiscReg(MISCREG_OSLSR_EL1);
1002 r.oslk = bits(val, 0);
1003 r.oslm_3 = 1;
1004 tc->setMiscReg(MISCREG_OSLSR_EL1, r);
1005 }
1006 break;
1007
1009 selfDebug->updateDBGBCR(idx - MISCREG_DBGBCR0_EL1, val);
1010 break;
1012 selfDebug->updateDBGWCR(idx - MISCREG_DBGWCR0_EL1, val);
1013 break;
1014 case MISCREG_SCR:
1016 break;
1017 case MISCREG_SCTLR:
1018 {
1019 DPRINTF(MiscRegs, "Writing SCTLR: %#x\n", newVal);
1021
1022 MiscRegIndex sctlr_idx;
1023 if (release->has(ArmExtension::SECURITY) &&
1024 !highestELIs64 && !scr.ns) {
1025 sctlr_idx = MISCREG_SCTLR_S;
1026 } else {
1027 sctlr_idx = MISCREG_SCTLR_NS;
1028 }
1029
1030 SCTLR sctlr = miscRegs[sctlr_idx];
1031 SCTLR new_sctlr = newVal;
1032 new_sctlr.nmfi = ((bool)sctlr.nmfi) &&
1033 !release->has(ArmExtension::VIRTUALIZATION);
1034 miscRegs[sctlr_idx] = (RegVal)new_sctlr;
1036 }
1037 [[fallthrough]];
1038 case MISCREG_MIDR:
1039 case MISCREG_ID_PFR0:
1040 case MISCREG_ID_PFR1:
1041 case MISCREG_ID_DFR0:
1042 case MISCREG_ID_MMFR0:
1043 case MISCREG_ID_MMFR1:
1044 case MISCREG_ID_MMFR2:
1045 case MISCREG_ID_MMFR3:
1046 case MISCREG_ID_MMFR4:
1047 case MISCREG_ID_ISAR0:
1048 case MISCREG_ID_ISAR1:
1049 case MISCREG_ID_ISAR2:
1050 case MISCREG_ID_ISAR3:
1051 case MISCREG_ID_ISAR4:
1052 case MISCREG_ID_ISAR5:
1053
1054 case MISCREG_MPIDR:
1055 case MISCREG_FPSID:
1056 case MISCREG_TLBTR:
1057 case MISCREG_MVFR0:
1058 case MISCREG_MVFR1:
1059
1071 // ID registers are constants.
1072 return;
1073
1074 // TLB Invalidate All
1075 case MISCREG_ACTLR:
1076 warn("Not doing anything for write of miscreg ACTLR\n");
1077 break;
1078
1083 pmu->setMiscReg(idx, newVal);
1084 break;
1085
1086
1087 case MISCREG_HSTR: // TJDBX, now redifined to be RES0
1088 {
1089 HSTR hstrMask = 0;
1090 hstrMask.tjdbx = 1;
1091 newVal &= ~((uint32_t) hstrMask);
1092 break;
1093 }
1094 case MISCREG_HCPTR:
1095 {
1096 // If a CP bit in NSACR is 0 then the corresponding bit in
1097 // HCPTR is RAO/WI. Same applies to NSASEDIS
1098 secure_lookup = release->has(ArmExtension::SECURITY) &&
1099 isSecure(tc);
1100 if (!secure_lookup) {
1102 RegVal mask =
1103 (readMiscRegNoEffect(MISCREG_NSACR) ^ 0x7FFF) & 0xBFFF;
1104 newVal = (newVal & ~mask) | (oldValue & mask);
1105 }
1106 break;
1107 }
1108 case MISCREG_HDFAR: // alias for secure DFAR
1109 idx = MISCREG_DFAR_S;
1110 break;
1111 case MISCREG_HIFAR: // alias for secure IFAR
1112 idx = MISCREG_IFAR_S;
1113 break;
1114 case MISCREG_ATS1CPR:
1116 return;
1117 case MISCREG_ATS1CPW:
1119 return;
1120 case MISCREG_ATS1CUR:
1123 return;
1124 case MISCREG_ATS1CUW:
1127 return;
1128 case MISCREG_ATS12NSOPR:
1129 if (!release->has(ArmExtension::SECURITY))
1130 panic("Security Extensions required for ATS12NSOPR");
1132 return;
1133 case MISCREG_ATS12NSOPW:
1134 if (!release->has(ArmExtension::SECURITY))
1135 panic("Security Extensions required for ATS12NSOPW");
1137 return;
1138 case MISCREG_ATS12NSOUR:
1139 if (!release->has(ArmExtension::SECURITY))
1140 panic("Security Extensions required for ATS12NSOUR");
1143 return;
1144 case MISCREG_ATS12NSOUW:
1145 if (!release->has(ArmExtension::SECURITY))
1146 panic("Security Extensions required for ATS12NSOUW");
1149 return;
1150 case MISCREG_ATS1HR:
1152 return;
1153 case MISCREG_ATS1HW:
1155 return;
1156 case MISCREG_TTBCR:
1157 {
1158 TTBCR ttbcr = readMiscRegNoEffect(MISCREG_TTBCR);
1159 const uint32_t ones = (uint32_t)(-1);
1160 TTBCR ttbcrMask = 0;
1161 TTBCR ttbcrNew = newVal;
1162
1163 // ARM DDI 0406C.b, ARMv7-32
1164 ttbcrMask.n = ones; // T0SZ
1165 if (release->has(ArmExtension::SECURITY)) {
1166 ttbcrMask.pd0 = ones;
1167 ttbcrMask.pd1 = ones;
1168 }
1169 ttbcrMask.epd0 = ones;
1170 ttbcrMask.irgn0 = ones;
1171 ttbcrMask.orgn0 = ones;
1172 ttbcrMask.sh0 = ones;
1173 ttbcrMask.ps = ones; // T1SZ
1174 ttbcrMask.a1 = ones;
1175 ttbcrMask.epd1 = ones;
1176 ttbcrMask.irgn1 = ones;
1177 ttbcrMask.orgn1 = ones;
1178 ttbcrMask.sh1 = ones;
1179 if (release->has(ArmExtension::LPAE))
1180 ttbcrMask.eae = ones;
1181
1182 if (release->has(ArmExtension::LPAE) && ttbcrNew.eae) {
1183 newVal = newVal & ttbcrMask;
1184 } else {
1185 newVal = (newVal & ttbcrMask) | (ttbcr & (~ttbcrMask));
1186 }
1187 // Invalidate TLB MiscReg
1189 break;
1190 }
1191 case MISCREG_TTBR0:
1192 case MISCREG_TTBR1:
1193 {
1194 TTBCR ttbcr = readMiscRegNoEffect(MISCREG_TTBCR);
1195 if (release->has(ArmExtension::LPAE)) {
1196 if (ttbcr.eae) {
1197 // ARMv7 bit 63-56, 47-40 reserved, UNK/SBZP
1198 // ARMv8 AArch32 bit 63-56 only
1199 uint64_t ttbrMask = mask(63,56) | mask(47,40);
1200 newVal = (newVal & (~ttbrMask));
1201 }
1202 }
1203 // Invalidate TLB MiscReg
1205 break;
1206 }
1207 case MISCREG_SCTLR_EL1:
1208 case MISCREG_CONTEXTIDR:
1209 case MISCREG_PRRR:
1210 case MISCREG_NMRR:
1211 case MISCREG_MAIR0:
1212 case MISCREG_MAIR1:
1213 case MISCREG_DACR:
1214 case MISCREG_VTTBR:
1215 case MISCREG_SCR_EL3:
1216 case MISCREG_TCR_EL1:
1217 case MISCREG_TCR_EL2:
1218 case MISCREG_TCR_EL3:
1219 case MISCREG_VTCR_EL2:
1220 case MISCREG_SCTLR_EL2:
1221 case MISCREG_SCTLR_EL3:
1222 case MISCREG_HSCTLR:
1223 case MISCREG_TTBR0_EL1:
1224 case MISCREG_TTBR1_EL1:
1225 case MISCREG_TTBR0_EL2:
1226 case MISCREG_TTBR1_EL2:
1227 case MISCREG_TTBR0_EL3:
1228 // Add registers used by indirect permission.
1229 case MISCREG_TCR2_EL1:
1230 case MISCREG_TCR2_EL2:
1231 case MISCREG_PIR_EL1:
1232 case MISCREG_PIR_EL2:
1233 case MISCREG_PIR_EL3:
1234 case MISCREG_PIRE0_EL1:
1235 case MISCREG_PIRE0_EL2:
1237 break;
1238 case MISCREG_HCR_EL2:
1239 {
1240 const HDCR mdcr = tc->readMiscRegNoEffect(MISCREG_MDCR_EL2);
1241 selfDebug->setenableTDETGE((HCR)val, mdcr);
1243 }
1244 break;
1245 case MISCREG_NZCV:
1246 {
1247 CPSR cpsr = val;
1248
1249 tc->setReg(cc_reg::Nz, cpsr.nz);
1250 tc->setReg(cc_reg::C, cpsr.c);
1251 tc->setReg(cc_reg::V, cpsr.v);
1252 }
1253 break;
1254 case MISCREG_DAIF:
1255 {
1256 CPSR cpsr = miscRegs[MISCREG_CPSR];
1257 cpsr.daif = (uint8_t) ((CPSR) newVal).daif;
1258 newVal = cpsr;
1259 idx = MISCREG_CPSR;
1260 }
1261 break;
1262 case MISCREG_SP_EL0:
1263 tc->setReg(int_reg::Sp0, newVal);
1264 break;
1265 case MISCREG_SP_EL1:
1266 tc->setReg(int_reg::Sp1, newVal);
1267 break;
1268 case MISCREG_SP_EL2:
1269 tc->setReg(int_reg::Sp2, newVal);
1270 break;
1271 case MISCREG_SPSEL:
1272 {
1273 CPSR cpsr = miscRegs[MISCREG_CPSR];
1274 cpsr.sp = (uint8_t) ((CPSR) newVal).sp;
1275 newVal = cpsr;
1276 idx = MISCREG_CPSR;
1277 }
1278 break;
1279 case MISCREG_CURRENTEL:
1280 {
1281 CPSR cpsr = miscRegs[MISCREG_CPSR];
1282 cpsr.el = (uint8_t) ((CPSR) newVal).el;
1283 newVal = cpsr;
1284 idx = MISCREG_CPSR;
1285 }
1286 break;
1287 case MISCREG_PAN:
1288 {
1289 // PAN is affecting data accesses
1291
1292 CPSR cpsr = miscRegs[MISCREG_CPSR];
1293 cpsr.pan = (uint8_t) ((CPSR) newVal).pan;
1294 newVal = cpsr;
1295 idx = MISCREG_CPSR;
1296 }
1297 break;
1298 case MISCREG_UAO:
1299 {
1300 // UAO is affecting data accesses
1302
1303 CPSR cpsr = miscRegs[MISCREG_CPSR];
1304 cpsr.uao = (uint8_t) ((CPSR) newVal).uao;
1305 newVal = cpsr;
1306 idx = MISCREG_CPSR;
1307 }
1308 break;
1309 case MISCREG_L2CTLR:
1310 warn("miscreg L2CTLR (%s) written with %#x. ignored...\n",
1311 miscRegName[idx], uint32_t(val));
1312 break;
1313
1314 // Generic Timer registers
1317 getGenericTimer().setMiscReg(idx, newVal);
1318 break;
1322 getGICv3CPUInterface().setMiscReg(idx, newVal);
1323 return;
1324 case MISCREG_ZCR_EL3:
1325 case MISCREG_ZCR_EL2:
1326 case MISCREG_ZCR_EL1:
1327 // Set the value here as we need to update the regs before
1328 // reading them back in getCurSveVecLenInBits to avoid
1329 // setting stale vector lengths in the decoder.
1330 setMiscRegNoEffect(idx, newVal);
1331 tc->getDecoderPtr()->as<Decoder>().setSveLen(
1332 (getCurSveVecLenInBits() >> 7) - 1);
1333 return;
1334 case MISCREG_SMCR_EL3:
1335 case MISCREG_SMCR_EL2:
1336 case MISCREG_SMCR_EL1:
1337 // Set the value here as we need to update the regs before
1338 // reading them back in getCurSmeVecLenInBits to avoid
1339 // setting stale vector lengths in the decoder.
1340 setMiscRegNoEffect(idx, newVal);
1341 tc->getDecoderPtr()->as<Decoder>().setSmeLen(
1342 (getCurSmeVecLenInBits() >> 7) - 1);
1343 return;
1344 }
1345 setMiscRegNoEffect(idx, newVal);
1346 }
1347}
1348
1349RegVal
1351{
1352 int flat_idx = flattenMiscIndex(idx);
1353 return lookUpMiscReg[flat_idx].reset();
1354}
1355
1356void
1358{
1359 int flat_idx = flattenMiscIndex(idx);
1360 InitReg(flat_idx).reset(val);
1361}
1362
1365{
1366 // We only need to create an ISA interface the first time we try
1367 // to access the timer.
1368 if (timer)
1369 return *timer.get();
1370
1371 assert(system);
1372 GenericTimer *generic_timer(system->getGenericTimer());
1373 if (!generic_timer) {
1374 panic("Trying to get a generic timer from a system that hasn't "
1375 "been configured to use a generic timer.\n");
1376 }
1377
1378 timer.reset(new GenericTimerISA(*generic_timer, tc->contextId()));
1379 timer->setThreadContext(tc);
1380
1381 return *timer.get();
1382}
1383
1386{
1388 return *gicv3CpuInterface.get();
1389
1390 auto gicv3_ifc = getGICv3CPUInterface(tc);
1391 panic_if(!gicv3_ifc, "The system does not have a GICv3 irq controller\n");
1392 gicv3CpuInterface.reset(gicv3_ifc);
1393
1394 return *gicv3CpuInterface.get();
1395}
1396
1399{
1400 assert(system);
1401 Gicv3 *gicv3 = dynamic_cast<Gicv3 *>(system->getGIC());
1402 if (gicv3) {
1403 return gicv3->getCPUInterface(tc->contextId());
1404 } else {
1405 return nullptr;
1406 }
1407}
1408
1409bool
1411{
1412 if (!release->has(ArmExtension::SECURITY)) {
1413 return false;
1414 }
1415
1416 SCR scr = miscRegs[MISCREG_SCR];
1417 CPSR cpsr = miscRegs[MISCREG_CPSR];
1418
1419 switch ((OperatingMode) (uint8_t) cpsr.mode) {
1420 case MODE_MON:
1421 case MODE_EL3T:
1422 case MODE_EL3H:
1423 return true;
1424 case MODE_HYP:
1425 case MODE_EL2T:
1426 case MODE_EL2H:
1427 return false;
1428 default:
1429 return !scr.ns;
1430 }
1431}
1432
1435{
1436 CPSR cpsr = readMiscRegNoEffect(MISCREG_CPSR);
1437
1438 return opModeToEL((OperatingMode)(uint8_t)cpsr.mode);
1439}
1440
1441unsigned
1443{
1444 SVCR svcr = miscRegs[MISCREG_SVCR];
1445 // If we are in Streaming Mode, we should return the Streaming Mode vector
1446 // length instead.
1447 if (svcr.sm) {
1448 return getCurSmeVecLenInBits();
1449 }
1450
1451 if (!FullSystem) {
1452 return sveVL * 128;
1453 }
1454
1455 panic_if(!tc,
1456 "A ThreadContext is needed to determine the SVE vector length "
1457 "in full-system mode");
1458
1459 CPSR cpsr = miscRegs[MISCREG_CPSR];
1460 ExceptionLevel el = (ExceptionLevel) (uint8_t) cpsr.el;
1461
1462 unsigned len = 0;
1463
1464 if (el == EL1 || (el == EL0 && !ELIsInHost(tc, el))) {
1465 len = static_cast<ZCR>(miscRegs[MISCREG_ZCR_EL1]).len;
1466 }
1467
1468 if (el == EL2 || (el == EL0 && ELIsInHost(tc, el))) {
1469 len = static_cast<ZCR>(miscRegs[MISCREG_ZCR_EL2]).len;
1470 } else if (release->has(ArmExtension::VIRTUALIZATION) && !isSecure(tc) &&
1471 (el == EL0 || el == EL1)) {
1472 len = std::min(
1473 len,
1474 static_cast<unsigned>(
1475 static_cast<ZCR>(miscRegs[MISCREG_ZCR_EL2]).len));
1476 }
1477
1478 if (el == EL3) {
1479 len = static_cast<ZCR>(miscRegs[MISCREG_ZCR_EL3]).len;
1480 } else if (release->has(ArmExtension::SECURITY)) {
1481 len = std::min(
1482 len,
1483 static_cast<unsigned>(
1484 static_cast<ZCR>(miscRegs[MISCREG_ZCR_EL3]).len));
1485 }
1486
1487 len = std::min(len, sveVL - 1);
1488
1489 return (len + 1) * 128;
1490}
1491
1492unsigned
1494{
1495 if (!FullSystem) {
1496 return smeVL * 128;
1497 }
1498
1499 panic_if(!tc,
1500 "A ThreadContext is needed to determine the SME vector length "
1501 "in full-system mode");
1502
1503 CPSR cpsr = miscRegs[MISCREG_CPSR];
1504 ExceptionLevel el = (ExceptionLevel) (uint8_t) cpsr.el;
1505
1506 unsigned len = 0;
1507
1508 if (el == EL1 || (el == EL0 && !ELIsInHost(tc, el))) {
1509 len = static_cast<SMCR>(miscRegs[MISCREG_SMCR_EL1]).len;
1510 }
1511
1512 if (el == EL2 || (el == EL0 && ELIsInHost(tc, el))) {
1513 len = static_cast<SMCR>(miscRegs[MISCREG_SMCR_EL2]).len;
1514 } else if (release->has(ArmExtension::VIRTUALIZATION) && !isSecure(tc) &&
1515 (el == EL0 || el == EL1)) {
1516 len = std::min(
1517 len,
1518 static_cast<unsigned>(
1519 static_cast<SMCR>(miscRegs[MISCREG_SMCR_EL2]).len));
1520 }
1521
1522 if (el == EL3) {
1523 len = static_cast<SMCR>(miscRegs[MISCREG_SMCR_EL3]).len;
1524 } else if (release->has(ArmExtension::SECURITY)) {
1525 len = std::min(
1526 len,
1527 static_cast<unsigned>(
1528 static_cast<SMCR>(miscRegs[MISCREG_SMCR_EL3]).len));
1529 }
1530
1531 len = std::min(len, smeVL - 1);
1532
1533 // len + 1 must be a power of 2! Round down to the nearest whole power of
1534 // two.
1535 static const unsigned LUT[16] = {0, 1, 1, 3, 3, 3, 3, 7,
1536 7, 7, 7, 7, 7, 7, 7, 15};
1537 len = LUT[len];
1538
1539 return (len + 1) * 128;
1540}
1541
1542void
1544{
1546
1547 DPRINTF(Checkpoint, "Serializing Arm Misc Registers\n");
1549}
1550
1551void
1553{
1554 DPRINTF(Checkpoint, "Unserializing Arm Misc Registers\n");
1556
1557 for (auto idx = 0; idx < NUM_MISCREGS; idx++) {
1558 if (!lookUpMiscReg[idx].info[MISCREG_UNSERIALIZE] &&
1559 miscRegs[idx] != lookUpMiscReg[idx].reset()) {
1560 warn("Checkpoint value for register %s does not match "
1561 "current configuration (checkpointed: %#x, current: %#x)",
1562 miscRegName[idx], miscRegs[idx],
1563 lookUpMiscReg[idx].reset());
1564 miscRegs[idx] = lookUpMiscReg[idx].reset();
1565 }
1566 }
1567
1568 CPSR tmp_cpsr = miscRegs[MISCREG_CPSR];
1569 updateRegMap(tmp_cpsr);
1570}
1571
1572void
1575{
1576 // If we're in timing mode then doing the translation in
1577 // functional mode then we're slightly distorting performance
1578 // results obtained from simulations. The translation should be
1579 // done in the same mode the core is running in. NOTE: This
1580 // can't be an atomic translation because that causes problems
1581 // with unexpected atomic snoop requests.
1582 warn_once("Doing AT (address translation) in functional mode! Fix Me!\n");
1583
1584 auto req = std::make_shared<Request>(
1585 val, 0, flags, Request::funcRequestorId,
1586 tc->pcState().instAddr(), tc->contextId());
1587
1589 req, tc, mode, tran_type);
1590
1591 PAR par = 0;
1592 if (fault == NoFault) {
1593 Addr paddr = req->getPaddr();
1594 TTBCR ttbcr = readMiscRegNoEffect(MISCREG_TTBCR);
1596
1597 uint8_t max_paddr_bit = 0;
1598 if (release->has(ArmExtension::LPAE) &&
1599 (ttbcr.eae || tran_type & MMU::HypMode ||
1600 ((tran_type & MMU::S1S2NsTran) && hcr.vm) )) {
1601
1602 max_paddr_bit = 39;
1603 } else {
1604 max_paddr_bit = 31;
1605 }
1606
1607 par = (paddr & mask(max_paddr_bit, 12)) |
1608 (getMMUPtr(tc)->getAttr());
1609
1610 DPRINTF(MiscRegs,
1611 "MISCREG: Translated addr 0x%08x: PAR: 0x%08x\n",
1612 val, par);
1613 } else {
1614 ArmFault *arm_fault = static_cast<ArmFault *>(fault.get());
1615 arm_fault->update(tc);
1616 // Set fault bit and FSR
1617 FSR fsr = arm_fault->getFsr(tc);
1618
1619 par.f = 0x1; // F bit
1620 par.lpae = fsr.lpae;
1621 par.ptw = (arm_fault->iss() >> 7) & 0x1;
1622 par.s = arm_fault->isStage2() ? 1 : 0;
1623
1624 if (par.lpae) {
1625 // LPAE - rearange fault status
1626 par.fst = fsr.status;
1627 } else {
1628 // VMSA - rearange fault status
1629 par.fs4_0 = fsr.fsLow | (fsr.fsHigh << 5);
1630 par.fs5 = fsr.ext;
1631 }
1632 DPRINTF(MiscRegs,
1633 "MISCREG: Translated addr 0x%08x fault fsr %#x: PAR: 0x%08x\n",
1634 val, fsr, par);
1635 }
1637 return;
1638}
1639
1640template <class XC>
1641static inline void
1643 Addr cacheBlockMask)
1644{
1645 // Should only every see invalidations / direct writes
1646 assert(pkt->isInvalidate() || pkt->isWrite());
1647
1648 DPRINTF(LLSC, "%s: handling snoop for address: %#x locked: %d\n",
1649 tc->getCpuPtr()->name(), pkt->getAddr(),
1650 xc->readMiscReg(MISCREG_LOCKFLAG));
1651 if (!xc->readMiscReg(MISCREG_LOCKFLAG))
1652 return;
1653
1654 Addr locked_addr = xc->readMiscReg(MISCREG_LOCKADDR) & cacheBlockMask;
1655 // If no caches are attached, the snoop address always needs to be masked
1656 Addr snoop_addr = pkt->getAddr() & cacheBlockMask;
1657
1658 DPRINTF(LLSC, "%s: handling snoop for address: %#x locked addr: %#x\n",
1659 tc->getCpuPtr()->name(), snoop_addr, locked_addr);
1660 if (locked_addr == snoop_addr) {
1661 DPRINTF(LLSC, "%s: address match, clearing lock and signaling sev\n",
1662 tc->getCpuPtr()->name());
1663 xc->setMiscReg(MISCREG_LOCKFLAG, false);
1664 // Implement ARMv8 WFE/SEV semantics
1665 sendEvent(tc);
1666 xc->setMiscReg(MISCREG_SEV_MAILBOX, true);
1667 }
1668}
1669
1670void
1672{
1673 lockedSnoopHandler(tc, tc, pkt, cacheBlockMask);
1674}
1675
1676void
1678{
1679 lockedSnoopHandler(xc->tcBase(), xc, pkt, cacheBlockMask);
1680}
1681
1682void
1684{
1685 tc->setMiscReg(MISCREG_LOCKADDR, req->getPaddr());
1686 tc->setMiscReg(MISCREG_LOCKFLAG, true);
1687 DPRINTF(LLSC, "%s: Placing address %#x in monitor\n",
1688 tc->getCpuPtr()->name(), req->getPaddr());
1689}
1690
1691void
1693{
1694 xc->setMiscReg(MISCREG_LOCKADDR, req->getPaddr());
1695 xc->setMiscReg(MISCREG_LOCKFLAG, true);
1696 DPRINTF(LLSC, "%s: Placing address %#x in monitor\n",
1697 xc->tcBase()->getCpuPtr()->name(), req->getPaddr());
1698}
1699
1700void
1702{
1703 DPRINTF(LLSC, "%s: handling snoop lock hit address: %#x\n",
1704 tc->getCpuPtr()->name(), tc->readMiscReg(MISCREG_LOCKADDR));
1705 tc->setMiscReg(MISCREG_LOCKFLAG, false);
1706 tc->setMiscReg(MISCREG_SEV_MAILBOX, true);
1707}
1708
1709void
1711{
1712 DPRINTF(LLSC, "%s: handling snoop lock hit address: %#x\n",
1713 xc->tcBase()->getCpuPtr()->name(),
1715 xc->setMiscReg(MISCREG_LOCKFLAG, false);
1717}
1718
1719template <class XC>
1720static inline bool
1722 Addr cacheBlockMask)
1723{
1724 if (req->isSwap())
1725 return true;
1726
1727 DPRINTF(LLSC, "Handling locked write for address %#x in monitor.\n",
1728 req->getPaddr());
1729 // Verify that the lock flag is still set and the address
1730 // is correct
1731 bool lock_flag = xc->readMiscReg(MISCREG_LOCKFLAG);
1732 Addr lock_addr = xc->readMiscReg(MISCREG_LOCKADDR) & cacheBlockMask;
1733 if (!lock_flag || (req->getPaddr() & cacheBlockMask) != lock_addr) {
1734 // Lock flag not set or addr mismatch in CPU;
1735 // don't even bother sending to memory system
1736 req->setExtraData(0);
1737 xc->setMiscReg(MISCREG_LOCKFLAG, false);
1738 DPRINTF(LLSC, "clearing lock flag in handle locked write\n",
1739 tc->getCpuPtr()->name());
1740 // the rest of this code is not architectural;
1741 // it's just a debugging aid to help detect
1742 // livelock by warning on long sequences of failed
1743 // store conditionals
1744 int stCondFailures = xc->readStCondFailures();
1745 stCondFailures++;
1746 xc->setStCondFailures(stCondFailures);
1747 if (stCondFailures % 100000 == 0) {
1748 warn("context %d: %d consecutive "
1749 "store conditional failures\n",
1750 tc->contextId(), stCondFailures);
1751 }
1752
1753 // store conditional failed already, so don't issue it to mem
1754 return false;
1755 }
1756 return true;
1757}
1758
1759bool
1760ISA::handleLockedWrite(const RequestPtr &req, Addr cacheBlockMask)
1761{
1762 return lockedWriteHandler(tc, tc, req, cacheBlockMask);
1763}
1764
1765bool
1767 Addr cacheBlockMask)
1768{
1769 return lockedWriteHandler(xc->tcBase(), xc, req, cacheBlockMask);
1770}
1771
1772void
1774{
1775 // A spinlock would typically include a Wait For Event (WFE) to
1776 // conserve energy. The ARMv8 architecture specifies that an event
1777 // is automatically generated when clearing the exclusive monitor
1778 // to wake up the processor in WFE.
1779 DPRINTF(LLSC, "Clearing lock and signaling sev\n");
1780 tc->setMiscReg(MISCREG_LOCKFLAG, false);
1781 // Implement ARMv8 WFE/SEV semantics
1782 sendEvent(tc);
1783 tc->setMiscReg(MISCREG_SEV_MAILBOX, true);
1784}
1785
1786void
1788{
1789 // A spinlock would typically include a Wait For Event (WFE) to
1790 // conserve energy. The ARMv8 architecture specifies that an event
1791 // is automatically generated when clearing the exclusive monitor
1792 // to wake up the processor in WFE.
1793 DPRINTF(LLSC, "Clearing lock and signaling sev\n");
1794 xc->setMiscReg(MISCREG_LOCKFLAG, false);
1795 // Implement ARMv8 WFE/SEV semantics
1796 sendEvent(xc->tcBase());
1798}
1799
1800} // namespace ArmISA
1801} // namespace gem5
ISA-specific types for hardware transactional memory.
#define DPRINTF(x,...)
Definition trace.hh:209
virtual FSR getFsr(ThreadContext *tc) const
Definition faults.hh:248
virtual uint32_t iss() const =0
virtual void update(ThreadContext *tc)
Definition faults.cc:413
virtual bool isStage2() const
Definition faults.hh:247
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 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:1410
void setMiscRegReset(RegIndex, RegVal val)
Definition isa.cc:1357
unsigned getCurSveVecLenInBits() const
Definition isa.cc:1442
ExceptionLevel currEL() const
Returns the current Exception Level (EL) of the ISA object.
Definition isa.cc:1434
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:1543
void copyRegsFrom(ThreadContext *src) override
Definition isa.cc:191
const enums::DecoderFlavor _decoderFlavor
Definition isa.hh:78
Random::RandomPtr rng
Definition isa.hh:115
DummyISADevice dummyDevice
Dummy device for to handle non-existing ISA devices.
Definition isa.hh:81
RegVal readMiscRegReset(RegIndex) const
Definition isa.cc:1350
void setupThreadContext()
Definition isa.cc:168
void setMiscRegNoEffect(RegIndex idx, RegVal val) override
Definition isa.cc:681
uint8_t physAddrRange
Definition isa.hh:96
bool haveLargeAsid64
Definition isa.hh:95
void handleLockedSnoop(PacketPtr pkt, Addr cacheBlockMask) override
Definition isa.cc:1671
void clear() override
Definition isa.cc:138
int flattenMiscIndex(int reg) const
Definition isa.hh:205
std::pair< int, int > getMiscIndices(int misc_reg) const
Definition isa.hh:338
RegVal miscRegs[NUM_MISCREGS]
Definition isa.hh:129
unsigned smeVL
SME vector length in quadwords.
Definition isa.hh:102
BaseISADevice * pmu
Definition isa.hh:84
std::unique_ptr< BaseISADevice > timer
Definition isa.hh:87
bool handleLockedWrite(const RequestPtr &req, Addr cacheBlockMask) override
Definition isa.cc:1760
SelfDebug * selfDebug
Definition isa.hh:113
void globalClearExclusive() override
Definition isa.cc:1773
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition isa.cc:1552
void updateRegMap(CPSR cpsr)
Definition isa.hh:133
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:1385
ArmSystem * system
Definition isa.hh:75
BaseISADevice & getGenericTimer()
Definition isa.cc:1364
RegVal readMiscRegNoEffect(RegIndex idx) const override
Definition isa.cc:399
bool impdefAsNop
If true, accesses to IMPLEMENTATION DEFINED registers are treated as NOP hence not causing UNDEFINED ...
Definition isa.hh:111
void setMiscReg(RegIndex, RegVal val) override
Definition isa.cc:703
unsigned sveVL
SVE vector length in quadwords.
Definition isa.hh:99
const MiscRegLUTEntryInitializer InitReg(uint32_t reg)
Definition isa.hh:118
void handleLockedRead(const RequestPtr &req) override
Definition isa.cc:1683
enums::DecoderFlavor decoderFlavor() const
Definition isa.hh:402
void addressTranslation(MMU::ArmTranslationType tran_type, BaseMMU::Mode mode, Request::Flags flags, RegVal val)
Definition isa.cc:1573
void initializeMiscRegMetadata()
Definition misc.cc:3082
const ArmRelease * release
This could be either a FS or a SE release.
Definition isa.hh:105
bool highestELIs64
Definition isa.hh:93
RegVal readMiscReg(RegIndex idx) override
Definition isa.cc:423
void handleLockedSnoopHit() override
Definition isa.cc:1701
ISA(const Params &p)
Definition isa.cc:86
std::unique_ptr< BaseISADevice > gicv3CpuInterface
Definition isa.hh:90
ExceptionLevel highestEL
Definition isa.hh:94
unsigned getCurSmeVecLenInBits() const
Definition isa.cc:1493
void invalidateMiscReg()
Definition mmu.cc:209
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:87
chain reset(uint64_t res_val) const
Definition misc.hh:1346
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
BaseISA(const SimObjectParams &p, const std::string &name)
Definition isa.hh:64
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:190
virtual std::string name() const
Definition named.hh:60
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:282
gem5::Flags< FlagsType > Flags
Definition request.hh:102
SimObjectParams Params
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual RegVal getReg(const RegId &reg) const
virtual BaseCPU * getCpuPtr()=0
virtual const PCStateBase & pcState() const =0
virtual RegVal readMiscRegNoEffect(RegIndex misc_reg) const =0
virtual ContextID contextId() const =0
This module implements the global system counter and the local per-CPU architected timers as specifie...
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:220
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Definition logging.hh:246
virtual void startup()
startup() is the final initialization call before simulation.
Definition sim_object.cc:96
#define warn(...)
Definition logging.hh:288
#define warn_once(...)
Definition logging.hh:292
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:283
Bitfield< 28 > v
Definition misc_types.hh:54
static const uint32_t FpscrQcMask
Definition misc.hh:3017
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:291
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
static const uint32_t FpscrExcMask
Definition misc.hh:3021
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:459
constexpr RegClass vecElemClass
Definition vec.hh:104
const RegClass flatIntRegClass
Definition int.hh:178
static const uint32_t CpsrMaskQ
Definition misc.hh:3000
bool EL2Enabled(ThreadContext *tc)
Definition utility.cc:268
void preUnflattenMiscReg()
Definition misc.cc:722
gem5::MatStore< MaxSmeVecLenInBytes, MaxSmeVecLenInBytes > MatRegContainer
Definition mat.hh:60
constexpr RegClass vecPredRegClass
Definition vec.hh:108
static const uint32_t FpscrFpcrMask
Definition misc.hh:3023
constexpr RegClass ccRegClass
Definition cc.hh:87
@ MISCREG_NSACR
Definition misc.hh:263
@ MISCREG_ID_AA64PFR0_EL1
Definition misc.hh:591
@ MISCREG_DBGBCR15
Definition misc.hh:155
@ MISCREG_DBGOSLSR
Definition misc.hh:206
@ MISCREG_TTBR1_EL12
Definition misc.hh:635
@ MISCREG_CNTV_CTL_EL0
Definition misc.hh:843
@ MISCREG_HCR
Definition misc.hh:266
@ MISCREG_HDFAR
Definition misc.hh:307
@ MISCREG_PIR_EL2
Definition misc.hh:1193
@ MISCREG_MPIDR_EL1
Definition misc.hh:570
@ MISCREG_ATS1HR
Definition misc.hh:337
@ MISCREG_SCTLR_EL2
Definition misc.hh:616
@ MISCREG_CNTV_CVAL_EL02
Definition misc.hh:850
@ MISCREG_CNTP_CTL_EL0
Definition misc.hh:840
@ MISCREG_PMOVSSET
Definition misc.hh:396
@ MISCREG_FPEXC
Definition misc.hh:93
@ MISCREG_PIRE0_EL1
Definition misc.hh:1189
@ MISCREG_CNTP_CTL_EL02
Definition misc.hh:846
@ MISCREG_SPSEL
Definition misc.hh:655
@ MISCREG_TCR_EL2
Definition misc.hh:641
@ MISCREG_RNDRRS
Definition misc.hh:1160
@ MISCREG_DBGDSCRint
Definition misc.hh:114
@ MISCREG_MVFR1
Definition misc.hh:91
@ MISCREG_PIR_EL1
Definition misc.hh:1192
@ MISCREG_MIDR_EL1
Definition misc.hh:569
@ MISCREG_ZCR_EL2
Definition misc.hh:1141
@ MISCREG_ICC_IGRPEN1_EL3
Definition misc.hh:967
@ MISCREG_CNTFRQ
Definition misc.hh:443
@ MISCREG_AFSR1_EL12
Definition misc.hh:676
@ MISCREG_CPSR_Q
Definition misc.hh:97
@ MISCREG_MAIR_EL1
Definition misc.hh:810
@ MISCREG_ICC_PMR_EL1
Definition misc.hh:922
@ MISCREG_CONTEXTIDR_EL1
Definition misc.hh:829
@ MISCREG_CNTV_TVAL
Definition misc.hh:457
@ MISCREG_HCPTR
Definition misc.hh:269
@ MISCREG_SPSR_EL2
Definition misc.hh:663
@ MISCREG_ID_MMFR1
Definition misc.hh:234
@ MISCREG_LOCKFLAG
Definition misc.hh:101
@ MISCREG_ICH_LR15_EL2
Definition misc.hh:999
@ MISCREG_FPSID
Definition misc.hh:89
@ MISCREG_MAIR_EL12
Definition misc.hh:811
@ MISCREG_SCTLR
Definition misc.hh:253
@ MISCREG_TTBCR
Definition misc.hh:278
@ MISCREG_ATS12NSOUW
Definition misc.hh:329
@ MISCREG_MAIR_EL2
Definition misc.hh:814
@ MISCREG_CNTV_CVAL
Definition misc.hh:456
@ MISCREG_CSSELR
Definition misc.hh:248
@ MISCREG_CPACR
Definition misc.hh:259
@ MISCREG_SCR_EL3
Definition misc.hh:628
@ MISCREG_CNTKCTL_EL12
Definition misc.hh:853
@ MISCREG_ID_AA64DFR0_EL1
Definition misc.hh:593
@ MISCREG_DBGOSLAR
Definition misc.hh:205
@ MISCREG_DBGDSCRext
Definition misc.hh:121
@ MISCREG_SCTLR2_EL12
Definition misc.hh:612
@ MISCREG_SCTLR2_EL1
Definition misc.hh:611
@ MISCREG_TCR_EL3
Definition misc.hh:648
@ MISCREG_SMCR_EL1
Definition misc.hh:1154
@ MISCREG_FPSR
Definition misc.hh:660
@ MISCREG_CPACR_EL12
Definition misc.hh:615
@ MISCREG_HDCR
Definition misc.hh:268
@ MISCREG_ESR_EL1
Definition misc.hh:677
@ MISCREG_CNTP_TVAL
Definition misc.hh:452
@ MISCREG_TCR_EL1
Definition misc.hh:636
@ MISCREG_CNTVCT
Definition misc.hh:445
@ MISCREG_ESR_EL12
Definition misc.hh:678
@ MISCREG_AFSR0_EL1
Definition misc.hh:673
@ MISCREG_ID_ISAR5
Definition misc.hh:243
@ MISCREG_ATS1CUR
Definition misc.hh:324
@ MISCREG_OSLAR_EL1
Definition misc.hh:558
@ MISCREG_CNTPCT_EL0
Definition misc.hh:838
@ MISCREG_MPAM1_EL1
Definition misc.hh:1173
@ MISCREG_AFSR1_EL2
Definition misc.hh:681
@ MISCREG_CNTV_CTL_EL02
Definition misc.hh:849
@ MISCREG_DBGBCR0_EL1
Definition misc.hh:504
@ MISCREG_PIR_EL3
Definition misc.hh:1194
@ MISCREG_ID_ISAR4
Definition misc.hh:242
@ MISCREG_SCTLR_EL1
Definition misc.hh:609
@ MISCREG_CNTP_TVAL_EL02
Definition misc.hh:848
@ MISCREG_PRRR
Definition misc.hh:399
@ MISCREG_CPTR_EL2
Definition misc.hh:622
@ MISCREG_CCSIDR
Definition misc.hh:245
@ MISCREG_FAR_EL1
Definition misc.hh:687
@ MISCREG_DBGWCR0
Definition misc.hh:172
@ MISCREG_PMCR
Definition misc.hh:369
@ MISCREG_CNTHV_CTL_EL2
Definition misc.hh:865
@ MISCREG_CNTV_CTL
Definition misc.hh:455
@ MISCREG_ID_AA64DFR1_EL1
Definition misc.hh:594
@ MISCREG_ID_AA64ISAR1_EL1
Definition misc.hh:598
@ MISCREG_SMCR_EL3
Definition misc.hh:1151
@ MISCREG_ELR_EL12
Definition misc.hh:653
@ MISCREG_PMEVCNTR0_EL0
Definition misc.hh:874
@ MISCREG_VBAR_EL12
Definition misc.hh:821
@ MISCREG_ID_AA64MMFR1_EL1
Definition misc.hh:600
@ MISCREG_PIR_EL12
Definition misc.hh:1195
@ MISCREG_TTBR0_EL12
Definition misc.hh:633
@ MISCREG_ATS12NSOUR
Definition misc.hh:328
@ MISCREG_CNTVCT_EL0
Definition misc.hh:839
@ MISCREG_SP_EL0
Definition misc.hh:654
@ MISCREG_DFAR_S
Definition misc.hh:303
@ MISCREG_CPSR
Definition misc.hh:79
@ MISCREG_FPCR
Definition misc.hh:659
@ MISCREG_SDCR
Definition misc.hh:260
@ MISCREG_CPACR_EL1
Definition misc.hh:614
@ MISCREG_ID_MMFR0
Definition misc.hh:233
@ MISCREG_PMEVTYPER5_EL0
Definition misc.hh:885
@ MISCREG_CNTP_CVAL
Definition misc.hh:449
@ MISCREG_ID_ISAR0
Definition misc.hh:238
@ MISCREG_CNTKCTL_EL1
Definition misc.hh:852
@ MISCREG_SP_EL2
Definition misc.hh:672
@ MISCREG_NMRR
Definition misc.hh:405
@ MISCREG_SCTLR_EL12
Definition misc.hh:610
@ MISCREG_TTBR1_EL1
Definition misc.hh:634
@ MISCREG_MAIR1
Definition misc.hh:408
@ MISCREG_DAIF
Definition misc.hh:658
@ MISCREG_SEV_MAILBOX
Definition misc.hh:109
@ MISCREG_SPSR_EL12
Definition misc.hh:651
@ MISCREG_CNTP_CVAL_EL02
Definition misc.hh:847
@ MISCREG_PMINTENSET_EL1
Definition misc.hh:794
@ MISCREG_CNTHPS_CVAL_EL2
Definition misc.hh:862
@ MISCREG_REVIDR
Definition misc.hh:228
@ MISCREG_ID_MMFR3
Definition misc.hh:236
@ MISCREG_ICH_LRC15
Definition misc.hh:1136
@ MISCREG_TCR2_EL12
Definition misc.hh:639
@ MISCREG_ISR
Definition misc.hh:426
@ MISCREG_TCR2_EL2
Definition misc.hh:642
@ MISCREG_CONTEXTIDR
Definition misc.hh:429
@ MISCREG_CNTHPS_TVAL_EL2
Definition misc.hh:863
@ MISCREG_SCR
Definition misc.hh:261
@ MISCREG_ELR_EL2
Definition misc.hh:664
@ MISCREG_CONTEXTIDR_EL2
Definition misc.hh:901
@ MISCREG_TCR_EL12
Definition misc.hh:637
@ MISCREG_CNTHCTL_EL2
Definition misc.hh:857
@ MISCREG_MDSCR_EL1
Definition misc.hh:485
@ MISCREG_ID_DFR0
Definition misc.hh:231
@ MISCREG_TTBR1_EL2
Definition misc.hh:904
@ MISCREG_ID_AA64MMFR0_EL1
Definition misc.hh:599
@ MISCREG_AMAIR_EL1
Definition misc.hh:812
@ MISCREG_ATS1HW
Definition misc.hh:338
@ MISCREG_DC_ZVA_Xt
Definition misc.hh:703
@ MISCREG_CNTHVS_TVAL_EL2
Definition misc.hh:870
@ MISCREG_ATS1CPR
Definition misc.hh:322
@ MISCREG_NZCV
Definition misc.hh:657
@ MISCREG_SPSR_EL1
Definition misc.hh:650
@ MISCREG_FAR_EL12
Definition misc.hh:688
@ MISCREG_CNTP_CVAL_EL0
Definition misc.hh:841
@ MISCREG_HCR_EL2
Definition misc.hh:619
@ MISCREG_CNTHVS_CVAL_EL2
Definition misc.hh:869
@ MISCREG_SMCR_EL2
Definition misc.hh:1152
@ MISCREG_ATS1CPW
Definition misc.hh:323
@ MISCREG_TTBR1
Definition misc.hh:275
@ MISCREG_MPIDR
Definition misc.hh:227
@ MISCREG_ZCR_EL1
Definition misc.hh:1143
@ MISCREG_ID_AA64MMFR2_EL1
Definition misc.hh:906
@ MISCREG_VTCR_EL2
Definition misc.hh:644
@ MISCREG_VTTBR
Definition misc.hh:478
@ MISCREG_CNTVOFF_EL2
Definition misc.hh:872
@ MISCREG_VPIDR
Definition misc.hh:251
@ MISCREG_DBGWCR15
Definition misc.hh:187
@ MISCREG_CNTHPS_CTL_EL2
Definition misc.hh:861
@ MISCREG_VBAR_EL2
Definition misc.hh:824
@ MISCREG_CLIDR
Definition misc.hh:246
@ MISCREG_SCTLR_S
Definition misc.hh:255
@ MISCREG_MDCR_EL2
Definition misc.hh:621
@ MISCREG_PIRE0_EL2
Definition misc.hh:1190
@ MISCREG_CNTHV_TVAL_EL2
Definition misc.hh:867
@ MISCREG_VBAR_EL1
Definition misc.hh:820
@ MISCREG_MIDR
Definition misc.hh:223
@ MISCREG_AMAIR_EL2
Definition misc.hh:815
@ MISCREG_L2CTLR
Definition misc.hh:397
@ MISCREG_CNTP_CTL
Definition misc.hh:446
@ MISCREG_TTBR0_EL3
Definition misc.hh:647
@ MISCREG_DBGWCR0_EL1
Definition misc.hh:536
@ MISCREG_ATS12NSOPW
Definition misc.hh:327
@ MISCREG_ISR_EL1
Definition misc.hh:823
@ MISCREG_CNTVOFF
Definition misc.hh:463
@ MISCREG_PIRE0_EL12
Definition misc.hh:1191
@ MISCREG_TLBTR
Definition misc.hh:226
@ MISCREG_ID_AA64AFR1_EL1
Definition misc.hh:596
@ MISCREG_AFSR0_EL12
Definition misc.hh:674
@ MISCREG_ELR_EL1
Definition misc.hh:652
@ MISCREG_AMAIR_EL12
Definition misc.hh:813
@ NUM_PHYS_MISCREGS
Definition misc.hh:1202
@ MISCREG_DBGWCR15_EL1
Definition misc.hh:551
@ MISCREG_TCR2_EL1
Definition misc.hh:638
@ MISCREG_ID_PFR1
Definition misc.hh:230
@ MISCREG_CNTHP_CVAL_EL2
Definition misc.hh:859
@ MISCREG_CNTV_TVAL_EL0
Definition misc.hh:845
@ MISCREG_MPAM2_EL2
Definition misc.hh:1174
@ MISCREG_ZCR_EL3
Definition misc.hh:1140
@ MISCREG_FPSCR
Definition misc.hh:90
@ MISCREG_TTBR0
Definition misc.hh:272
@ MISCREG_DACR
Definition misc.hh:283
@ MISCREG_TTBR0_EL2
Definition misc.hh:640
@ MISCREG_HSCTLR
Definition misc.hh:264
@ MISCREG_SCTLR_NS
Definition misc.hh:254
@ MISCREG_ICC_AP0R0
Definition misc.hh:1044
@ MISCREG_TTBR0_EL1
Definition misc.hh:632
@ MISCREG_SCTLR_EL3
Definition misc.hh:625
@ MISCREG_CNTP_TVAL_EL0
Definition misc.hh:842
@ MISCREG_FPSCR_QC
Definition misc.hh:99
@ MISCREG_CURRENTEL
Definition misc.hh:656
@ MISCREG_ICH_AP0R0_EL2
Definition misc.hh:970
@ MISCREG_ID_ISAR1
Definition misc.hh:239
@ MISCREG_DBGBCR0
Definition misc.hh:140
@ MISCREG_ID_AA64AFR0_EL1
Definition misc.hh:595
@ MISCREG_ATS12NSOPR
Definition misc.hh:326
@ MISCREG_OSLSR_EL1
Definition misc.hh:559
@ MISCREG_DBGBCR15_EL1
Definition misc.hh:519
@ MISCREG_MVFR0
Definition misc.hh:92
@ MISCREG_ID_AA64ISAR0_EL1
Definition misc.hh:597
@ MISCREG_HIFAR
Definition misc.hh:308
@ MISCREG_CNTHP_TVAL_EL2
Definition misc.hh:860
@ MISCREG_ID_MMFR2
Definition misc.hh:235
@ MISCREG_FAR_EL2
Definition misc.hh:689
@ MISCREG_CNTHVS_CTL_EL2
Definition misc.hh:868
@ MISCREG_FPSCR_EXC
Definition misc.hh:98
@ MISCREG_CNTV_TVAL_EL02
Definition misc.hh:851
@ MISCREG_MPAM1_EL12
Definition misc.hh:1176
@ MISCREG_ID_ISAR3
Definition misc.hh:241
@ MISCREG_CNTHP_CTL_EL2
Definition misc.hh:858
@ MISCREG_PAR
Definition misc.hh:312
@ MISCREG_CONTEXTIDR_EL12
Definition misc.hh:830
@ MISCREG_CPTR_EL3
Definition misc.hh:630
@ MISCREG_ESR_EL2
Definition misc.hh:682
@ MISCREG_ID_PFR0
Definition misc.hh:229
@ MISCREG_IFAR_S
Definition misc.hh:306
@ MISCREG_ID_MMFR4
Definition misc.hh:237
@ MISCREG_AFSR1_EL1
Definition misc.hh:675
@ MISCREG_CNTHV_CVAL_EL2
Definition misc.hh:866
@ MISCREG_LOCKADDR
Definition misc.hh:100
@ MISCREG_CNTFRQ_EL0
Definition misc.hh:837
@ MISCREG_ID_AFR0
Definition misc.hh:232
@ MISCREG_ACTLR
Definition misc.hh:256
@ MISCREG_PMXEVTYPER_PMCCFILTR
Definition misc.hh:108
@ MISCREG_ID_AA64PFR1_EL1
Definition misc.hh:592
@ MISCREG_HSTR
Definition misc.hh:270
@ MISCREG_MDCR_EL3
Definition misc.hh:631
@ MISCREG_AFSR0_EL2
Definition misc.hh:680
@ MISCREG_ID_ISAR2
Definition misc.hh:240
@ MISCREG_CNTV_CVAL_EL0
Definition misc.hh:844
@ MISCREG_ZCR_EL12
Definition misc.hh:1142
@ MISCREG_SP_EL1
Definition misc.hh:665
@ MISCREG_ATS1CUW
Definition misc.hh:325
@ MISCREG_MAIR0
Definition misc.hh:402
@ MISCREG_PMOVSSET_EL0
Definition misc.hh:809
gem5::VecRegContainer< NumVecElemPerVecReg *sizeof(VecElem)> VecRegContainer
Definition vec.hh:64
Bitfield< 3, 2 > el
Definition misc_types.hh:73
@ MISCREG_WARN_NOT_FAIL
Definition misc.hh:1241
@ MISCREG_UNSERIALIZE
Definition misc.hh:1240
@ MISCREG_IMPLEMENTED
Definition misc.hh:1237
int unflattenMiscReg(int reg)
Definition misc.cc:738
static bool lockedWriteHandler(ThreadContext *tc, XC *xc, const RequestPtr &req, Addr cacheBlockMask)
Definition isa.cc:1721
static const uint32_t FpscrFpsrMask
Definition misc.hh:3025
static ExceptionLevel opModeToEL(OperatingMode mode)
Definition types.hh:429
constexpr RegClass miscRegClass
Definition misc.hh:2992
const char *const miscRegName[]
Definition misc.hh:1849
RegVal readMPIDR(ArmSystem *arm_sys, ThreadContext *tc)
This helper function is either returing the value of MPIDR_EL1 (by calling getMPIDR),...
Definition utility.cc:148
static void lockedSnoopHandler(ThreadContext *tc, XC *xc, PacketPtr pkt, Addr cacheBlockMask)
Definition isa.cc:1642
std::vector< struct MiscRegLUTEntry > lookUpMiscReg(NUM_MISCREGS)
Definition misc.hh:1728
constexpr RegClass vecRegClass
Definition vec.hh:100
Bitfield< 4 > pc
Bitfield< 0 > p
Bitfield< 5, 3 > reg
Definition types.hh:92
Bitfield< 63 > val
Definition misc.hh:804
constexpr RegClass floatRegClass
Definition float.hh:143
Copyright (c) 2024 Arm Limited 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
Packet * PacketPtr
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:683
#define SERIALIZE_MAPPING(member, names, size)
Definition serialize.hh:677

Generated on Mon Oct 27 2025 04:12:58 for gem5 by doxygen 1.14.0