gem5 v23.0.0.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
utility.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009-2014, 2016-2020, 2022 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/utility.hh"
39
40#include <memory>
41
42#include "arch/arm/faults.hh"
44#include "arch/arm/isa.hh"
45#include "arch/arm/mmu.hh"
46#include "arch/arm/page_size.hh"
47#include "arch/arm/regs/cc.hh"
48#include "arch/arm/regs/int.hh"
49#include "arch/arm/regs/vec.hh"
50#include "arch/arm/system.hh"
51#include "base/compiler.hh"
52#include "cpu/base.hh"
53#include "cpu/checker/cpu.hh"
54#include "cpu/thread_context.hh"
55#include "mem/port_proxy.hh"
56#include "sim/full_system.hh"
57
58namespace gem5
59{
60
61namespace ArmISA
62{
63
64void
66{
67 if (tc->readMiscReg(MISCREG_SEV_MAILBOX) == 0) {
68 // Post Interrupt and wake cpu if needed
69 tc->getCpuPtr()->postInterrupt(tc->threadId(), INT_SEV, 0);
70 }
71}
72
73bool
75{
76 CPSR cpsr = tc->readMiscReg(MISCREG_CPSR);
77 if (ArmSystem::haveEL(tc, EL3) && !cpsr.width && currEL(tc) == EL3)
78 return true;
79 if (ArmSystem::haveEL(tc, EL3) && cpsr.width && cpsr.mode == MODE_MON)
80 return true;
81 else
82 return isSecureBelowEL3(tc);
83}
84
85bool
87{
88 return ArmSystem::haveEL(tc, EL3) &&
89 static_cast<SCR>(tc->readMiscRegNoEffect(MISCREG_SCR_EL3)).ns == 0;
90}
91
94{
95 bool route_to_el2;
96 if (ArmSystem::haveEL(tc, EL2) &&
97 (!secure || HaveExt(tc, ArmExtension::FEAT_SEL2))) {
98 const HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
99 const HDCR mdcr = tc->readMiscRegNoEffect(MISCREG_MDCR_EL2);
100 route_to_el2 = (mdcr.tde == 1 || hcr.tge == 1);
101 } else {
102 route_to_el2 = false;
103 }
104 ExceptionLevel target;
105 if (route_to_el2) {
106 target = EL2;
107 } else if (ArmSystem::haveEL(tc, EL3) && !ArmSystem::highestELIs64(tc)
108 && secure) {
109 target = EL3;
110 } else {
111 target = EL1;
112 }
113 return target;
114}
115
116bool
118{
119 CPSR cpsr = tc->readMiscReg(MISCREG_CPSR);
120 return opModeIs64((OperatingMode) (uint8_t) cpsr.mode);
121}
122
125{
126 CPSR cpsr = tc->readMiscRegNoEffect(MISCREG_CPSR);
127 return opModeToEL((OperatingMode)(uint8_t)cpsr.mode);
128}
129
130bool
132{
133 TTBCR ttbcr = tc->readMiscReg(MISCREG_TTBCR);
134 return ArmSystem::has(ArmExtension::LPAE, tc) && ttbcr.eae;
135}
136
137RegVal
139{
140 const ExceptionLevel current_el = currEL(tc);
141
142 switch (current_el) {
143 case EL0:
144 // Note: in MsrMrs instruction we read the register value before
145 // checking access permissions. This means that EL0 entry must
146 // be part of the table even if MPIDR is not accessible in user
147 // mode.
148 warn_once("Trying to read MPIDR at EL0\n");
149 [[fallthrough]];
150 case EL1:
151 if (EL2Enabled(tc))
153 else
154 return getMPIDR(arm_sys, tc);
155 case EL2:
156 case EL3:
157 return getMPIDR(arm_sys, tc);
158 default:
159 panic("Invalid EL for reading MPIDR register\n");
160 }
161}
162
163RegVal
165{
166 // Multiprocessor Affinity Register MPIDR from Cortex(tm)-A15 Technical
167 // Reference Manual
168 //
169 // bit 31 - Multi-processor extensions available
170 // bit 30 - Uni-processor system
171 // bit 24 - Multi-threaded cores
172 // bit 11-8 - Cluster ID
173 // bit 1-0 - CPU ID
174 //
175 // We deliberately extend both the Cluster ID and CPU ID fields to allow
176 // for simulation of larger systems
177 assert((0 <= tc->cpuId()) && (tc->cpuId() < 256));
178 assert(tc->socketId() < 65536);
179
180 RegVal mpidr = 0x80000000;
181
182 if (!arm_sys->multiProc)
183 replaceBits(mpidr, 30, 1);
184
185 if (arm_sys->multiThread)
186 replaceBits(mpidr, 24, 1);
187
188 // Get Affinity numbers
189 mpidr |= getAffinity(arm_sys, tc);
190 return mpidr;
191}
192
193static RegVal
195{
196 return arm_sys->multiThread ? tc->socketId() : 0;
197}
198
199static RegVal
201{
202 return arm_sys->multiThread ? tc->cpuId() : tc->socketId();
203}
204
205static RegVal
207{
208 return arm_sys->multiThread ? tc->threadId() : tc->cpuId();
209}
210
211Affinity
213{
214 Affinity aff = 0;
215 aff.aff0 = getAff0(arm_sys, tc);
216 aff.aff1 = getAff1(arm_sys, tc);
217 aff.aff2 = getAff2(arm_sys, tc);
218 return aff;
219}
220
221bool
222HaveExt(ThreadContext* tc, ArmExtension ext)
223{
224 auto *isa = static_cast<ArmISA::ISA *>(tc->getIsaPtr());
225 return isa->getRelease()->has(ext);
226}
227
230{
231 if (el != EL0)
232 return el;
233 else if (ArmSystem::haveEL(tc, EL3) && ELIs32(tc, EL3) &&
234 static_cast<SCR>(
236 return EL3;
237 else if (HaveExt(tc, ArmExtension::FEAT_VHE) && ELIsInHost(tc, el))
238 return EL2;
239 else
240 return EL1;
241}
242
243bool
245{
246 if (ArmSystem::haveEL(tc, EL2) && HaveExt(tc, ArmExtension::FEAT_SEL2) &&
247 !ELIs32(tc, EL2)) {
248 if (ArmSystem::haveEL(tc, EL3))
249 return !ELIs32(tc, EL3) && static_cast<SCR>(
251 else
252 return isSecure(tc);
253 }
254 return false;
255}
256
257bool
259{
260 return ArmSystem::haveEL(tc, EL2) &&
261 (!ArmSystem::haveEL(tc, EL3) || static_cast<SCR>(
264}
265
266bool
268{
269 return !ELIs32(tc, el);
270}
271
272bool
274{
275 auto [known, aarch32] = ELUsingAArch32K(tc, el);
276 panic_if(!known, "EL state is UNKNOWN");
277 return aarch32;
278}
279
280bool
282{
283 const HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
284 return (ArmSystem::haveEL(tc, EL2) &&
285 (IsSecureEL2Enabled(tc) || !isSecureBelowEL3(tc)) &&
286 HaveExt(tc, ArmExtension::FEAT_VHE) &&
287 !ELIs32(tc, EL2) && hcr.e2h == 1 &&
288 (el == EL2 || (el == EL0 && hcr.tge == 1)));
289}
290
293{
294 bool secure = isSecureBelowEL3(tc);
295 return ELStateUsingAArch32K(tc, el, secure);
296}
297
298bool
300{
301 if (!ArmSystem::haveEL(tc, el))
302 return false;
303 else if (!ArmSystem::highestELIs64(tc))
304 return true;
305 else if (ArmSystem::highestEL(tc) == el)
306 return false;
307 else if (el == EL0)
308 return true;
309 return true;
310}
311
314{
315 // Return true if the specified EL is in aarch32 state.
316 const bool have_el3 = ArmSystem::haveEL(tc, EL3);
317 const bool have_el2 = ArmSystem::haveEL(tc, EL2);
318
319 panic_if(el == EL2 && !have_el2, "Asking for EL2 when it doesn't exist");
320 panic_if(el == EL3 && !have_el3, "Asking for EL3 when it doesn't exist");
321
322 bool known, aarch32;
323 known = aarch32 = false;
324 if (!haveAArch32EL(tc, el)) {
325 // Target EL is the highest one in a system where
326 // the highest is using AArch64.
327 known = true; aarch32 = false;
328 } else if (secure && el == EL2) {
329 known = true; aarch32 = false;
330 } else if (!ArmSystem::highestELIs64(tc)) {
331 // All ELs are using AArch32:
332 known = true; aarch32 = true;
333 } else if (ArmSystem::highestEL(tc) == el) {
334 known = true; aarch32 = false;
335 } else {
336 SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
337 bool aarch32_below_el3 = have_el3 && scr.rw == 0 &&
338 (!secure || !HaveExt(tc, ArmExtension::FEAT_SEL2) || !scr.eel2);
339
340 HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
341 bool sec_el2 = HaveExt(tc, ArmExtension::FEAT_SEL2) && scr.eel2;
342 bool aarch32_at_el1 = (aarch32_below_el3 ||
343 (have_el2 && (sec_el2 || !secure) &&
344 hcr.rw == 0 &&
345 !(hcr.e2h && hcr.tge &&
346 HaveExt(tc, ArmExtension::FEAT_VHE))));
347
348 // Only know if EL0 using AArch32 from PSTATE
349 if (el == EL0 && !aarch32_at_el1) {
350 // EL0 controlled by PSTATE
351 CPSR cpsr = tc->readMiscReg(MISCREG_CPSR);
352 known = (currEL(tc) == EL0);
353 aarch32 = (cpsr.width == 1);
354 } else {
355 known = true;
356 aarch32 = (aarch32_below_el3 && el != EL3) ||
357 (aarch32_at_el1 && (el == EL0 || el == EL1) );
358 }
359 }
360
361 return std::make_pair(known, aarch32);
362}
363
364bool
366{
367 auto [known, aarch32] = ELStateUsingAArch32K(tc, el, secure);
368 panic_if(!known, "EL state is UNKNOWN");
369 return aarch32;
370}
371
372bool
374{
375 switch (currEL(tc)) {
376 case EL3:
377 return ((SCTLR) tc->readMiscRegNoEffect(MISCREG_SCTLR_EL3)).ee;
378 case EL2:
379 return ((SCTLR) tc->readMiscRegNoEffect(MISCREG_SCTLR_EL2)).ee;
380 case EL1:
381 return ((SCTLR) tc->readMiscRegNoEffect(MISCREG_SCTLR_EL1)).ee;
382 case EL0:
383 return ((SCTLR) tc->readMiscRegNoEffect(MISCREG_SCTLR_EL1)).e0e;
384 default:
385 panic("Invalid exception level");
386 break;
387 }
388}
389
390bool
392{
394}
395
396bool
398{
400}
401
402int
403computeAddrTop(ThreadContext *tc, bool selbit, bool is_instr,
404 TCR tcr, ExceptionLevel el)
405{
406 bool tbi = false;
407 bool tbid = false;
409 if (ELIs32(tc, regime)) {
410 return 31;
411 } else {
412 switch (regime) {
413 case EL1:
414 {
415 //TCR tcr = tc->readMiscReg(MISCREG_TCR_EL1);
416 tbi = selbit? tcr.tbi1 : tcr.tbi0;
417 tbid = selbit? tcr.tbid1 : tcr.tbid0;
418 break;
419 }
420 case EL2:
421 {
422 TCR tcr = tc->readMiscReg(MISCREG_TCR_EL2);
423 if (HaveExt(tc, ArmExtension::FEAT_VHE) && ELIsInHost(tc, el)) {
424 tbi = selbit? tcr.tbi1 : tcr.tbi0;
425 tbid = selbit? tcr.tbid1 : tcr.tbid0;
426 } else {
427 tbi = tcr.tbi;
428 tbid = tcr.tbid;
429 }
430 break;
431 }
432 case EL3:
433 {
434 TCR tcr = tc->readMiscReg(MISCREG_TCR_EL3);
435 tbi = tcr.tbi;
436 tbid = tcr.tbid;
437 break;
438 }
439 default:
440 break;
441 }
442
443 }
444 int res = (tbi && (!tbid || !is_instr))? 55: 63;
445 return res;
446}
447
448Addr
450 int topbit)
451{
452 if (topbit == 63) {
453 return addr;
454 } else if (bits(addr,55) && (el <= EL1 || ELIsInHost(tc, el))) {
455 uint64_t mask = ((uint64_t)0x1 << topbit) -1;
456 addr = addr | ~mask;
457 } else {
458 addr = bits(addr, topbit, 0);
459 }
460 return addr; // Nothing to do if this is not a tagged address
461}
462
463Addr
465 TCR tcr, bool is_instr)
466{
467 bool selbit = bits(addr, 55);
468 int topbit = computeAddrTop(tc, selbit, is_instr, tcr, el);
469
470 return maskTaggedAddr(addr, tc, el, topbit);
471}
472
473Addr
475 bool is_instr)
476{
477
478 TCR tcr = tc->readMiscReg(MISCREG_TCR_EL1);
479 return purifyTaggedAddr(addr, tc, el, tcr, is_instr);
480}
481
482Addr
484{
485 return addr & ~(PageBytes - 1);
486}
487
488Addr
490{
491 return (addr + PageBytes - 1) & ~(PageBytes - 1);
492}
493
494Fault
495mcrMrc15Trap(const MiscRegIndex misc_reg, ExtMachInst mach_inst,
496 ThreadContext *tc, uint32_t imm)
497{
499 if (mcrMrc15TrapToHyp(misc_reg, tc, imm, &ec))
500 return std::make_shared<HypervisorTrap>(mach_inst, imm, ec);
501 return AArch64AArch32SystemAccessTrap(misc_reg, mach_inst, tc, imm, ec);
502}
503
504bool
505mcrMrc15TrapToHyp(const MiscRegIndex misc_reg, ThreadContext *tc, uint32_t iss,
507{
508 bool is_read;
509 uint32_t crm;
510 RegIndex rt;
511 uint32_t crn;
512 uint32_t opc1;
513 uint32_t opc2;
514 bool trap_to_hyp = false;
515
516 const HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
517 const HDCR hdcr = tc->readMiscReg(MISCREG_HDCR);
518 const HSTR hstr = tc->readMiscReg(MISCREG_HSTR);
519 const HCPTR hcptr = tc->readMiscReg(MISCREG_HCPTR);
520
521 if (EL2Enabled(tc) && (currEL(tc) < EL2)) {
522 mcrMrcIssExtract(iss, is_read, crm, rt, crn, opc1, opc2);
523 trap_to_hyp = ((uint32_t) hstr) & (1 << crn);
524 trap_to_hyp |= hdcr.tpm && (crn == 9) && (crm >= 12);
525 trap_to_hyp |= hcr.tidcp && (
526 ((crn == 9) && ((crm <= 2) || ((crm >= 5) && (crm <= 8)))) ||
527 ((crn == 10) && ((crm <= 1) || (crm == 4) || (crm == 8))) ||
528 ((crn == 11) && ((crm <= 8) || (crm == 15))));
529
530 if (!trap_to_hyp) {
531 switch (unflattenMiscReg(misc_reg)) {
532 case MISCREG_CPACR:
533 trap_to_hyp = hcptr.tcpac;
534 break;
535 case MISCREG_REVIDR:
536 case MISCREG_TCMTR:
537 case MISCREG_TLBTR:
538 case MISCREG_AIDR:
539 trap_to_hyp = hcr.tid1;
540 break;
541 case MISCREG_CTR:
542 case MISCREG_CCSIDR:
543 case MISCREG_CLIDR:
544 case MISCREG_CSSELR:
545 trap_to_hyp = hcr.tid2;
546 break;
547 case MISCREG_ID_PFR0:
548 case MISCREG_ID_PFR1:
549 case MISCREG_ID_DFR0:
550 case MISCREG_ID_AFR0:
551 case MISCREG_ID_MMFR0:
552 case MISCREG_ID_MMFR1:
553 case MISCREG_ID_MMFR2:
554 case MISCREG_ID_MMFR3:
555 case MISCREG_ID_MMFR4:
556 case MISCREG_ID_ISAR0:
557 case MISCREG_ID_ISAR1:
558 case MISCREG_ID_ISAR2:
559 case MISCREG_ID_ISAR3:
560 case MISCREG_ID_ISAR4:
561 case MISCREG_ID_ISAR5:
562 case MISCREG_ID_ISAR6:
563 trap_to_hyp = hcr.tid3;
564 break;
565 case MISCREG_DCISW:
566 case MISCREG_DCCSW:
567 case MISCREG_DCCISW:
568 trap_to_hyp = hcr.tsw;
569 break;
570 case MISCREG_DCIMVAC:
571 case MISCREG_DCCIMVAC:
572 case MISCREG_DCCMVAC:
573 trap_to_hyp = hcr.tpc;
574 break;
575 case MISCREG_ICIMVAU:
576 case MISCREG_ICIALLU:
578 case MISCREG_DCCMVAU:
579 trap_to_hyp = hcr.tpu;
580 break;
587 case MISCREG_DTLBIALL:
588 case MISCREG_ITLBIALL:
589 case MISCREG_DTLBIMVA:
590 case MISCREG_ITLBIMVA:
593 case MISCREG_TLBIMVAA:
594 case MISCREG_TLBIALL:
595 case MISCREG_TLBIMVA:
596 case MISCREG_TLBIMVAL:
598 case MISCREG_TLBIASID:
599 trap_to_hyp = hcr.ttlb;
600 break;
601 case MISCREG_ACTLR:
602 trap_to_hyp = hcr.tac;
603 break;
604 case MISCREG_SCTLR:
605 case MISCREG_TTBR0:
606 case MISCREG_TTBR1:
607 case MISCREG_TTBCR:
608 case MISCREG_DACR:
609 case MISCREG_DFSR:
610 case MISCREG_IFSR:
611 case MISCREG_DFAR:
612 case MISCREG_IFAR:
613 case MISCREG_ADFSR:
614 case MISCREG_AIFSR:
615 case MISCREG_PRRR:
616 case MISCREG_NMRR:
617 case MISCREG_MAIR0:
618 case MISCREG_MAIR1:
620 trap_to_hyp = hcr.tvm & !is_read;
621 break;
622 case MISCREG_PMCR:
623 trap_to_hyp = hdcr.tpmcr;
624 break;
625 // GICv3 regs
627 trap_to_hyp = hcr.fmo;
628 break;
631 trap_to_hyp = hcr.imo;
632 break;
634 // CNTFRQ may be trapped only on reads
635 // CNTPCT and CNTVCT are read-only
636 if (MISCREG_CNTFRQ <= misc_reg && misc_reg <= MISCREG_CNTVCT &&
637 !is_read)
638 break;
639 trap_to_hyp = isGenericTimerHypTrap(misc_reg, tc, ec);
640 break;
641 // No default action needed
642 default:
643 break;
644 }
645 }
646 }
647 return trap_to_hyp;
648}
649
650
651bool
652mcrMrc14TrapToHyp(const MiscRegIndex misc_reg, ThreadContext *tc, uint32_t iss)
653{
654 bool is_read;
655 uint32_t crm;
656 RegIndex rt;
657 uint32_t crn;
658 uint32_t opc1;
659 uint32_t opc2;
660
661 const HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
662 const HDCR hdcr = tc->readMiscReg(MISCREG_HDCR);
663 const HSTR hstr = tc->readMiscReg(MISCREG_HSTR);
664 const HCPTR hcptr = tc->readMiscReg(MISCREG_HCPTR);
665
666 bool trap_to_hyp = false;
667
668 if (EL2Enabled(tc) && (currEL(tc) < EL2)) {
669 mcrMrcIssExtract(iss, is_read, crm, rt, crn, opc1, opc2);
670 inform("trap check M:%x N:%x 1:%x 2:%x hdcr %x, hcptr %x, hstr %x\n",
671 crm, crn, opc1, opc2, hdcr, hcptr, hstr);
672 trap_to_hyp = hdcr.tda && (opc1 == 0);
673 trap_to_hyp |= hcptr.tta && (opc1 == 1);
674 if (!trap_to_hyp) {
675 switch (unflattenMiscReg(misc_reg)) {
676 case MISCREG_DBGOSLSR:
677 case MISCREG_DBGOSLAR:
678 case MISCREG_DBGOSDLR:
679 case MISCREG_DBGPRCR:
680 trap_to_hyp = hdcr.tdosa;
681 break;
682 case MISCREG_DBGDRAR:
683 case MISCREG_DBGDSAR:
684 trap_to_hyp = hdcr.tdra;
685 break;
686 case MISCREG_JIDR:
687 trap_to_hyp = hcr.tid0;
688 break;
689 case MISCREG_JOSCR:
690 case MISCREG_JMCR:
691 trap_to_hyp = hstr.tjdbx;
692 break;
693 case MISCREG_TEECR:
694 case MISCREG_TEEHBR:
695 trap_to_hyp = hstr.ttee;
696 break;
697 // No default action needed
698 default:
699 break;
700 }
701 }
702 }
703 return trap_to_hyp;
704}
705
706Fault
707mcrrMrrc15Trap(const MiscRegIndex misc_reg, ExtMachInst mach_inst,
708 ThreadContext *tc, uint32_t imm)
709{
711 if (mcrrMrrc15TrapToHyp(misc_reg, tc, imm, &ec))
712 return std::make_shared<HypervisorTrap>(mach_inst, imm, ec);
713 return AArch64AArch32SystemAccessTrap(misc_reg, mach_inst, tc, imm, ec);
714}
715
716bool
718 uint32_t iss, ExceptionClass *ec)
719{
720 uint32_t crm;
721 RegIndex rt;
722 uint32_t crn;
723 uint32_t opc1;
724 uint32_t opc2;
725 bool is_read;
726 bool trap_to_hyp = false;
727
728 const HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
729 const HSTR hstr = tc->readMiscReg(MISCREG_HSTR);
730
731 if (EL2Enabled(tc) && (currEL(tc) < EL2)) {
732 // This is technically the wrong function, but we can re-use it for
733 // the moment because we only need one field, which overlaps with the
734 // mcrmrc layout
735 mcrMrcIssExtract(iss, is_read, crm, rt, crn, opc1, opc2);
736 trap_to_hyp = ((uint32_t)hstr) & (1 << crm);
737
738 if (!trap_to_hyp) {
739 switch (unflattenMiscReg(misc_reg)) {
740 case MISCREG_SCTLR:
741 case MISCREG_TTBR0:
742 case MISCREG_TTBR1:
743 case MISCREG_TTBCR:
744 case MISCREG_DACR:
745 case MISCREG_DFSR:
746 case MISCREG_IFSR:
747 case MISCREG_DFAR:
748 case MISCREG_IFAR:
749 case MISCREG_ADFSR:
750 case MISCREG_AIFSR:
751 case MISCREG_PRRR:
752 case MISCREG_NMRR:
753 case MISCREG_MAIR0:
754 case MISCREG_MAIR1:
756 trap_to_hyp = hcr.tvm & !is_read;
757 break;
759 // CNTFRQ may be trapped only on reads
760 // CNTPCT and CNTVCT are read-only
761 if (MISCREG_CNTFRQ <= misc_reg && misc_reg <= MISCREG_CNTVCT &&
762 !is_read) {
763 break;
764 }
765 trap_to_hyp = isGenericTimerHypTrap(misc_reg, tc, ec);
766 break;
767 // No default action needed
768 default:
769 break;
770 }
771 }
772 }
773 return trap_to_hyp;
774}
775
776Fault
778 ExtMachInst mach_inst, ThreadContext *tc,
779 uint32_t imm, ExceptionClass ec)
780{
781 if (currEL(tc) <= EL1 && !ELIs32(tc, EL1) &&
783 return std::make_shared<SupervisorTrap>(mach_inst, imm, ec);
784 if (currEL(tc) <= EL2 && EL2Enabled(tc) && !ELIs32(tc, EL2) &&
786 return std::make_shared<HypervisorTrap>(mach_inst, imm, ec);
787 return NoFault;
788}
789
790bool
792 ThreadContext *tc)
793{
794 switch (misc_reg) {
796 return currEL(tc) == EL0 &&
798 default:
799 break;
800 }
801 return false;
802}
803
804bool
807{
808 if (currEL(tc) <= EL2 && EL2Enabled(tc) && ELIs32(tc, EL2)) {
809 switch (misc_reg) {
811 if (currEL(tc) == EL0 &&
812 isGenericTimerCommonEL0HypTrap(misc_reg, tc, ec))
813 return true;
814 switch (misc_reg) {
815 case MISCREG_CNTPCT:
817 return currEL(tc) <= EL1 &&
818 isGenericTimerPhysHypTrap(misc_reg, tc, ec);
819 default:
820 break;
821 }
822 break;
823 default:
824 break;
825 }
826 }
827 return false;
828}
829
830bool
833{
834 const HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
835 bool trap_cond = condGenericTimerSystemAccessTrapEL1(misc_reg, tc);
836 if (ELIs32(tc, EL1) && trap_cond && hcr.tge) {
837 // As per the architecture, this hyp trap should have uncategorized
838 // exception class
839 if (ec)
841 return true;
842 }
843 return false;
844}
845
846bool
849{
850 return condGenericTimerPhysHypTrap(misc_reg, tc);
851}
852
853bool
855{
856 const CNTHCTL cnthctl = tc->readMiscReg(MISCREG_CNTHCTL_EL2);
857 switch (misc_reg) {
858 case MISCREG_CNTPCT:
859 return !cnthctl.el1pcten;
861 return !cnthctl.el1pcen;
862 default:
863 break;
864 }
865 return false;
866}
867
868bool
870 ThreadContext *tc)
871{
872 switch (misc_reg) {
875 {
876 const HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
877 bool trap_cond = condGenericTimerSystemAccessTrapEL1(misc_reg, tc);
878 return !(EL2Enabled(tc) && hcr.e2h && hcr.tge) && trap_cond &&
879 !(EL2Enabled(tc) && !ELIs32(tc, EL2) && hcr.tge);
880 }
881 default:
882 break;
883 }
884 return false;
885}
886
887bool
889 ThreadContext *tc)
890{
891 const CNTKCTL cntkctl = tc->readMiscReg(MISCREG_CNTKCTL_EL1);
892 switch (misc_reg) {
893 case MISCREG_CNTFRQ:
895 return !cntkctl.el0pcten && !cntkctl.el0vcten;
896 case MISCREG_CNTPCT:
898 return !cntkctl.el0pcten;
899 case MISCREG_CNTVCT:
901 return !cntkctl.el0vcten;
904 return !cntkctl.el0pten;
907 return !cntkctl.el0vten;
908 default:
909 break;
910 }
911 return false;
912}
913
914bool
916 ThreadContext *tc)
917{
918 switch (misc_reg) {
920 return currEL(tc) <= EL1 &&
922 default:
923 break;
924 }
925 return false;
926}
927
928bool
930 ThreadContext *tc)
931{
932 switch (misc_reg) {
935 if (currEL(tc) == EL0 &&
937 return true;
938 switch (misc_reg) {
939 case MISCREG_CNTPCT:
943 return (currEL(tc) == EL0 &&
945 (currEL(tc) == EL1 &&
947 case MISCREG_CNTVCT:
951 return isGenericTimerVirtSystemAccessTrapEL2(misc_reg, tc);
952 default:
953 break;
954 }
955 break;
956 default:
957 break;
958 }
959 return false;
960}
961
962bool
964 ThreadContext *tc)
965{
966 const HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
967 bool trap_cond_el1 = condGenericTimerSystemAccessTrapEL1(misc_reg, tc);
968 bool trap_cond_el2 = condGenericTimerCommonEL0SystemAccessTrapEL2(misc_reg,
969 tc);
970 return (!ELIs32(tc, EL1) && !hcr.e2h && trap_cond_el1 && hcr.tge) ||
971 (ELIs32(tc, EL1) && trap_cond_el1 && hcr.tge) ||
972 (hcr.e2h && hcr.tge && trap_cond_el2);
973}
974
975bool
977 ThreadContext *tc)
978{
979 const HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
981 misc_reg, tc);
983 misc_reg, tc);
984
985 switch (misc_reg) {
986 case MISCREG_CNTPCT:
988 return !hcr.e2h && trap_cond_1;
991 return (!hcr.e2h && trap_cond_0) ||
992 (hcr.e2h && !hcr.tge && trap_cond_1);
993 default:
994 break;
995 }
996
997 return false;
998}
999
1000bool
1002 ThreadContext *tc)
1003{
1004 const HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
1006 misc_reg, tc);
1008 misc_reg, tc);
1009
1010 switch (misc_reg) {
1011 case MISCREG_CNTPCT:
1012 case MISCREG_CNTPCT_EL0:
1013 return trap_cond_1;
1016 return (!hcr.e2h && trap_cond_0) ||
1017 (hcr.e2h && trap_cond_1);
1018 default:
1019 break;
1020 }
1021 return false;
1022}
1023
1024bool
1026 ThreadContext *tc)
1027{
1028 const HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
1030 misc_reg, tc);
1031 return !ELIs32(tc, EL1) && !(hcr.e2h && hcr.tge) && trap_cond;
1032}
1033
1034bool
1036 ThreadContext *tc)
1037{
1038 const CNTHCTL_E2H cnthctl = tc->readMiscReg(MISCREG_CNTHCTL_EL2);
1039 switch (misc_reg) {
1040 case MISCREG_CNTFRQ:
1041 case MISCREG_CNTFRQ_EL0:
1042 return !cnthctl.el0pcten && !cnthctl.el0vcten;
1043 case MISCREG_CNTPCT:
1044 case MISCREG_CNTPCT_EL0:
1045 return !cnthctl.el0pcten;
1046 case MISCREG_CNTVCT:
1047 case MISCREG_CNTVCT_EL0:
1048 return !cnthctl.el0vcten;
1051 return !cnthctl.el0pten;
1054 return !cnthctl.el0vten;
1055 default:
1056 break;
1057 }
1058 return false;
1059}
1060
1061bool
1063 ThreadContext *tc)
1064{
1065 const AA64MMFR0 mmfr0 = tc->readMiscRegNoEffect(MISCREG_ID_AA64MMFR0_EL1);
1066 const HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
1067 const RegVal cnthctl_val = tc->readMiscReg(MISCREG_CNTHCTL_EL2);
1068 const CNTHCTL cnthctl = cnthctl_val;
1069 const CNTHCTL_E2H cnthctl_e2h = cnthctl_val;
1070 switch (misc_reg) {
1071 case MISCREG_CNTPCT:
1072 case MISCREG_CNTPCT_EL0:
1073 return hcr.e2h ? !cnthctl_e2h.el1pcten : !cnthctl.el1pcten;
1074 case MISCREG_CNTVCT:
1075 case MISCREG_CNTVCT_EL0:
1076 if (!mmfr0.ecv)
1077 return false;
1078 else
1079 return hcr.e2h ? cnthctl_e2h.el1tvct : cnthctl.el1tvct;
1082 return hcr.e2h ? !cnthctl_e2h.el1pten : false;
1085 if (!mmfr0.ecv)
1086 return false;
1087 else
1088 return hcr.e2h ? cnthctl_e2h.el1tvt : cnthctl.el1tvt;
1089 default:
1090 break;
1091 }
1092 return false;
1093}
1094
1095bool
1097 ThreadContext *tc)
1098{
1099 const CNTHCTL cnthctl = tc->readMiscReg(MISCREG_CNTHCTL_EL2);
1100 return !cnthctl.el1pcen;
1101}
1102
1103bool
1105 ThreadContext *tc)
1106{
1107 switch (misc_reg) {
1109 {
1110 const SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
1111 return currEL(tc) == EL1 && !scr.ns && !scr.st;
1112 }
1113 default:
1114 break;
1115 }
1116 return false;
1117}
1118
1119bool
1120decodeMrsMsrBankedReg(uint8_t sysM, bool r, bool &isIntReg, int &regIdx,
1121 CPSR cpsr, SCR scr, NSACR nsacr, bool checkSecurity)
1122{
1124 bool ok = true;
1125
1126 // R mostly indicates if its a int register or a misc reg, we override
1127 // below if the few corner cases
1128 isIntReg = !r;
1129 // Loosely based on ARM ARM issue C section B9.3.10
1130 if (r) {
1131 switch (sysM) {
1132 case 0xE:
1133 regIdx = MISCREG_SPSR_FIQ;
1134 mode = MODE_FIQ;
1135 break;
1136 case 0x10:
1137 regIdx = MISCREG_SPSR_IRQ;
1138 mode = MODE_IRQ;
1139 break;
1140 case 0x12:
1141 regIdx = MISCREG_SPSR_SVC;
1142 mode = MODE_SVC;
1143 break;
1144 case 0x14:
1145 regIdx = MISCREG_SPSR_ABT;
1146 mode = MODE_ABORT;
1147 break;
1148 case 0x16:
1149 regIdx = MISCREG_SPSR_UND;
1151 break;
1152 case 0x1C:
1153 regIdx = MISCREG_SPSR_MON;
1154 mode = MODE_MON;
1155 break;
1156 case 0x1E:
1157 regIdx = MISCREG_SPSR_HYP;
1158 mode = MODE_HYP;
1159 break;
1160 default:
1161 ok = false;
1162 break;
1163 }
1164 } else {
1165 int sysM4To3 = bits(sysM, 4, 3);
1166
1167 if (sysM4To3 == 0) {
1168 mode = MODE_USER;
1169 regIdx = int_reg::regInMode(mode, bits(sysM, 2, 0) + 8);
1170 } else if (sysM4To3 == 1) {
1171 mode = MODE_FIQ;
1172 regIdx = int_reg::regInMode(mode, bits(sysM, 2, 0) + 8);
1173 } else if (sysM4To3 == 3) {
1174 if (bits(sysM, 1) == 0) {
1175 mode = MODE_MON;
1176 regIdx = int_reg::regInMode(mode, 14 - bits(sysM, 0));
1177 } else {
1178 mode = MODE_HYP;
1179 if (bits(sysM, 0) == 1) {
1180 regIdx = int_reg::regInMode(mode, 13); // R13 in HYP
1181 } else {
1182 isIntReg = false;
1183 regIdx = MISCREG_ELR_HYP;
1184 }
1185 }
1186 } else { // Other Banked registers
1187 int sysM2 = bits(sysM, 2);
1188 int sysM1 = bits(sysM, 1);
1189
1190 mode = (OperatingMode)(((sysM2 || sysM1) << 0) |
1191 (1 << 1) |
1192 ((sysM2 && !sysM1) << 2) |
1193 ((sysM2 && sysM1) << 3) |
1194 (1 << 4));
1195 regIdx = int_reg::regInMode(mode, 14 - bits(sysM, 0));
1196 // Don't flatten the register here. This is going to go through
1197 // setReg() which will do the flattening
1198 ok &= mode != cpsr.mode;
1199 }
1200 }
1201
1202 // Check that the requested register is accessable from the current mode
1203 if (ok && checkSecurity && mode != cpsr.mode) {
1204 switch (cpsr.mode) {
1205 case MODE_USER:
1206 ok = false;
1207 break;
1208 case MODE_FIQ:
1209 ok &= mode != MODE_HYP;
1210 ok &= (mode != MODE_MON) || !scr.ns;
1211 break;
1212 case MODE_HYP:
1213 ok &= mode != MODE_MON;
1214 ok &= (mode != MODE_FIQ) || !nsacr.rfr;
1215 break;
1216 case MODE_IRQ:
1217 case MODE_SVC:
1218 case MODE_ABORT:
1219 case MODE_UNDEFINED:
1220 case MODE_SYSTEM:
1221 ok &= mode != MODE_HYP;
1222 ok &= (mode != MODE_MON) || !scr.ns;
1223 ok &= (mode != MODE_FIQ) || !nsacr.rfr;
1224 break;
1225 // can access everything, no further checks required
1226 case MODE_MON:
1227 break;
1228 default:
1229 panic("unknown Mode 0x%x\n", cpsr.mode);
1230 break;
1231 }
1232 }
1233 return ok;
1234}
1235
1236bool
1238{
1239 const HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
1240 const CPSR cpsr = tc->readMiscReg(MISCREG_CPSR);
1241
1242 // NV Extension not implemented yet
1243 bool have_nv_ext = false;
1244 bool unpriv_el1 = currEL(tc) == EL1 &&
1245 !(ArmSystem::haveEL(tc, EL2) &&
1246 have_nv_ext && hcr.nv == 1 && hcr.nv1 == 1);
1247 bool unpriv_el2 = ArmSystem::haveEL(tc, EL2) &&
1248 HaveExt(tc, ArmExtension::FEAT_VHE) &&
1249 currEL(tc) == EL2 && hcr.e2h == 1 && hcr.tge == 1;
1250
1251 return (unpriv_el1 || unpriv_el2) && !cpsr.uao;
1252}
1253
1254bool
1256{
1257 ExceptionLevel regime = s1TranslationRegime(tc, currEL(tc));
1258
1259 switch (currEL(tc)) {
1260 case EL3:
1261 return ((SCTLR)tc->readMiscReg(MISCREG_SCTLR_EL3)).sa;
1262 case EL2:
1263 return ((SCTLR)tc->readMiscReg(MISCREG_SCTLR_EL2)).sa;
1264 case EL1:
1265 return ((SCTLR)tc->readMiscReg(MISCREG_SCTLR_EL1)).sa;
1266 case EL0:
1267 {
1268 SCTLR sc = (regime == EL2) ? tc->readMiscReg(MISCREG_SCTLR_EL2):
1270 return sc.sa0;
1271 }
1272 default:
1273 panic("Invalid exception level");
1274 break;
1275 }
1276}
1277
1278int
1280{
1281 switch (pa_enc) {
1282 case 0x0:
1283 return 32;
1284 case 0x1:
1285 return 36;
1286 case 0x2:
1287 return 40;
1288 case 0x3:
1289 return 42;
1290 case 0x4:
1291 return 44;
1292 case 0x5:
1293 return 48;
1294 case 0x6:
1295 return 52;
1296 default:
1297 panic("Invalid phys. address range encoding");
1298 }
1299}
1300
1301uint8_t
1303{
1304 switch (pa_size) {
1305 case 32:
1306 return 0x0;
1307 case 36:
1308 return 0x1;
1309 case 40:
1310 return 0x2;
1311 case 42:
1312 return 0x3;
1313 case 44:
1314 return 0x4;
1315 case 48:
1316 return 0x5;
1317 case 52:
1318 return 0x6;
1319 default:
1320 panic("Invalid phys. address range");
1321 }
1322}
1323
1324void
1326{
1327 int ei = 0;
1328 for (int ri = 0; ri < NumVecRegs; ri++) {
1330 tc->getReg(vecRegClass[ri], &reg);
1331 for (int j = 0; j < NumVecElemPerVecReg; j++, ei++)
1332 tc->setReg(vecElemClass[ei], reg.as<VecElem>()[j]);
1333 }
1334}
1335
1336void
1338{
1339 int ei = 0;
1340 for (int ri = 0; ri < NumVecRegs; ri++) {
1342 for (int j = 0; j < NumVecElemPerVecReg; j++, ei++) {
1343 RegId elem_id = vecElemClass[ei];
1344 reg.as<VecElem>()[j] = tc->getReg(elem_id);
1345 }
1346 tc->setReg(vecRegClass[ri], &reg);
1347 }
1348}
1349
1350} // namespace ArmISA
1351} // namespace gem5
const ArmRelease * getRelease() const
Definition isa.hh:192
bool has(ArmExtension ext) const
Definition system.hh:76
bool highestELIs64() const
Returns true if the register width of the highest implemented exception level is 64 bits (ARMv8)
Definition system.hh:187
ArmISA::ExceptionLevel highestEL() const
Returns the highest implemented exception level.
Definition system.hh:191
bool has(ArmExtension ext) const
Definition system.hh:158
static bool haveEL(ThreadContext *tc, ArmISA::ExceptionLevel el)
Return true if the system implements a specific exception level.
Definition system.cc:132
bool multiProc
true if this a multiprocessor system
Definition system.hh:154
void postInterrupt(ThreadID tid, int int_num, int index)
Definition base.cc:231
Register ID: describe an architectural register with its class and index.
Definition reg_class.hh:93
const bool multiThread
Definition system.hh:312
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual RegVal readMiscReg(RegIndex misc_reg)=0
virtual RegVal getReg(const RegId &reg) const
virtual uint32_t socketId() const =0
virtual BaseISA * getIsaPtr() const =0
virtual BaseCPU * getCpuPtr()=0
virtual void setReg(const RegId &reg, RegVal val)
virtual int threadId() const =0
virtual RegVal readMiscRegNoEffect(RegIndex misc_reg) const =0
virtual int cpuId() const =0
Vector Register Abstraction This generic class is the model in a particularization of MVC,...
Definition vec_reg.hh:124
STL pair class.
Definition stl.hh:58
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:76
constexpr void replaceBits(T &val, unsigned first, unsigned last, B bit_val)
A convenience function to replace bits first to last of val with bit_val in place.
Definition bitfield.hh:213
#define panic(...)
This implements a cprintf based panic() function.
Definition logging.hh:188
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Definition logging.hh:214
#define warn_once(...)
Definition logging.hh:260
#define inform(...)
Definition logging.hh:257
static int regInMode(OperatingMode mode, int reg)
Definition int.hh:566
bool badMode(ThreadContext *tc, OperatingMode mode)
badMode is checking if the execution mode provided as an argument is valid and implemented.
Definition utility.cc:397
bool ELIs32(ThreadContext *tc, ExceptionLevel el)
Definition utility.cc:273
static void mcrMrcIssExtract(uint32_t iss, bool &isRead, uint32_t &crm, RegIndex &rt, uint32_t &crn, uint32_t &opc1, uint32_t &opc2)
Definition utility.hh:246
@ MODE_UNDEFINED
Definition types.hh:295
bool isAArch64AArch32SystemAccessTrapEL2(const MiscRegIndex misc_reg, ThreadContext *tc)
Definition utility.cc:915
bool isGenericTimerVirtSystemAccessTrapEL2(const MiscRegIndex misc_reg, ThreadContext *tc)
Definition utility.cc:1025
uint8_t encodePhysAddrRange64(int pa_size)
Returns the encoding corresponding to the specified n.
Definition utility.cc:1302
Fault mcrrMrrc15Trap(const MiscRegIndex misc_reg, ExtMachInst mach_inst, ThreadContext *tc, uint32_t imm)
Definition utility.cc:707
void syncVecRegsToElems(ThreadContext *tc)
Definition utility.cc:1325
Bitfield< 15, 12 > rt
Definition types.hh:115
Fault AArch64AArch32SystemAccessTrap(const MiscRegIndex misc_reg, ExtMachInst mach_inst, ThreadContext *tc, uint32_t imm, ExceptionClass ec)
Definition utility.cc:777
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:281
Bitfield< 3, 0 > mask
Definition pcstate.hh:63
bool isGenericTimerSystemAccessTrapEL3(const MiscRegIndex misc_reg, ThreadContext *tc)
Definition utility.cc:1104
ExceptionLevel debugTargetFrom(ThreadContext *tc, bool secure)
Definition utility.cc:93
Bitfield< 4, 0 > mode
Definition misc_types.hh:74
ExceptionLevel currEL(const ThreadContext *tc)
Returns the current Exception Level (EL) of the provided ThreadContext.
Definition utility.cc:124
bool SPAlignmentCheckEnabled(ThreadContext *tc)
Definition utility.cc:1255
bool isSecure(ThreadContext *tc)
Definition utility.cc:74
bool haveAArch32EL(ThreadContext *tc, ExceptionLevel el)
Definition utility.cc:299
Affinity getAffinity(ArmSystem *arm_sys, ThreadContext *tc)
Retrieves MPIDR_EL1.
Definition utility.cc:212
Fault mcrMrc15Trap(const MiscRegIndex misc_reg, ExtMachInst mach_inst, ThreadContext *tc, uint32_t imm)
Definition utility.cc:495
Bitfield< 7, 0 > imm
Definition types.hh:132
ExceptionLevel s1TranslationRegime(ThreadContext *tc, ExceptionLevel el)
Definition utility.cc:229
Addr maskTaggedAddr(Addr addr, ThreadContext *tc, ExceptionLevel el, int topbit)
Definition utility.cc:449
bool longDescFormatInUse(ThreadContext *tc)
Definition utility.cc:131
Addr roundPage(Addr addr)
Definition utility.cc:489
static bool unknownMode32(OperatingMode mode)
Definition types.hh:446
bool isGenericTimerPhysEL1SystemAccessTrapEL2(const MiscRegIndex misc_reg, ThreadContext *tc)
Definition utility.cc:1001
bool isAArch64AArch32SystemAccessTrapEL1(const MiscRegIndex misc_reg, ThreadContext *tc)
Definition utility.cc:791
static bool unknownMode(OperatingMode mode)
Definition types.hh:420
bool isBigEndian64(const ThreadContext *tc)
Definition utility.cc:373
bool isGenericTimerSystemAccessTrapEL2(const MiscRegIndex misc_reg, ThreadContext *tc)
Definition utility.cc:929
bool ELStateUsingAArch32(ThreadContext *tc, ExceptionLevel el, bool secure)
Definition utility.cc:365
void sendEvent(ThreadContext *tc)
Send an event (SEV) to a specific PE if there isn't already a pending event.
Definition utility.cc:65
bool isGenericTimerCommonEL0HypTrap(const MiscRegIndex misc_reg, ThreadContext *tc, ExceptionClass *ec)
Definition utility.cc:831
constexpr unsigned NumVecElemPerVecReg
Definition vec.hh:61
bool isGenericTimerPhysHypTrap(const MiscRegIndex misc_reg, ThreadContext *tc, ExceptionClass *ec)
Definition utility.cc:847
constexpr RegClass vecElemClass
Definition vec.hh:105
Bitfield< 7, 5 > opc2
Definition types.hh:106
bool isGenericTimerCommonEL0SystemAccessTrapEL2(const MiscRegIndex misc_reg, ThreadContext *tc)
Definition utility.cc:963
bool ELIs64(ThreadContext *tc, ExceptionLevel el)
Definition utility.cc:267
static RegVal getAff1(ArmSystem *arm_sys, ThreadContext *tc)
Definition utility.cc:200
bool isGenericTimerSystemAccessTrapEL1(const MiscRegIndex misc_reg, ThreadContext *tc)
Definition utility.cc:869
bool condGenericTimerCommonEL0SystemAccessTrapEL2(const MiscRegIndex misc_reg, ThreadContext *tc)
Definition utility.cc:1035
bool isGenericTimerHypTrap(const MiscRegIndex misc_reg, ThreadContext *tc, ExceptionClass *ec)
Definition utility.cc:805
bool mcrMrc15TrapToHyp(const MiscRegIndex misc_reg, ThreadContext *tc, uint32_t iss, ExceptionClass *ec)
Definition utility.cc:505
static RegVal getAff2(ArmSystem *arm_sys, ThreadContext *tc)
Definition utility.cc:194
bool isSecureBelowEL3(ThreadContext *tc)
Definition utility.cc:86
Bitfield< 0 > ns
bool isUnpriviledgeAccess(ThreadContext *tc)
Definition utility.cc:1237
bool EL2Enabled(ThreadContext *tc)
Definition utility.cc:258
std::pair< bool, bool > ELUsingAArch32K(ThreadContext *tc, ExceptionLevel el)
This function checks whether selected EL provided as an argument is using the AArch32 ISA.
Definition utility.cc:292
Bitfield< 18 > eel2
bool IsSecureEL2Enabled(ThreadContext *tc)
Definition utility.cc:244
Bitfield< 29 > tbid
int computeAddrTop(ThreadContext *tc, bool selbit, bool is_instr, TCR tcr, ExceptionLevel el)
Definition utility.cc:403
Bitfield< 24, 0 > iss
Bitfield< 20 > tbi
const int NumVecRegs
Definition vec.hh:83
bool mcrMrc14TrapToHyp(const MiscRegIndex misc_reg, ThreadContext *tc, uint32_t iss)
Definition utility.cc:652
bool badMode32(ThreadContext *tc, OperatingMode mode)
badMode is checking if the execution mode provided as an argument is valid and implemented for AArch3...
Definition utility.cc:391
bool decodeMrsMsrBankedReg(uint8_t sysM, bool r, bool &isIntReg, int &regIdx, CPSR cpsr, SCR scr, NSACR nsacr, bool checkSecurity)
Definition utility.cc:1120
@ MISCREG_DBGDRAR
Definition misc.hh:175
@ MISCREG_DBGOSLSR
Definition misc.hh:193
@ MISCREG_DCCISW
Definition misc.hh:323
@ MISCREG_CNTV_CTL_EL0
Definition misc.hh:781
@ MISCREG_SCTLR_EL2
Definition misc.hh:589
@ MISCREG_CNTP_CTL_EL0
Definition misc.hh:778
@ MISCREG_TLBIMVALIS
Definition misc.hh:330
@ MISCREG_TCR_EL2
Definition misc.hh:610
@ MISCREG_TLBIMVAALIS
Definition misc.hh:331
@ MISCREG_SPSR_HYP
Definition misc.hh:73
@ MISCREG_CNTFRQ
Definition misc.hh:418
@ MISCREG_DBGDSAR
Definition misc.hh:196
@ MISCREG_TLBIMVAAL
Definition misc.hh:343
@ MISCREG_CNTV_TVAL
Definition misc.hh:432
@ MISCREG_CNTPS_TVAL_EL1
Definition misc.hh:794
@ MISCREG_HCPTR
Definition misc.hh:256
@ MISCREG_IFAR
Definition misc.hh:291
@ MISCREG_ID_MMFR1
Definition misc.hh:221
@ MISCREG_SCTLR
Definition misc.hh:240
@ MISCREG_TTBCR
Definition misc.hh:265
@ MISCREG_CSSELR
Definition misc.hh:235
@ MISCREG_CPACR
Definition misc.hh:246
@ MISCREG_SCR_EL3
Definition misc.hh:599
@ MISCREG_TLBIASIDIS
Definition misc.hh:328
@ MISCREG_ID_ISAR6
Definition misc.hh:231
@ MISCREG_DBGOSLAR
Definition misc.hh:192
@ MISCREG_SPSR_SVC
Definition misc.hh:70
@ MISCREG_TCR_EL3
Definition misc.hh:616
@ MISCREG_HDCR
Definition misc.hh:255
@ MISCREG_ADFSR
Definition misc.hh:279
@ MISCREG_DTLBIMVA
Definition misc.hh:336
@ MISCREG_TCR_EL1
Definition misc.hh:607
@ MISCREG_CNTVCT
Definition misc.hh:420
@ MISCREG_SPSR_UND
Definition misc.hh:74
@ MISCREG_TCMTR
Definition misc.hh:212
@ MISCREG_DBGOSDLR
Definition misc.hh:194
@ MISCREG_SPSR_IRQ
Definition misc.hh:69
@ MISCREG_ID_ISAR5
Definition misc.hh:230
@ MISCREG_CNTPCT_EL0
Definition misc.hh:776
@ MISCREG_SPSR_ABT
Definition misc.hh:72
@ MISCREG_TLBIMVA
Definition misc.hh:339
@ MISCREG_ID_ISAR4
Definition misc.hh:229
@ MISCREG_SCTLR_EL1
Definition misc.hh:584
@ MISCREG_PRRR
Definition misc.hh:374
@ MISCREG_TEECR
Definition misc.hh:203
@ MISCREG_CCSIDR
Definition misc.hh:232
@ MISCREG_PMCR
Definition misc.hh:356
@ MISCREG_CNTV_CTL
Definition misc.hh:430
@ MISCREG_DFAR
Definition misc.hh:288
@ MISCREG_JMCR
Definition misc.hh:207
@ MISCREG_TLBIMVAL
Definition misc.hh:342
@ MISCREG_ITLBIALL
Definition misc.hh:332
@ MISCREG_ELR_HYP
Definition misc.hh:75
@ MISCREG_CNTVCT_EL0
Definition misc.hh:777
@ MISCREG_CPSR
Definition misc.hh:66
@ MISCREG_ID_MMFR0
Definition misc.hh:220
@ MISCREG_ID_ISAR0
Definition misc.hh:225
@ MISCREG_CNTKCTL_EL1
Definition misc.hh:790
@ MISCREG_CNTPCT
Definition misc.hh:419
@ MISCREG_CNTPS_CTL_EL1
Definition misc.hh:792
@ MISCREG_NMRR
Definition misc.hh:380
@ MISCREG_MAIR1
Definition misc.hh:383
@ MISCREG_SEV_MAILBOX
Definition misc.hh:96
@ MISCREG_REVIDR
Definition misc.hh:215
@ MISCREG_ID_MMFR3
Definition misc.hh:223
@ MISCREG_TLBIMVAAIS
Definition misc.hh:329
@ MISCREG_CONTEXTIDR
Definition misc.hh:404
@ MISCREG_CNTP_TVAL_S
Definition misc.hh:429
@ MISCREG_CNTHCTL_EL2
Definition misc.hh:795
@ MISCREG_TEEHBR
Definition misc.hh:205
@ MISCREG_ID_DFR0
Definition misc.hh:218
@ MISCREG_ICC_SGI1R
Definition misc.hh:1023
@ MISCREG_ID_AA64MMFR0_EL1
Definition misc.hh:574
@ MISCREG_DTLBIALL
Definition misc.hh:335
@ MISCREG_TLBIALLIS
Definition misc.hh:326
@ MISCREG_TLBIASID
Definition misc.hh:340
@ MISCREG_ITLBIMVA
Definition misc.hh:333
@ MISCREG_HCR_EL2
Definition misc.hh:591
@ MISCREG_DCIMVAC
Definition misc.hh:307
@ MISCREG_TTBR1
Definition misc.hh:262
@ MISCREG_ITLBIASID
Definition misc.hh:334
@ MISCREG_AIFSR
Definition misc.hh:282
@ MISCREG_ICIMVAU
Definition misc.hh:303
@ MISCREG_CTR
Definition misc.hh:211
@ MISCREG_CLIDR
Definition misc.hh:233
@ MISCREG_MDCR_EL2
Definition misc.hh:593
@ MISCREG_IFSR
Definition misc.hh:276
@ MISCREG_ICIALLUIS
Definition misc.hh:297
@ MISCREG_TLBIMVAIS
Definition misc.hh:327
@ MISCREG_JIDR
Definition misc.hh:204
@ MISCREG_DBGPRCR
Definition misc.hh:195
@ MISCREG_CNTP_CTL
Definition misc.hh:421
@ MISCREG_CNTVOFF
Definition misc.hh:438
@ MISCREG_DCCSW
Definition misc.hh:318
@ MISCREG_TLBTR
Definition misc.hh:213
@ MISCREG_DCCMVAU
Definition misc.hh:321
@ MISCREG_DTLBIASID
Definition misc.hh:337
@ MISCREG_ID_PFR1
Definition misc.hh:217
@ MISCREG_CNTV_TVAL_EL0
Definition misc.hh:783
@ MISCREG_SPSR_MON
Definition misc.hh:71
@ MISCREG_DCCIMVAC
Definition misc.hh:322
@ MISCREG_TTBR0
Definition misc.hh:259
@ MISCREG_DACR
Definition misc.hh:270
@ MISCREG_JOSCR
Definition misc.hh:206
@ MISCREG_ICIALLU
Definition misc.hh:302
@ MISCREG_TLBIALL
Definition misc.hh:338
@ MISCREG_SCTLR_EL3
Definition misc.hh:597
@ MISCREG_CNTP_TVAL_EL0
Definition misc.hh:780
@ MISCREG_ICC_SGI0R
Definition misc.hh:1022
@ MISCREG_ID_ISAR1
Definition misc.hh:226
@ MISCREG_AIDR
Definition misc.hh:234
@ MISCREG_DFSR
Definition misc.hh:273
@ MISCREG_DCISW
Definition misc.hh:308
@ MISCREG_ID_MMFR2
Definition misc.hh:222
@ MISCREG_VMPIDR_EL2
Definition misc.hh:583
@ MISCREG_ICC_ASGI1R
Definition misc.hh:997
@ MISCREG_ID_ISAR3
Definition misc.hh:228
@ MISCREG_ID_PFR0
Definition misc.hh:216
@ MISCREG_DCCMVAC
Definition misc.hh:317
@ MISCREG_ID_MMFR4
Definition misc.hh:224
@ MISCREG_CNTFRQ_EL0
Definition misc.hh:775
@ MISCREG_ID_AFR0
Definition misc.hh:219
@ MISCREG_TLBIMVAA
Definition misc.hh:341
@ MISCREG_ACTLR
Definition misc.hh:243
@ MISCREG_HSTR
Definition misc.hh:257
@ MISCREG_ID_ISAR2
Definition misc.hh:227
@ MISCREG_SPSR_FIQ
Definition misc.hh:68
@ MISCREG_MAIR0
Definition misc.hh:377
RegVal getMPIDR(ArmSystem *arm_sys, ThreadContext *tc)
This helper function is returning the value of MPIDR_EL1.
Definition utility.cc:164
void syncVecElemsToRegs(ThreadContext *tc)
Definition utility.cc:1337
bool isGenericTimerPhysEL0SystemAccessTrapEL2(const MiscRegIndex misc_reg, ThreadContext *tc)
Definition utility.cc:976
Bitfield< 3, 2 > el
Definition misc_types.hh:73
std::pair< bool, bool > ELStateUsingAArch32K(ThreadContext *tc, ExceptionLevel el, bool secure)
Definition utility.cc:313
bool condGenericTimerPhysEL1SystemAccessTrapEL2(const MiscRegIndex misc_reg, ThreadContext *tc)
Definition utility.cc:1096
bool condGenericTimerSystemAccessTrapEL1(const MiscRegIndex misc_reg, ThreadContext *tc)
Definition utility.cc:888
int unflattenMiscReg(int reg)
Definition misc.cc:723
int decodePhysAddrRange64(uint8_t pa_enc)
Returns the n.
Definition utility.cc:1279
const Addr PageBytes
Definition page_size.hh:53
static ExceptionLevel opModeToEL(OperatingMode mode)
Definition types.hh:391
RegVal readMPIDR(ArmSystem *arm_sys, ThreadContext *tc)
This helper function is either returing the value of MPIDR_EL1 (by calling getMPIDR),...
Definition utility.cc:138
bool inAArch64(ThreadContext *tc)
Definition utility.cc:117
bool HaveExt(ThreadContext *tc, ArmExtension ext)
Returns true if the provided ThreadContext supports the ArmExtension passed as a second argument.
Definition utility.cc:222
Addr purifyTaggedAddr(Addr addr, ThreadContext *tc, ExceptionLevel el, TCR tcr, bool is_instr)
Removes the tag from tagged addresses if that mode is enabled.
Definition utility.cc:464
bool condGenericTimerPhysHypTrap(const MiscRegIndex misc_reg, ThreadContext *tc)
Definition utility.cc:854
static RegVal getAff0(ArmSystem *arm_sys, ThreadContext *tc)
Definition utility.cc:206
Addr truncPage(Addr addr)
Definition utility.cc:483
bool condGenericTimerCommonEL1SystemAccessTrapEL2(const MiscRegIndex misc_reg, ThreadContext *tc)
Definition utility.cc:1062
Bitfield< 12 > ext
Bitfield< 24 > j
Definition misc_types.hh:57
constexpr RegClass vecRegClass
Definition vec.hh:101
uint32_t VecElem
Definition vec.hh:63
bool mcrrMrrc15TrapToHyp(const MiscRegIndex misc_reg, ThreadContext *tc, uint32_t iss, ExceptionClass *ec)
Definition utility.cc:717
Bitfield< 1 > ri
Definition misc.hh:125
Bitfield< 5, 3 > reg
Definition types.hh:92
Bitfield< 3 > addr
Definition types.hh:84
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
std::shared_ptr< FaultBase > Fault
Definition types.hh:249
uint16_t RegIndex
Definition types.hh:176
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
uint64_t RegVal
Definition types.hh:173
constexpr decltype(nullptr) NoFault
Definition types.hh:253
PortProxy Object Declaration.

Generated on Mon Jul 10 2023 15:31:58 for gem5 by doxygen 1.9.7