gem5 [DEVELOP-FOR-25.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),
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_FPSCR_QC:
515 case MISCREG_FPSR:
516 {
517 const uint32_t ones = (uint32_t)(-1);
518 FPSCR fpscrMask = 0;
519 fpscrMask.ioc = ones;
520 fpscrMask.dzc = ones;
521 fpscrMask.ofc = ones;
522 fpscrMask.ufc = ones;
523 fpscrMask.ixc = ones;
524 fpscrMask.idc = ones;
525 fpscrMask.qc = ones;
526 fpscrMask.v = ones;
527 fpscrMask.c = ones;
528 fpscrMask.z = ones;
529 fpscrMask.n = ones;
530 return readMiscRegNoEffect(MISCREG_FPSCR) & (uint32_t)fpscrMask;
531 }
532 case MISCREG_FPCR:
533 {
534 const uint32_t ones = (uint32_t)(-1);
535 FPSCR fpscrMask = 0;
536 fpscrMask.len = ones;
537 fpscrMask.fz16 = ones;
538 fpscrMask.stride = ones;
539 fpscrMask.rMode = ones;
540 fpscrMask.fz = ones;
541 fpscrMask.dn = ones;
542 fpscrMask.ahp = ones;
543 return readMiscRegNoEffect(MISCREG_FPSCR) & (uint32_t)fpscrMask;
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 return getGenericTimer().readMiscReg(idx);
660
664 return getGICv3CPUInterface().readMiscReg(idx);
665
666 default:
667 break;
668
669 }
670 return readMiscRegNoEffect(idx);
671}
672
673void
675{
676 assert(idx < NUM_MISCREGS);
677
678 const auto &reg = lookUpMiscReg[idx]; // bit masks
679 const auto &map = getMiscIndices(idx);
680 int lower = map.first, upper = map.second;
681
682 auto v = (val & ~reg.wi()) | reg.rao();
683 if (upper > 0) {
684 miscRegs[lower] = bits(v, 31, 0);
685 miscRegs[upper] = bits(v, 63, 32);
686 DPRINTF(MiscRegs, "Writing MiscReg %s (%d %d:%d) : %#x\n",
687 miscRegName[idx], idx, lower, upper, v);
688 } else {
689 miscRegs[lower] = v;
690 DPRINTF(MiscRegs, "Writing MiscReg %s (%d %d) : %#x\n",
691 miscRegName[idx], idx, lower, v);
692 }
693}
694
695void
697{
698
699 RegVal newVal = val;
700 bool secure_lookup;
701 SCR scr;
702
703 if (idx == MISCREG_CPSR) {
705
706
707 CPSR old_cpsr = miscRegs[MISCREG_CPSR];
708 int old_mode = old_cpsr.mode;
709 CPSR cpsr = val;
710 if (cpsr.pan != old_cpsr.pan || cpsr.il != old_cpsr.il) {
712 }
713
714 DPRINTF(Arm, "Updating CPSR from %#x to %#x f:%d i:%d a:%d d:%d "
715 "mode:%#x\n", miscRegs[idx], cpsr, cpsr.f, cpsr.i, cpsr.a,
716 cpsr.d, cpsr.mode);
717 PCState pc = tc->pcState().as<PCState>();
718 pc.nextThumb(cpsr.t);
719 pc.illegalExec(cpsr.il == 1);
720 selfDebug->setDebugMask(cpsr.d == 1);
721
722 tc->getDecoderPtr()->as<Decoder>().setSveLen(
723 (getCurSveVecLenInBits() >> 7) - 1);
724 tc->getDecoderPtr()->as<Decoder>().setSmeLen(
725 (getCurSmeVecLenInBits() >> 7) - 1);
726
727 // Follow slightly different semantics if a CheckerCPU object
728 // is connected
729 CheckerCPU *checker = tc->getCheckerCpuPtr();
730 if (checker) {
731 tc->pcStateNoRecord(pc);
732 } else {
733 tc->pcState(pc);
734 }
735
736 setMiscRegNoEffect(idx, newVal);
737
738 if (old_mode != cpsr.mode) {
740 if (gicv3CpuInterface) {
741 // The assertion and de-assertion of IRQs and FIQs are
742 // affected by the current Exception level and Security
743 // state of the PE. As part of the Context
744 // Synchronization that occurs as the result of taking
745 // or returning from an exception, the CPU interface
746 // ensures that IRQ and FIQ are both appropriately
747 // asserted or deasserted for the Exception level and
748 // Security state that the PE is entering.
749 static_cast<Gicv3CPUInterface&>(
750 getGICv3CPUInterface()).update();
751 }
752 }
753 } else {
754#ifndef NDEBUG
755 auto& miscreg_info = lookUpMiscReg[idx].info;
756 if (!miscreg_info[MISCREG_IMPLEMENTED]) {
757 if (miscreg_info[MISCREG_WARN_NOT_FAIL])
758 warn("Unimplemented system register %s write with %#x.\n",
759 miscRegName[idx], val);
760 else
761 panic("Unimplemented system register %s write with %#x.\n",
762 miscRegName[idx], val);
763 }
764#endif
765 idx = redirectRegVHE(idx);
766
767 switch (unflattenMiscReg(idx)) {
768 case MISCREG_CPACR:
769 {
770
771 const uint32_t ones = (uint32_t)(-1);
772 CPACR cpacrMask = 0;
773 // Only cp10, cp11, and ase are implemented
774 // nothing else should be writable
775 cpacrMask.cp10 = ones;
776 cpacrMask.cp11 = ones;
777 cpacrMask.asedis = ones;
778
779 // Security Extensions may limit the writability of CPACR
780 if (release->has(ArmExtension::SECURITY)) {
783 if (scr.ns && (cpsr.mode != MODE_MON) && ELIs32(tc, EL3)) {
784 NSACR nsacr = readMiscRegNoEffect(MISCREG_NSACR);
785 // NB: Skipping the full loop, here
786 if (!nsacr.cp10) cpacrMask.cp10 = 0;
787 if (!nsacr.cp11) cpacrMask.cp11 = 0;
788 }
789 }
790
792 newVal &= cpacrMask;
793 newVal |= old_val & ~cpacrMask;
794 DPRINTF(MiscRegs, "Writing misc reg %s: %#x\n",
795 miscRegName[idx], newVal);
796 }
797 break;
799 {
800 const uint32_t ones = (uint32_t)(-1);
801 CPACR cpacrMask = 0;
802 cpacrMask.tta = ones;
803 cpacrMask.fpen = ones;
804 if (release->has(ArmExtension::FEAT_SVE)) {
805 cpacrMask.zen = ones;
806 }
807 if (release->has(ArmExtension::FEAT_SME)) {
808 cpacrMask.smen = ones;
809 }
810 newVal &= cpacrMask;
811 DPRINTF(MiscRegs, "Writing misc reg %s: %#x\n",
812 miscRegName[idx], newVal);
813 }
814 break;
815 case MISCREG_CPTR_EL2:
816 {
817 const HCR hcr = readMiscRegNoEffect(MISCREG_HCR_EL2);
818 const uint32_t ones = (uint32_t)(-1);
819 CPTR cptrMask = 0;
820 cptrMask.tcpac = ones;
821 cptrMask.tta = ones;
822 cptrMask.tfp = ones;
823 if (release->has(ArmExtension::FEAT_SVE)) {
824 cptrMask.tz = ones;
825 cptrMask.zen = hcr.e2h ? ones : 0;
826 }
827 if (release->has(ArmExtension::FEAT_SME)) {
828 cptrMask.tsm = ones;
829 cptrMask.smen = hcr.e2h ? ones : 0;
830 }
831 cptrMask.fpen = hcr.e2h ? ones : 0;
832 newVal &= cptrMask;
833 cptrMask = 0;
834 cptrMask.res1_13_el2 = ones;
835 cptrMask.res1_7_0_el2 = ones;
836 if (!release->has(ArmExtension::FEAT_SVE)) {
837 cptrMask.res1_8_el2 = ones;
838 }
839 if (!release->has(ArmExtension::FEAT_SME)) {
840 cptrMask.res1_12_el2 = ones;
841 }
842 cptrMask.res1_9_el2 = ones;
843 newVal |= cptrMask;
844 DPRINTF(MiscRegs, "Writing misc reg %s: %#x\n",
845 miscRegName[idx], newVal);
846 }
847 break;
848 case MISCREG_CPTR_EL3:
849 {
850 const uint32_t ones = (uint32_t)(-1);
851 CPTR cptrMask = 0;
852 cptrMask.tcpac = ones;
853 cptrMask.tta = ones;
854 cptrMask.tfp = ones;
855 if (release->has(ArmExtension::FEAT_SVE)) {
856 cptrMask.ez = ones;
857 }
858 if (release->has(ArmExtension::FEAT_SME)) {
859 cptrMask.esm = ones;
860 }
861 newVal &= cptrMask;
862 DPRINTF(MiscRegs, "Writing misc reg %s: %#x\n",
863 miscRegName[idx], newVal);
864 }
865 break;
866 case MISCREG_CSSELR:
867 warn_once("The csselr register isn't implemented.\n");
868 return;
869
871 warn("Calling DC ZVA! Not Implemeted! Expect WEIRD results\n");
872 return;
873
874 case MISCREG_FPSCR:
875 tc->getDecoderPtr()->as<Decoder>().setContext(newVal);
876 break;
877 case MISCREG_FPSR:
878 {
879 const uint32_t ones = (uint32_t)(-1);
880 FPSCR fpscrMask = 0;
881 fpscrMask.ioc = ones;
882 fpscrMask.dzc = ones;
883 fpscrMask.ofc = ones;
884 fpscrMask.ufc = ones;
885 fpscrMask.ixc = ones;
886 fpscrMask.idc = ones;
887 fpscrMask.qc = ones;
888 fpscrMask.v = ones;
889 fpscrMask.c = ones;
890 fpscrMask.z = ones;
891 fpscrMask.n = ones;
892 newVal = (newVal & (uint32_t)fpscrMask) |
894 ~(uint32_t)fpscrMask);
895 idx = MISCREG_FPSCR;
896 }
897 break;
898 case MISCREG_FPCR:
899 {
900 const uint32_t ones = (uint32_t)(-1);
901 FPSCR fpscrMask = 0;
902 fpscrMask.len = ones;
903 fpscrMask.fz16 = ones;
904 fpscrMask.stride = ones;
905 fpscrMask.rMode = ones;
906 fpscrMask.fz = ones;
907 fpscrMask.dn = ones;
908 fpscrMask.ahp = ones;
909 newVal = (newVal & (uint32_t)fpscrMask) |
911 ~(uint32_t)fpscrMask);
912 idx = MISCREG_FPSCR;
913 }
914 break;
915 case MISCREG_CPSR_Q:
916 {
917 assert(!(newVal & ~CpsrMaskQ));
918 newVal = readMiscRegNoEffect(MISCREG_CPSR) | newVal;
919 idx = MISCREG_CPSR;
920 }
921 break;
922 case MISCREG_FPSCR_QC:
923 {
925 (newVal & FpscrQcMask);
926 idx = MISCREG_FPSCR;
927 }
928 break;
930 {
932 (newVal & FpscrExcMask);
933 idx = MISCREG_FPSCR;
934 }
935 break;
936 case MISCREG_FPEXC:
937 {
938 // vfpv3 architecture, section B.6.1 of DDI04068
939 // bit 29 - valid only if fpexc[31] is 0
940 const uint32_t fpexcMask = 0x60000000;
941 newVal = (newVal & fpexcMask) |
942 (readMiscRegNoEffect(MISCREG_FPEXC) & ~fpexcMask);
943 }
944 break;
945 case MISCREG_HCR:
946 {
947 const HDCR mdcr = tc->readMiscRegNoEffect(MISCREG_MDCR_EL2);
948 selfDebug->setenableTDETGE((HCR)val, mdcr);
949 }
950 break;
951
952 case MISCREG_HDCR:
953 {
954 const HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
955 selfDebug->setenableTDETGE(hcr, (HDCR)val);
956 }
957 break;
958 case MISCREG_DBGOSLAR:
959 {
960 OSL r = tc->readMiscReg(MISCREG_DBGOSLSR);
961 const uint32_t temp = (val == 0xC5ACCE55)? 0x1 : 0x0;
962 selfDebug->updateOSLock((RegVal) temp);
963 r.oslk = bits(temp,0);
964 tc->setMiscReg(MISCREG_DBGOSLSR, r);
965 }
966 break;
968 selfDebug->updateDBGBCR(idx - MISCREG_DBGBCR0, val);
969 break;
971 selfDebug->updateDBGWCR(idx - MISCREG_DBGWCR0, val);
972 break;
973
974 case MISCREG_MDCR_EL2:
975 {
976 const HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
977 selfDebug->setenableTDETGE(hcr, (HDCR)val);
978 }
979 break;
980 case MISCREG_SDCR:
981 case MISCREG_MDCR_EL3:
982 {
983 selfDebug->setbSDD(val);
984 }
985 break;
987 {
988 selfDebug->setMDBGen(val);
989 DBGDS32 r = tc->readMiscReg(MISCREG_DBGDSCRint);
990 DBGDS32 v = val;
991 r.moe = v.moe;
992 r.udccdis = v.udccdis;
993 r.mdbgen = v.mdbgen;
994 tc->setMiscReg(MISCREG_DBGDSCRint, r);
995 r = tc->readMiscReg(MISCREG_DBGDSCRint);
996 }
997
998 break;
1000 {
1001 selfDebug->setMDSCRvals(val);
1002 }
1003 break;
1004
1005 case MISCREG_OSLAR_EL1:
1006 {
1007 selfDebug->updateOSLock(val);
1008 OSL r = tc->readMiscReg(MISCREG_OSLSR_EL1);
1009 r.oslk = bits(val, 0);
1010 r.oslm_3 = 1;
1011 tc->setMiscReg(MISCREG_OSLSR_EL1, r);
1012 }
1013 break;
1014
1016 selfDebug->updateDBGBCR(idx - MISCREG_DBGBCR0_EL1, val);
1017 break;
1019 selfDebug->updateDBGWCR(idx - MISCREG_DBGWCR0_EL1, val);
1020 break;
1021 case MISCREG_SCR:
1023 break;
1024 case MISCREG_SCTLR:
1025 {
1026 DPRINTF(MiscRegs, "Writing SCTLR: %#x\n", newVal);
1028
1029 MiscRegIndex sctlr_idx;
1030 if (release->has(ArmExtension::SECURITY) &&
1031 !highestELIs64 && !scr.ns) {
1032 sctlr_idx = MISCREG_SCTLR_S;
1033 } else {
1034 sctlr_idx = MISCREG_SCTLR_NS;
1035 }
1036
1037 SCTLR sctlr = miscRegs[sctlr_idx];
1038 SCTLR new_sctlr = newVal;
1039 new_sctlr.nmfi = ((bool)sctlr.nmfi) &&
1040 !release->has(ArmExtension::VIRTUALIZATION);
1041 miscRegs[sctlr_idx] = (RegVal)new_sctlr;
1043 }
1044 case MISCREG_MIDR:
1045 case MISCREG_ID_PFR0:
1046 case MISCREG_ID_PFR1:
1047 case MISCREG_ID_DFR0:
1048 case MISCREG_ID_MMFR0:
1049 case MISCREG_ID_MMFR1:
1050 case MISCREG_ID_MMFR2:
1051 case MISCREG_ID_MMFR3:
1052 case MISCREG_ID_MMFR4:
1053 case MISCREG_ID_ISAR0:
1054 case MISCREG_ID_ISAR1:
1055 case MISCREG_ID_ISAR2:
1056 case MISCREG_ID_ISAR3:
1057 case MISCREG_ID_ISAR4:
1058 case MISCREG_ID_ISAR5:
1059
1060 case MISCREG_MPIDR:
1061 case MISCREG_FPSID:
1062 case MISCREG_TLBTR:
1063 case MISCREG_MVFR0:
1064 case MISCREG_MVFR1:
1065
1077 // ID registers are constants.
1078 return;
1079
1080 // TLB Invalidate All
1081 case MISCREG_ACTLR:
1082 warn("Not doing anything for write of miscreg ACTLR\n");
1083 break;
1084
1089 pmu->setMiscReg(idx, newVal);
1090 break;
1091
1092
1093 case MISCREG_HSTR: // TJDBX, now redifined to be RES0
1094 {
1095 HSTR hstrMask = 0;
1096 hstrMask.tjdbx = 1;
1097 newVal &= ~((uint32_t) hstrMask);
1098 break;
1099 }
1100 case MISCREG_HCPTR:
1101 {
1102 // If a CP bit in NSACR is 0 then the corresponding bit in
1103 // HCPTR is RAO/WI. Same applies to NSASEDIS
1104 secure_lookup = release->has(ArmExtension::SECURITY) &&
1105 isSecure(tc);
1106 if (!secure_lookup) {
1108 RegVal mask =
1109 (readMiscRegNoEffect(MISCREG_NSACR) ^ 0x7FFF) & 0xBFFF;
1110 newVal = (newVal & ~mask) | (oldValue & mask);
1111 }
1112 break;
1113 }
1114 case MISCREG_HDFAR: // alias for secure DFAR
1115 idx = MISCREG_DFAR_S;
1116 break;
1117 case MISCREG_HIFAR: // alias for secure IFAR
1118 idx = MISCREG_IFAR_S;
1119 break;
1120 case MISCREG_ATS1CPR:
1122 return;
1123 case MISCREG_ATS1CPW:
1125 return;
1126 case MISCREG_ATS1CUR:
1129 return;
1130 case MISCREG_ATS1CUW:
1133 return;
1134 case MISCREG_ATS12NSOPR:
1135 if (!release->has(ArmExtension::SECURITY))
1136 panic("Security Extensions required for ATS12NSOPR");
1138 return;
1139 case MISCREG_ATS12NSOPW:
1140 if (!release->has(ArmExtension::SECURITY))
1141 panic("Security Extensions required for ATS12NSOPW");
1143 return;
1144 case MISCREG_ATS12NSOUR:
1145 if (!release->has(ArmExtension::SECURITY))
1146 panic("Security Extensions required for ATS12NSOUR");
1149 return;
1150 case MISCREG_ATS12NSOUW:
1151 if (!release->has(ArmExtension::SECURITY))
1152 panic("Security Extensions required for ATS12NSOUW");
1155 return;
1156 case MISCREG_ATS1HR:
1158 return;
1159 case MISCREG_ATS1HW:
1161 return;
1162 case MISCREG_TTBCR:
1163 {
1164 TTBCR ttbcr = readMiscRegNoEffect(MISCREG_TTBCR);
1165 const uint32_t ones = (uint32_t)(-1);
1166 TTBCR ttbcrMask = 0;
1167 TTBCR ttbcrNew = newVal;
1168
1169 // ARM DDI 0406C.b, ARMv7-32
1170 ttbcrMask.n = ones; // T0SZ
1171 if (release->has(ArmExtension::SECURITY)) {
1172 ttbcrMask.pd0 = ones;
1173 ttbcrMask.pd1 = ones;
1174 }
1175 ttbcrMask.epd0 = ones;
1176 ttbcrMask.irgn0 = ones;
1177 ttbcrMask.orgn0 = ones;
1178 ttbcrMask.sh0 = ones;
1179 ttbcrMask.ps = ones; // T1SZ
1180 ttbcrMask.a1 = ones;
1181 ttbcrMask.epd1 = ones;
1182 ttbcrMask.irgn1 = ones;
1183 ttbcrMask.orgn1 = ones;
1184 ttbcrMask.sh1 = ones;
1185 if (release->has(ArmExtension::LPAE))
1186 ttbcrMask.eae = ones;
1187
1188 if (release->has(ArmExtension::LPAE) && ttbcrNew.eae) {
1189 newVal = newVal & ttbcrMask;
1190 } else {
1191 newVal = (newVal & ttbcrMask) | (ttbcr & (~ttbcrMask));
1192 }
1193 // Invalidate TLB MiscReg
1195 break;
1196 }
1197 case MISCREG_TTBR0:
1198 case MISCREG_TTBR1:
1199 {
1200 TTBCR ttbcr = readMiscRegNoEffect(MISCREG_TTBCR);
1201 if (release->has(ArmExtension::LPAE)) {
1202 if (ttbcr.eae) {
1203 // ARMv7 bit 63-56, 47-40 reserved, UNK/SBZP
1204 // ARMv8 AArch32 bit 63-56 only
1205 uint64_t ttbrMask = mask(63,56) | mask(47,40);
1206 newVal = (newVal & (~ttbrMask));
1207 }
1208 }
1209 // Invalidate TLB MiscReg
1211 break;
1212 }
1213 case MISCREG_SCTLR_EL1:
1214 case MISCREG_CONTEXTIDR:
1215 case MISCREG_PRRR:
1216 case MISCREG_NMRR:
1217 case MISCREG_MAIR0:
1218 case MISCREG_MAIR1:
1219 case MISCREG_DACR:
1220 case MISCREG_VTTBR:
1221 case MISCREG_SCR_EL3:
1222 case MISCREG_TCR_EL1:
1223 case MISCREG_TCR_EL2:
1224 case MISCREG_TCR_EL3:
1225 case MISCREG_VTCR_EL2:
1226 case MISCREG_SCTLR_EL2:
1227 case MISCREG_SCTLR_EL3:
1228 case MISCREG_HSCTLR:
1229 case MISCREG_TTBR0_EL1:
1230 case MISCREG_TTBR1_EL1:
1231 case MISCREG_TTBR0_EL2:
1232 case MISCREG_TTBR1_EL2:
1233 case MISCREG_TTBR0_EL3:
1234 // Add registers used by indirect permission.
1235 case MISCREG_TCR2_EL1:
1236 case MISCREG_TCR2_EL2:
1237 case MISCREG_PIR_EL1:
1238 case MISCREG_PIR_EL2:
1239 case MISCREG_PIR_EL3:
1240 case MISCREG_PIRE0_EL1:
1241 case MISCREG_PIRE0_EL2:
1243 break;
1244 case MISCREG_HCR_EL2:
1245 {
1246 const HDCR mdcr = tc->readMiscRegNoEffect(MISCREG_MDCR_EL2);
1247 selfDebug->setenableTDETGE((HCR)val, mdcr);
1249 }
1250 break;
1251 case MISCREG_NZCV:
1252 {
1253 CPSR cpsr = val;
1254
1255 tc->setReg(cc_reg::Nz, cpsr.nz);
1256 tc->setReg(cc_reg::C, cpsr.c);
1257 tc->setReg(cc_reg::V, cpsr.v);
1258 }
1259 break;
1260 case MISCREG_DAIF:
1261 {
1262 CPSR cpsr = miscRegs[MISCREG_CPSR];
1263 cpsr.daif = (uint8_t) ((CPSR) newVal).daif;
1264 newVal = cpsr;
1265 idx = MISCREG_CPSR;
1266 }
1267 break;
1268 case MISCREG_SP_EL0:
1269 tc->setReg(int_reg::Sp0, newVal);
1270 break;
1271 case MISCREG_SP_EL1:
1272 tc->setReg(int_reg::Sp1, newVal);
1273 break;
1274 case MISCREG_SP_EL2:
1275 tc->setReg(int_reg::Sp2, newVal);
1276 break;
1277 case MISCREG_SPSEL:
1278 {
1279 CPSR cpsr = miscRegs[MISCREG_CPSR];
1280 cpsr.sp = (uint8_t) ((CPSR) newVal).sp;
1281 newVal = cpsr;
1282 idx = MISCREG_CPSR;
1283 }
1284 break;
1285 case MISCREG_CURRENTEL:
1286 {
1287 CPSR cpsr = miscRegs[MISCREG_CPSR];
1288 cpsr.el = (uint8_t) ((CPSR) newVal).el;
1289 newVal = cpsr;
1290 idx = MISCREG_CPSR;
1291 }
1292 break;
1293 case MISCREG_PAN:
1294 {
1295 // PAN is affecting data accesses
1297
1298 CPSR cpsr = miscRegs[MISCREG_CPSR];
1299 cpsr.pan = (uint8_t) ((CPSR) newVal).pan;
1300 newVal = cpsr;
1301 idx = MISCREG_CPSR;
1302 }
1303 break;
1304 case MISCREG_UAO:
1305 {
1306 // UAO is affecting data accesses
1308
1309 CPSR cpsr = miscRegs[MISCREG_CPSR];
1310 cpsr.uao = (uint8_t) ((CPSR) newVal).uao;
1311 newVal = cpsr;
1312 idx = MISCREG_CPSR;
1313 }
1314 break;
1315 case MISCREG_L2CTLR:
1316 warn("miscreg L2CTLR (%s) written with %#x. ignored...\n",
1317 miscRegName[idx], uint32_t(val));
1318 break;
1319
1320 // Generic Timer registers
1323 getGenericTimer().setMiscReg(idx, newVal);
1324 break;
1328 getGICv3CPUInterface().setMiscReg(idx, newVal);
1329 return;
1330 case MISCREG_ZCR_EL3:
1331 case MISCREG_ZCR_EL2:
1332 case MISCREG_ZCR_EL1:
1333 // Set the value here as we need to update the regs before
1334 // reading them back in getCurSveVecLenInBits to avoid
1335 // setting stale vector lengths in the decoder.
1336 setMiscRegNoEffect(idx, newVal);
1337 tc->getDecoderPtr()->as<Decoder>().setSveLen(
1338 (getCurSveVecLenInBits() >> 7) - 1);
1339 return;
1340 case MISCREG_SMCR_EL3:
1341 case MISCREG_SMCR_EL2:
1342 case MISCREG_SMCR_EL1:
1343 // Set the value here as we need to update the regs before
1344 // reading them back in getCurSmeVecLenInBits to avoid
1345 // setting stale vector lengths in the decoder.
1346 setMiscRegNoEffect(idx, newVal);
1347 tc->getDecoderPtr()->as<Decoder>().setSmeLen(
1348 (getCurSmeVecLenInBits() >> 7) - 1);
1349 return;
1350 }
1351 setMiscRegNoEffect(idx, newVal);
1352 }
1353}
1354
1355RegVal
1357{
1358 int flat_idx = flattenMiscIndex(idx);
1359 return lookUpMiscReg[flat_idx].reset();
1360}
1361
1362void
1364{
1365 int flat_idx = flattenMiscIndex(idx);
1366 InitReg(flat_idx).reset(val);
1367}
1368
1371{
1372 // We only need to create an ISA interface the first time we try
1373 // to access the timer.
1374 if (timer)
1375 return *timer.get();
1376
1377 assert(system);
1378 GenericTimer *generic_timer(system->getGenericTimer());
1379 if (!generic_timer) {
1380 panic("Trying to get a generic timer from a system that hasn't "
1381 "been configured to use a generic timer.\n");
1382 }
1383
1384 timer.reset(new GenericTimerISA(*generic_timer, tc->contextId()));
1385 timer->setThreadContext(tc);
1386
1387 return *timer.get();
1388}
1389
1392{
1394 return *gicv3CpuInterface.get();
1395
1396 auto gicv3_ifc = getGICv3CPUInterface(tc);
1397 panic_if(!gicv3_ifc, "The system does not have a GICv3 irq controller\n");
1398 gicv3CpuInterface.reset(gicv3_ifc);
1399
1400 return *gicv3CpuInterface.get();
1401}
1402
1405{
1406 assert(system);
1407 Gicv3 *gicv3 = dynamic_cast<Gicv3 *>(system->getGIC());
1408 if (gicv3) {
1409 return gicv3->getCPUInterface(tc->contextId());
1410 } else {
1411 return nullptr;
1412 }
1413}
1414
1415bool
1417{
1418 if (!release->has(ArmExtension::SECURITY)) {
1419 return false;
1420 }
1421
1422 SCR scr = miscRegs[MISCREG_SCR];
1423 CPSR cpsr = miscRegs[MISCREG_CPSR];
1424
1425 switch ((OperatingMode) (uint8_t) cpsr.mode) {
1426 case MODE_MON:
1427 case MODE_EL3T:
1428 case MODE_EL3H:
1429 return true;
1430 case MODE_HYP:
1431 case MODE_EL2T:
1432 case MODE_EL2H:
1433 return false;
1434 default:
1435 return !scr.ns;
1436 }
1437}
1438
1441{
1442 CPSR cpsr = readMiscRegNoEffect(MISCREG_CPSR);
1443
1444 return opModeToEL((OperatingMode)(uint8_t)cpsr.mode);
1445}
1446
1447unsigned
1449{
1450 SVCR svcr = miscRegs[MISCREG_SVCR];
1451 // If we are in Streaming Mode, we should return the Streaming Mode vector
1452 // length instead.
1453 if (svcr.sm) {
1454 return getCurSmeVecLenInBits();
1455 }
1456
1457 if (!FullSystem) {
1458 return sveVL * 128;
1459 }
1460
1461 panic_if(!tc,
1462 "A ThreadContext is needed to determine the SVE vector length "
1463 "in full-system mode");
1464
1465 CPSR cpsr = miscRegs[MISCREG_CPSR];
1466 ExceptionLevel el = (ExceptionLevel) (uint8_t) cpsr.el;
1467
1468 unsigned len = 0;
1469
1470 if (el == EL1 || (el == EL0 && !ELIsInHost(tc, el))) {
1471 len = static_cast<ZCR>(miscRegs[MISCREG_ZCR_EL1]).len;
1472 }
1473
1474 if (el == EL2 || (el == EL0 && ELIsInHost(tc, el))) {
1475 len = static_cast<ZCR>(miscRegs[MISCREG_ZCR_EL2]).len;
1476 } else if (release->has(ArmExtension::VIRTUALIZATION) && !isSecure(tc) &&
1477 (el == EL0 || el == EL1)) {
1478 len = std::min(
1479 len,
1480 static_cast<unsigned>(
1481 static_cast<ZCR>(miscRegs[MISCREG_ZCR_EL2]).len));
1482 }
1483
1484 if (el == EL3) {
1485 len = static_cast<ZCR>(miscRegs[MISCREG_ZCR_EL3]).len;
1486 } else if (release->has(ArmExtension::SECURITY)) {
1487 len = std::min(
1488 len,
1489 static_cast<unsigned>(
1490 static_cast<ZCR>(miscRegs[MISCREG_ZCR_EL3]).len));
1491 }
1492
1493 len = std::min(len, sveVL - 1);
1494
1495 return (len + 1) * 128;
1496}
1497
1498unsigned
1500{
1501 if (!FullSystem) {
1502 return smeVL * 128;
1503 }
1504
1505 panic_if(!tc,
1506 "A ThreadContext is needed to determine the SME vector length "
1507 "in full-system mode");
1508
1509 CPSR cpsr = miscRegs[MISCREG_CPSR];
1510 ExceptionLevel el = (ExceptionLevel) (uint8_t) cpsr.el;
1511
1512 unsigned len = 0;
1513
1514 if (el == EL1 || (el == EL0 && !ELIsInHost(tc, el))) {
1515 len = static_cast<SMCR>(miscRegs[MISCREG_SMCR_EL1]).len;
1516 }
1517
1518 if (el == EL2 || (el == EL0 && ELIsInHost(tc, el))) {
1519 len = static_cast<SMCR>(miscRegs[MISCREG_SMCR_EL2]).len;
1520 } else if (release->has(ArmExtension::VIRTUALIZATION) && !isSecure(tc) &&
1521 (el == EL0 || el == EL1)) {
1522 len = std::min(
1523 len,
1524 static_cast<unsigned>(
1525 static_cast<SMCR>(miscRegs[MISCREG_SMCR_EL2]).len));
1526 }
1527
1528 if (el == EL3) {
1529 len = static_cast<SMCR>(miscRegs[MISCREG_SMCR_EL3]).len;
1530 } else if (release->has(ArmExtension::SECURITY)) {
1531 len = std::min(
1532 len,
1533 static_cast<unsigned>(
1534 static_cast<SMCR>(miscRegs[MISCREG_SMCR_EL3]).len));
1535 }
1536
1537 len = std::min(len, smeVL - 1);
1538
1539 // len + 1 must be a power of 2! Round down to the nearest whole power of
1540 // two.
1541 static const unsigned LUT[16] = {0, 1, 1, 3, 3, 3, 3, 7,
1542 7, 7, 7, 7, 7, 7, 7, 15};
1543 len = LUT[len];
1544
1545 return (len + 1) * 128;
1546}
1547
1548void
1550{
1552
1553 DPRINTF(Checkpoint, "Serializing Arm Misc Registers\n");
1555}
1556
1557void
1559{
1560 DPRINTF(Checkpoint, "Unserializing Arm Misc Registers\n");
1562
1563 for (auto idx = 0; idx < NUM_MISCREGS; idx++) {
1564 if (!lookUpMiscReg[idx].info[MISCREG_UNSERIALIZE] &&
1565 miscRegs[idx] != lookUpMiscReg[idx].reset()) {
1566 warn("Checkpoint value for register %s does not match "
1567 "current configuration (checkpointed: %#x, current: %#x)",
1568 miscRegName[idx], miscRegs[idx],
1569 lookUpMiscReg[idx].reset());
1570 miscRegs[idx] = lookUpMiscReg[idx].reset();
1571 }
1572 }
1573
1574 CPSR tmp_cpsr = miscRegs[MISCREG_CPSR];
1575 updateRegMap(tmp_cpsr);
1576}
1577
1578void
1581{
1582 // If we're in timing mode then doing the translation in
1583 // functional mode then we're slightly distorting performance
1584 // results obtained from simulations. The translation should be
1585 // done in the same mode the core is running in. NOTE: This
1586 // can't be an atomic translation because that causes problems
1587 // with unexpected atomic snoop requests.
1588 warn_once("Doing AT (address translation) in functional mode! Fix Me!\n");
1589
1590 auto req = std::make_shared<Request>(
1591 val, 0, flags, Request::funcRequestorId,
1592 tc->pcState().instAddr(), tc->contextId());
1593
1595 req, tc, mode, tran_type);
1596
1597 PAR par = 0;
1598 if (fault == NoFault) {
1599 Addr paddr = req->getPaddr();
1600 TTBCR ttbcr = readMiscRegNoEffect(MISCREG_TTBCR);
1602
1603 uint8_t max_paddr_bit = 0;
1604 if (release->has(ArmExtension::LPAE) &&
1605 (ttbcr.eae || tran_type & MMU::HypMode ||
1606 ((tran_type & MMU::S1S2NsTran) && hcr.vm) )) {
1607
1608 max_paddr_bit = 39;
1609 } else {
1610 max_paddr_bit = 31;
1611 }
1612
1613 par = (paddr & mask(max_paddr_bit, 12)) |
1614 (getMMUPtr(tc)->getAttr());
1615
1616 DPRINTF(MiscRegs,
1617 "MISCREG: Translated addr 0x%08x: PAR: 0x%08x\n",
1618 val, par);
1619 } else {
1620 ArmFault *arm_fault = static_cast<ArmFault *>(fault.get());
1621 arm_fault->update(tc);
1622 // Set fault bit and FSR
1623 FSR fsr = arm_fault->getFsr(tc);
1624
1625 par.f = 0x1; // F bit
1626 par.lpae = fsr.lpae;
1627 par.ptw = (arm_fault->iss() >> 7) & 0x1;
1628 par.s = arm_fault->isStage2() ? 1 : 0;
1629
1630 if (par.lpae) {
1631 // LPAE - rearange fault status
1632 par.fst = fsr.status;
1633 } else {
1634 // VMSA - rearange fault status
1635 par.fs4_0 = fsr.fsLow | (fsr.fsHigh << 5);
1636 par.fs5 = fsr.ext;
1637 }
1638 DPRINTF(MiscRegs,
1639 "MISCREG: Translated addr 0x%08x fault fsr %#x: PAR: 0x%08x\n",
1640 val, fsr, par);
1641 }
1643 return;
1644}
1645
1646template <class XC>
1647static inline void
1649 Addr cacheBlockMask)
1650{
1651 // Should only every see invalidations / direct writes
1652 assert(pkt->isInvalidate() || pkt->isWrite());
1653
1654 DPRINTF(LLSC, "%s: handling snoop for address: %#x locked: %d\n",
1655 tc->getCpuPtr()->name(), pkt->getAddr(),
1656 xc->readMiscReg(MISCREG_LOCKFLAG));
1657 if (!xc->readMiscReg(MISCREG_LOCKFLAG))
1658 return;
1659
1660 Addr locked_addr = xc->readMiscReg(MISCREG_LOCKADDR) & cacheBlockMask;
1661 // If no caches are attached, the snoop address always needs to be masked
1662 Addr snoop_addr = pkt->getAddr() & cacheBlockMask;
1663
1664 DPRINTF(LLSC, "%s: handling snoop for address: %#x locked addr: %#x\n",
1665 tc->getCpuPtr()->name(), snoop_addr, locked_addr);
1666 if (locked_addr == snoop_addr) {
1667 DPRINTF(LLSC, "%s: address match, clearing lock and signaling sev\n",
1668 tc->getCpuPtr()->name());
1669 xc->setMiscReg(MISCREG_LOCKFLAG, false);
1670 // Implement ARMv8 WFE/SEV semantics
1671 sendEvent(tc);
1672 xc->setMiscReg(MISCREG_SEV_MAILBOX, true);
1673 }
1674}
1675
1676void
1678{
1679 lockedSnoopHandler(tc, tc, pkt, cacheBlockMask);
1680}
1681
1682void
1684{
1685 lockedSnoopHandler(xc->tcBase(), xc, pkt, cacheBlockMask);
1686}
1687
1688void
1690{
1691 tc->setMiscReg(MISCREG_LOCKADDR, req->getPaddr());
1692 tc->setMiscReg(MISCREG_LOCKFLAG, true);
1693 DPRINTF(LLSC, "%s: Placing address %#x in monitor\n",
1694 tc->getCpuPtr()->name(), req->getPaddr());
1695}
1696
1697void
1699{
1700 xc->setMiscReg(MISCREG_LOCKADDR, req->getPaddr());
1701 xc->setMiscReg(MISCREG_LOCKFLAG, true);
1702 DPRINTF(LLSC, "%s: Placing address %#x in monitor\n",
1703 xc->tcBase()->getCpuPtr()->name(), req->getPaddr());
1704}
1705
1706void
1708{
1709 DPRINTF(LLSC, "%s: handling snoop lock hit address: %#x\n",
1710 tc->getCpuPtr()->name(), tc->readMiscReg(MISCREG_LOCKADDR));
1711 tc->setMiscReg(MISCREG_LOCKFLAG, false);
1712 tc->setMiscReg(MISCREG_SEV_MAILBOX, true);
1713}
1714
1715void
1717{
1718 DPRINTF(LLSC, "%s: handling snoop lock hit address: %#x\n",
1719 xc->tcBase()->getCpuPtr()->name(),
1721 xc->setMiscReg(MISCREG_LOCKFLAG, false);
1723}
1724
1725template <class XC>
1726static inline bool
1728 Addr cacheBlockMask)
1729{
1730 if (req->isSwap())
1731 return true;
1732
1733 DPRINTF(LLSC, "Handling locked write for address %#x in monitor.\n",
1734 req->getPaddr());
1735 // Verify that the lock flag is still set and the address
1736 // is correct
1737 bool lock_flag = xc->readMiscReg(MISCREG_LOCKFLAG);
1738 Addr lock_addr = xc->readMiscReg(MISCREG_LOCKADDR) & cacheBlockMask;
1739 if (!lock_flag || (req->getPaddr() & cacheBlockMask) != lock_addr) {
1740 // Lock flag not set or addr mismatch in CPU;
1741 // don't even bother sending to memory system
1742 req->setExtraData(0);
1743 xc->setMiscReg(MISCREG_LOCKFLAG, false);
1744 DPRINTF(LLSC, "clearing lock flag in handle locked write\n",
1745 tc->getCpuPtr()->name());
1746 // the rest of this code is not architectural;
1747 // it's just a debugging aid to help detect
1748 // livelock by warning on long sequences of failed
1749 // store conditionals
1750 int stCondFailures = xc->readStCondFailures();
1751 stCondFailures++;
1752 xc->setStCondFailures(stCondFailures);
1753 if (stCondFailures % 100000 == 0) {
1754 warn("context %d: %d consecutive "
1755 "store conditional failures\n",
1756 tc->contextId(), stCondFailures);
1757 }
1758
1759 // store conditional failed already, so don't issue it to mem
1760 return false;
1761 }
1762 return true;
1763}
1764
1765bool
1766ISA::handleLockedWrite(const RequestPtr &req, Addr cacheBlockMask)
1767{
1768 return lockedWriteHandler(tc, tc, req, cacheBlockMask);
1769}
1770
1771bool
1773 Addr cacheBlockMask)
1774{
1775 return lockedWriteHandler(xc->tcBase(), xc, req, cacheBlockMask);
1776}
1777
1778void
1780{
1781 // A spinlock would typically include a Wait For Event (WFE) to
1782 // conserve energy. The ARMv8 architecture specifies that an event
1783 // is automatically generated when clearing the exclusive monitor
1784 // to wake up the processor in WFE.
1785 DPRINTF(LLSC, "Clearing lock and signaling sev\n");
1786 tc->setMiscReg(MISCREG_LOCKFLAG, false);
1787 // Implement ARMv8 WFE/SEV semantics
1788 sendEvent(tc);
1789 tc->setMiscReg(MISCREG_SEV_MAILBOX, true);
1790}
1791
1792void
1794{
1795 // A spinlock would typically include a Wait For Event (WFE) to
1796 // conserve energy. The ARMv8 architecture specifies that an event
1797 // is automatically generated when clearing the exclusive monitor
1798 // to wake up the processor in WFE.
1799 DPRINTF(LLSC, "Clearing lock and signaling sev\n");
1800 xc->setMiscReg(MISCREG_LOCKFLAG, false);
1801 // Implement ARMv8 WFE/SEV semantics
1802 sendEvent(xc->tcBase());
1804}
1805
1806} // namespace ArmISA
1807} // 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:1416
void setMiscRegReset(RegIndex, RegVal val)
Definition isa.cc:1363
unsigned getCurSveVecLenInBits() const
Definition isa.cc:1448
ExceptionLevel currEL() const
Returns the current Exception Level (EL) of the ISA object.
Definition isa.cc:1440
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:1549
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:1356
void setupThreadContext()
Definition isa.cc:168
void setMiscRegNoEffect(RegIndex idx, RegVal val) override
Definition isa.cc:674
uint8_t physAddrRange
Definition isa.hh:96
bool haveLargeAsid64
Definition isa.hh:95
void handleLockedSnoop(PacketPtr pkt, Addr cacheBlockMask) override
Definition isa.cc:1677
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:1766
SelfDebug * selfDebug
Definition isa.hh:113
void globalClearExclusive() override
Definition isa.cc:1779
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition isa.cc:1558
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:1391
ArmSystem * system
Definition isa.hh:75
BaseISADevice & getGenericTimer()
Definition isa.cc:1370
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:696
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:1689
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:1579
void initializeMiscRegMetadata()
Definition misc.cc:3058
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:1707
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:1499
void invalidateMiscReg()
Definition mmu.cc:208
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:86
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:189
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
constexpr RegClass flatIntRegClass
Definition int.hh:178
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:458
constexpr RegClass vecElemClass
Definition vec.hh:105
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:109
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:1727
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:1648
std::vector< struct MiscRegLUTEntry > lookUpMiscReg(NUM_MISCREGS)
Definition misc.hh:1728
constexpr RegClass vecRegClass
Definition vec.hh:101
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 May 26 2025 09:19:05 for gem5 by doxygen 1.13.2