gem5 v23.0.0.1
Loading...
Searching...
No Matches
faults.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010, 2012-2014, 2016-2019, 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 * Copyright (c) 2003-2005 The Regents of The University of Michigan
15 * Copyright (c) 2007-2008 The Florida State University
16 * All rights reserved.
17 *
18 * Redistribution and use in source and binary forms, with or without
19 * modification, are permitted provided that the following conditions are
20 * met: redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer;
22 * redistributions in binary form must reproduce the above copyright
23 * notice, this list of conditions and the following disclaimer in the
24 * documentation and/or other materials provided with the distribution;
25 * neither the name of the copyright holders nor the names of its
26 * contributors may be used to endorse or promote products derived from
27 * this software without specific prior written permission.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 */
41
42#include "arch/arm/faults.hh"
43
46#include "arch/arm/isa.hh"
48#include "arch/arm/system.hh"
49#include "arch/arm/utility.hh"
50#include "base/compiler.hh"
51#include "base/trace.hh"
52#include "cpu/base.hh"
53#include "cpu/thread_context.hh"
54#include "debug/Faults.hh"
55#include "sim/full_system.hh"
56
57namespace gem5
58{
59
60namespace ArmISA
61{
62
63const uint32_t HighVecs = 0xFFFF0000;
64
66 0x01, // AlignmentFault
67 0x04, // InstructionCacheMaintenance
68 0xff, // SynchExtAbtOnTranslTableWalkL0 (INVALID)
69 0x0c, // SynchExtAbtOnTranslTableWalkL1
70 0x0e, // SynchExtAbtOnTranslTableWalkL2
71 0xff, // SynchExtAbtOnTranslTableWalkL3 (INVALID)
72 0xff, // SynchPtyErrOnTranslTableWalkL0 (INVALID)
73 0x1c, // SynchPtyErrOnTranslTableWalkL1
74 0x1e, // SynchPtyErrOnTranslTableWalkL2
75 0xff, // SynchPtyErrOnTranslTableWalkL3 (INVALID)
76 0xff, // TranslationL0 (INVALID)
77 0x05, // TranslationL1
78 0x07, // TranslationL2
79 0xff, // TranslationL3 (INVALID)
80 0xff, // AccessFlagL0 (INVALID)
81 0x03, // AccessFlagL1
82 0x06, // AccessFlagL2
83 0xff, // AccessFlagL3 (INVALID)
84 0xff, // DomainL0 (INVALID)
85 0x09, // DomainL1
86 0x0b, // DomainL2
87 0xff, // DomainL3 (INVALID)
88 0xff, // PermissionL0 (INVALID)
89 0x0d, // PermissionL1
90 0x0f, // PermissionL2
91 0xff, // PermissionL3 (INVALID)
92 0x02, // DebugEvent
93 0x08, // SynchronousExternalAbort
94 0x10, // TLBConflictAbort
95 0x19, // SynchPtyErrOnMemoryAccess
96 0x16, // AsynchronousExternalAbort
97 0x18, // AsynchPtyErrOnMemoryAccess
98 0xff, // AddressSizeL0 (INVALID)
99 0xff, // AddressSizeL1 (INVALID)
100 0xff, // AddressSizeL2 (INVALID)
101 0xff, // AddressSizeL3 (INVALID)
102 0x40, // PrefetchTLBMiss
103 0x80 // PrefetchUncacheable
104};
105
106static_assert(sizeof(ArmFault::shortDescFaultSources) ==
108 "Invalid size of ArmFault::shortDescFaultSources[]");
109
111 0x21, // AlignmentFault
112 0xff, // InstructionCacheMaintenance (INVALID)
113 0xff, // SynchExtAbtOnTranslTableWalkL0 (INVALID)
114 0x15, // SynchExtAbtOnTranslTableWalkL1
115 0x16, // SynchExtAbtOnTranslTableWalkL2
116 0x17, // SynchExtAbtOnTranslTableWalkL3
117 0xff, // SynchPtyErrOnTranslTableWalkL0 (INVALID)
118 0x1d, // SynchPtyErrOnTranslTableWalkL1
119 0x1e, // SynchPtyErrOnTranslTableWalkL2
120 0x1f, // SynchPtyErrOnTranslTableWalkL3
121 0xff, // TranslationL0 (INVALID)
122 0x05, // TranslationL1
123 0x06, // TranslationL2
124 0x07, // TranslationL3
125 0xff, // AccessFlagL0 (INVALID)
126 0x09, // AccessFlagL1
127 0x0a, // AccessFlagL2
128 0x0b, // AccessFlagL3
129 0xff, // DomainL0 (INVALID)
130 0x3d, // DomainL1
131 0x3e, // DomainL2
132 0xff, // DomainL3 (RESERVED)
133 0xff, // PermissionL0 (INVALID)
134 0x0d, // PermissionL1
135 0x0e, // PermissionL2
136 0x0f, // PermissionL3
137 0x22, // DebugEvent
138 0x10, // SynchronousExternalAbort
139 0x30, // TLBConflictAbort
140 0x18, // SynchPtyErrOnMemoryAccess
141 0x11, // AsynchronousExternalAbort
142 0x19, // AsynchPtyErrOnMemoryAccess
143 0xff, // AddressSizeL0 (INVALID)
144 0xff, // AddressSizeL1 (INVALID)
145 0xff, // AddressSizeL2 (INVALID)
146 0xff, // AddressSizeL3 (INVALID)
147 0x40, // PrefetchTLBMiss
148 0x80 // PrefetchUncacheable
149};
150
151static_assert(sizeof(ArmFault::longDescFaultSources) ==
153 "Invalid size of ArmFault::longDescFaultSources[]");
154
156 0x21, // AlignmentFault
157 0xff, // InstructionCacheMaintenance (INVALID)
158 0x14, // SynchExtAbtOnTranslTableWalkL0
159 0x15, // SynchExtAbtOnTranslTableWalkL1
160 0x16, // SynchExtAbtOnTranslTableWalkL2
161 0x17, // SynchExtAbtOnTranslTableWalkL3
162 0x1c, // SynchPtyErrOnTranslTableWalkL0
163 0x1d, // SynchPtyErrOnTranslTableWalkL1
164 0x1e, // SynchPtyErrOnTranslTableWalkL2
165 0x1f, // SynchPtyErrOnTranslTableWalkL3
166 0x04, // TranslationL0
167 0x05, // TranslationL1
168 0x06, // TranslationL2
169 0x07, // TranslationL3
170 0x08, // AccessFlagL0
171 0x09, // AccessFlagL1
172 0x0a, // AccessFlagL2
173 0x0b, // AccessFlagL3
174 // @todo: Section & Page Domain Fault in AArch64?
175 0xff, // DomainL0 (INVALID)
176 0xff, // DomainL1 (INVALID)
177 0xff, // DomainL2 (INVALID)
178 0xff, // DomainL3 (INVALID)
179 0x0c, // PermissionL0
180 0x0d, // PermissionL1
181 0x0e, // PermissionL2
182 0x0f, // PermissionL3
183 0x22, // DebugEvent
184 0x10, // SynchronousExternalAbort
185 0x30, // TLBConflictAbort
186 0x18, // SynchPtyErrOnMemoryAccess
187 0xff, // AsynchronousExternalAbort (INVALID)
188 0xff, // AsynchPtyErrOnMemoryAccess (INVALID)
189 0x00, // AddressSizeL0
190 0x01, // AddressSizeL1
191 0x02, // AddressSizeL2
192 0x03, // AddressSizeL3
193 0x40, // PrefetchTLBMiss
194 0x80 // PrefetchUncacheable
195};
196
197static_assert(sizeof(ArmFault::aarch64FaultSources) ==
199 "Invalid size of ArmFault::aarch64FaultSources[]");
200
201// Fields: name, offset, cur{ELT,ELH}Offset, lowerEL{64,32}Offset, next mode,
202// {ARM, Thumb, ARM_ELR, Thumb_ELR} PC offset, hyp trap,
203// {A, F} disable, class, stat
205 // Some dummy values (the reset vector has an IMPLEMENTATION DEFINED
206 // location in AArch64)
207 "Reset", 0x000, 0x000, 0x000, 0x000, 0x000, MODE_SVC,
208 0, 0, 0, 0, false, true, true, ExceptionClass::UNKNOWN
209);
211 "Undefined Instruction", 0x004, 0x000, 0x200, 0x400, 0x600, MODE_UNDEFINED,
212 4, 2, 0, 0, true, false, false, ExceptionClass::UNKNOWN
213);
215 "Supervisor Call", 0x008, 0x000, 0x200, 0x400, 0x600, MODE_SVC,
216 4, 2, 4, 2, true, false, false, ExceptionClass::SVC_TO_HYP
217);
219 "Secure Monitor Call", 0x008, 0x000, 0x200, 0x400, 0x600, MODE_MON,
220 4, 4, 4, 4, false, true, true, ExceptionClass::SMC_TO_HYP
221);
223 "Hypervisor Call", 0x008, 0x000, 0x200, 0x400, 0x600, MODE_HYP,
224 4, 4, 4, 4, true, false, false, ExceptionClass::HVC
225);
227 "Prefetch Abort", 0x00C, 0x000, 0x200, 0x400, 0x600, MODE_ABORT,
228 4, 4, 0, 0, true, true, false, ExceptionClass::PREFETCH_ABORT_TO_HYP
229);
231 "Data Abort", 0x010, 0x000, 0x200, 0x400, 0x600, MODE_ABORT,
232 8, 8, 0, 0, true, true, false, ExceptionClass::DATA_ABORT_TO_HYP
233);
235 "Virtual Data Abort", 0x010, 0x000, 0x200, 0x400, 0x600, MODE_ABORT,
236 8, 8, 0, 0, true, true, false, ExceptionClass::INVALID
237);
239 // @todo: double check these values
240 "Hypervisor Trap", 0x014, 0x000, 0x200, 0x400, 0x600, MODE_HYP,
241 0, 0, 0, 0, false, false, false, ExceptionClass::UNKNOWN
242);
244 "Secure Monitor Trap", 0x004, 0x000, 0x200, 0x400, 0x600, MODE_MON,
245 4, 2, 0, 0, false, false, false, ExceptionClass::UNKNOWN
246);
248 "IRQ", 0x018, 0x080, 0x280, 0x480, 0x680, MODE_IRQ,
249 4, 4, 0, 0, false, true, false, ExceptionClass::UNKNOWN
250);
252 "Virtual IRQ", 0x018, 0x080, 0x280, 0x480, 0x680, MODE_IRQ,
253 4, 4, 0, 0, false, true, false, ExceptionClass::INVALID
254);
256 "FIQ", 0x01C, 0x100, 0x300, 0x500, 0x700, MODE_FIQ,
257 4, 4, 0, 0, false, true, true, ExceptionClass::UNKNOWN
258);
260 "Virtual FIQ", 0x01C, 0x100, 0x300, 0x500, 0x700, MODE_FIQ,
261 4, 4, 0, 0, false, true, true, ExceptionClass::INVALID
262);
264 "Illegal Inst Set State Fault", 0x004, 0x000, 0x200, 0x400, 0x600, MODE_UNDEFINED,
265 4, 2, 0, 0, true, false, false, ExceptionClass::ILLEGAL_INST
266);
268 // Some dummy values (SupervisorTrap is AArch64-only)
269 "Supervisor Trap", 0x014, 0x000, 0x200, 0x400, 0x600, MODE_SVC,
270 0, 0, 0, 0, false, false, false, ExceptionClass::UNKNOWN
271);
273 // Some dummy values (PCAlignmentFault is AArch64-only)
274 "PC Alignment Fault", 0x000, 0x000, 0x200, 0x400, 0x600, MODE_SVC,
275 0, 0, 0, 0, true, false, false, ExceptionClass::PC_ALIGNMENT
276);
278 // Some dummy values (SPAlignmentFault is AArch64-only)
279 "SP Alignment Fault", 0x000, 0x000, 0x200, 0x400, 0x600, MODE_SVC,
280 0, 0, 0, 0, true, false, false, ExceptionClass::STACK_PTR_ALIGNMENT
281);
283 // Some dummy values (SError is AArch64-only)
284 "SError", 0x000, 0x180, 0x380, 0x580, 0x780, MODE_SVC,
285 0, 0, 0, 0, false, true, true, ExceptionClass::SERROR
286);
288 // Some dummy values (SoftwareBreakpoint is AArch64-only)
289 "Software Breakpoint", 0x000, 0x000, 0x200, 0x400, 0x600, MODE_SVC,
290 0, 0, 0, 0, true, false, false, ExceptionClass::SOFTWARE_BREAKPOINT
291);
293 "Hardware Breakpoint", 0x000, 0x000, 0x200, 0x400, 0x600, MODE_SVC,
294 0, 0, 0, 0, true, false, false, ExceptionClass::HW_BREAKPOINT
295);
297 "Watchpoint", 0x000, 0x000, 0x200, 0x400, 0x600, MODE_SVC,
298 0, 0, 0, 0, true, false, false, ExceptionClass::WATCHPOINT
299);
301 "SoftwareStep", 0x000, 0x000, 0x200, 0x400, 0x600, MODE_SVC,
302 0, 0, 0, 0, true, false, false, ExceptionClass::SOFTWARE_STEP
303);
305 // Some dummy values
306 "ArmSev Flush", 0x000, 0x000, 0x000, 0x000, 0x000, MODE_SVC,
307 0, 0, 0, 0, false, true, true, ExceptionClass::UNKNOWN
308);
309
310Addr
312{
313 Addr base;
314
315 // Check for invalid modes
316 CPSR cpsr = tc->readMiscRegNoEffect(MISCREG_CPSR);
317 assert(ArmSystem::haveEL(tc, EL3) || cpsr.mode != MODE_MON);
318 assert(ArmSystem::haveEL(tc, EL2) || cpsr.mode != MODE_HYP);
319
320 switch (cpsr.mode)
321 {
322 case MODE_MON:
324 break;
325 case MODE_HYP:
327 break;
328 default:
329 SCTLR sctlr = tc->readMiscReg(MISCREG_SCTLR);
330 if (sctlr.v) {
331 base = HighVecs;
332 } else {
333 base = ArmSystem::haveEL(tc, EL3) ?
334 tc->readMiscReg(MISCREG_VBAR) : 0;
335 }
336 break;
337 }
338
339 return base + offset(tc);
340}
341
342Addr
344{
345 Addr vbar;
346 switch (toEL) {
347 case EL3:
348 assert(ArmSystem::haveEL(tc, EL3));
349 vbar = tc->readMiscReg(MISCREG_VBAR_EL3);
350 break;
351 case EL2:
352 assert(ArmSystem::haveEL(tc, EL2));
353 vbar = tc->readMiscReg(MISCREG_VBAR_EL2);
354 break;
355 case EL1:
356 vbar = tc->readMiscReg(MISCREG_VBAR_EL1);
357 break;
358 default:
359 panic("Invalid target exception level");
360 break;
361 }
362 return vbar + offset64(tc);
363}
364
367{
368 switch (toEL) {
369 case EL1:
370 return MISCREG_ESR_EL1;
371 case EL2:
372 return MISCREG_ESR_EL2;
373 case EL3:
374 return MISCREG_ESR_EL3;
375 default:
376 panic("Invalid exception level");
377 break;
378 }
379}
380
383{
384 switch (toEL) {
385 case EL1:
386 return MISCREG_FAR_EL1;
387 case EL2:
388 return MISCREG_FAR_EL2;
389 case EL3:
390 return MISCREG_FAR_EL3;
391 default:
392 panic("Invalid exception level");
393 break;
394 }
395}
396
397void
399{
400 ESR esr = 0;
401 uint32_t exc_class = (uint32_t) ec(tc);
402 uint32_t iss_val = iss();
403
404 assert(!from64 || ArmSystem::highestELIs64(tc));
405
406 esr.ec = exc_class;
407 esr.il = il(tc);
408
409 // Condition code valid for EC[5:4] nonzero
410 if (!from64 && ((bits(exc_class, 5, 4) == 0) &&
411 (bits(exc_class, 3, 0) != 0))) {
412
413 if (!machInst.thumb) {
414 ConditionCode cond_code = (ConditionCode) (uint32_t) machInst.condCode;
415 // If its on unconditional instruction report with a cond code of
416 // 0xE, ie the unconditional code
417 esr.cond_iss.cv = 1;
418 esr.cond_iss.cond = (cond_code == COND_UC) ? COND_AL : cond_code;
419 }
420 esr.cond_iss.iss = bits(iss_val, 19, 0);
421 } else {
422 esr.iss = iss_val;
423 }
424 tc->setMiscReg(syndrome_reg, esr);
425}
426
427void
429{
430 CPSR cpsr = tc->readMiscReg(MISCREG_CPSR);
431
432 // Determine source exception level and mode
433 fromMode = (OperatingMode) (uint8_t) cpsr.mode;
435 if (opModeIs64(fromMode))
436 from64 = true;
437
438 // Determine target exception level (aarch64) or target execution
439 // mode (aarch32).
440 if (ArmSystem::haveEL(tc, EL3) && routeToMonitor(tc)) {
442 toEL = EL3;
443 } else if (ArmSystem::haveEL(tc, EL2) && routeToHyp(tc)) {
445 toEL = EL2;
446 hypRouted = true;
447 } else {
448 toMode = nextMode();
450 }
451
452 if (fromEL > toEL)
453 toEL = fromEL;
454
455 // Check for Set Priviledge Access Never, if PAN is supported
456 if (HaveExt(tc, ArmExtension::FEAT_PAN)) {
457 if (toEL == EL1) {
458 const SCTLR sctlr = tc->readMiscReg(MISCREG_SCTLR_EL1);
459 span = !sctlr.span;
460 }
461
462 const HCR hcr = tc->readMiscRegNoEffect(MISCREG_HCR_EL2);
463 if (toEL == EL2 && hcr.e2h && hcr.tge) {
464 const SCTLR sctlr = tc->readMiscReg(MISCREG_SCTLR_EL2);
465 span = !sctlr.span;
466 }
467 }
468
469 to64 = ELIs64(tc, toEL);
470
471 // The fault specific informations have been updated; it is
472 // now possible to use them inside the fault.
473 faultUpdated = true;
474}
475
476void
478{
479 // Update fault state informations, like the starting mode (aarch32)
480 // or EL (aarch64) and the ending mode or EL.
481 // From the update function we are also evaluating if the fault must
482 // be handled in AArch64 mode (to64).
483 update(tc);
484
485 if (from64 != to64) {
486 // Switching modes, sync up versions of the vector register file.
487 if (from64) {
489 } else {
491 }
492 }
493
494 if (to64) {
495 // Invoke exception handler in AArch64 state
496 invoke64(tc, inst);
497 } else {
498 // Invoke exception handler in AArch32 state
499 invoke32(tc, inst);
500 }
501}
502
503void
505{
506 // ARMv7 (ARM ARM issue C B1.9)
507 bool have_security = ArmSystem::haveEL(tc, EL3);
508
511 return;
512
513 SCTLR sctlr = tc->readMiscReg(MISCREG_SCTLR);
515 CPSR saved_cpsr = tc->readMiscReg(MISCREG_CPSR);
516 saved_cpsr.nz = tc->getReg(cc_reg::Nz);
517 saved_cpsr.c = tc->getReg(cc_reg::C);
518 saved_cpsr.v = tc->getReg(cc_reg::V);
519 saved_cpsr.ge = tc->getReg(cc_reg::Ge);
520
521 [[maybe_unused]] Addr cur_pc = tc->pcState().as<PCState>().pc();
522 ITSTATE it = tc->pcState().as<PCState>().itstate();
523 saved_cpsr.it2 = it.top6;
524 saved_cpsr.it1 = it.bottom2;
525
526 // if we have a valid instruction then use it to annotate this fault with
527 // extra information. This is used to generate the correct fault syndrome
528 // information
529 [[maybe_unused]] ArmStaticInst *arm_inst = instrAnnotate(inst);
530
531 // Ensure Secure state if initially in Monitor mode
532 if (have_security && saved_cpsr.mode == MODE_MON) {
534 if (scr.ns) {
535 scr.ns = 0;
537 }
538 }
539
540 CPSR cpsr = tc->readMiscReg(MISCREG_CPSR);
541 cpsr.mode = toMode;
542
543 // some bits are set differently if we have been routed to hyp mode
544 if (cpsr.mode == MODE_HYP) {
545 SCTLR hsctlr = tc->readMiscReg(MISCREG_HSCTLR);
546 cpsr.t = hsctlr.te;
547 cpsr.e = hsctlr.ee;
548 if (!scr.ea) {cpsr.a = 1;}
549 if (!scr.fiq) {cpsr.f = 1;}
550 if (!scr.irq) {cpsr.i = 1;}
551 } else if (cpsr.mode == MODE_MON) {
552 // Special case handling when entering monitor mode
553 cpsr.t = sctlr.te;
554 cpsr.e = sctlr.ee;
555 cpsr.a = 1;
556 cpsr.f = 1;
557 cpsr.i = 1;
558 } else {
559 cpsr.t = sctlr.te;
560 cpsr.e = sctlr.ee;
561
562 // The *Disable functions are virtual and different per fault
563 cpsr.a = cpsr.a | abortDisable(tc);
564 cpsr.f = cpsr.f | fiqDisable(tc);
565 cpsr.i = 1;
566 }
567 cpsr.it1 = cpsr.it2 = 0;
568 cpsr.j = 0;
569 cpsr.pan = span ? 1 : saved_cpsr.pan;
570 tc->setMiscReg(MISCREG_CPSR, cpsr);
571
572 // Make sure mailbox sets to one always
574
575 // Clear the exclusive monitor
577
578 if (cpsr.mode == MODE_HYP) {
579 tc->setMiscReg(MISCREG_ELR_HYP, cur_pc +
580 (saved_cpsr.t ? thumbPcOffset(true) : armPcOffset(true)));
581 } else {
582 tc->setReg(int_reg::Lr, cur_pc +
583 (saved_cpsr.t ? thumbPcOffset(false) : armPcOffset(false)));
584 }
585
586 switch (cpsr.mode) {
587 case MODE_FIQ:
588 tc->setMiscReg(MISCREG_SPSR_FIQ, saved_cpsr);
589 break;
590 case MODE_IRQ:
591 tc->setMiscReg(MISCREG_SPSR_IRQ, saved_cpsr);
592 break;
593 case MODE_SVC:
594 tc->setMiscReg(MISCREG_SPSR_SVC, saved_cpsr);
595 break;
596 case MODE_MON:
597 assert(have_security);
598 tc->setMiscReg(MISCREG_SPSR_MON, saved_cpsr);
599 break;
600 case MODE_ABORT:
601 tc->setMiscReg(MISCREG_SPSR_ABT, saved_cpsr);
602 break;
603 case MODE_UNDEFINED:
604 tc->setMiscReg(MISCREG_SPSR_UND, saved_cpsr);
605 if (ec(tc) != ExceptionClass::UNKNOWN)
607 break;
608 case MODE_HYP:
609 assert(ArmSystem::haveEL(tc, EL2));
610 tc->setMiscReg(MISCREG_SPSR_HYP, saved_cpsr);
612 break;
613 default:
614 panic("unknown Mode\n");
615 }
616
617 Addr new_pc = getVector(tc);
618 DPRINTF(Faults, "Invoking Fault:%s cpsr:%#x PC:%#x lr:%#x newVec: %#x "
619 "%s\n", name(), cpsr, cur_pc, tc->getReg(int_reg::Lr),
620 new_pc, arm_inst ? csprintf("inst: %#x", arm_inst->encoding()) :
621 std::string());
622 PCState pc(new_pc);
623 pc.thumb(cpsr.t);
624 pc.nextThumb(pc.thumb());
625 pc.jazelle(cpsr.j);
626 pc.nextJazelle(pc.jazelle());
627 pc.aarch64(!cpsr.width);
628 pc.nextAArch64(!cpsr.width);
629 pc.illegalExec(false);
630 tc->pcState(pc);
631}
632
633void
635{
636 // Determine actual misc. register indices for ELR_ELx and SPSR_ELx
637 MiscRegIndex elr_idx, spsr_idx;
638 switch (toEL) {
639 case EL1:
640 elr_idx = MISCREG_ELR_EL1;
641 spsr_idx = MISCREG_SPSR_EL1;
642 break;
643 case EL2:
644 assert(ArmSystem::haveEL(tc, EL2));
645 elr_idx = MISCREG_ELR_EL2;
646 spsr_idx = MISCREG_SPSR_EL2;
647 break;
648 case EL3:
649 assert(ArmSystem::haveEL(tc, EL3));
650 elr_idx = MISCREG_ELR_EL3;
651 spsr_idx = MISCREG_SPSR_EL3;
652 break;
653 default:
654 panic("Invalid target exception level");
655 break;
656 }
657
658 // Save process state into SPSR_ELx
659 CPSR cpsr = tc->readMiscReg(MISCREG_CPSR);
660 CPSR spsr = cpsr;
661 spsr.nz = tc->getReg(cc_reg::Nz);
662 spsr.c = tc->getReg(cc_reg::C);
663 spsr.v = tc->getReg(cc_reg::V);
664 spsr.ss = isResetSPSR() ? 0: cpsr.ss;
665 if (from64) {
666 // Force some bitfields to 0
667 spsr.q = 0;
668 spsr.it1 = 0;
669 spsr.j = 0;
670 spsr.ge = 0;
671 spsr.it2 = 0;
672 spsr.t = 0;
673 } else {
674 spsr.ge = tc->getReg(cc_reg::Ge);
675 ITSTATE it = tc->pcState().as<PCState>().itstate();
676 spsr.it2 = it.top6;
677 spsr.it1 = it.bottom2;
678 spsr.uao = 0;
679 }
680 tc->setMiscReg(spsr_idx, spsr);
681
682 // Save preferred return address into ELR_ELx
683 Addr curr_pc = tc->pcState().instAddr();
684 Addr ret_addr = curr_pc;
685 if (from64)
686 ret_addr += armPcElrOffset();
687 else
688 ret_addr += spsr.t ? thumbPcElrOffset() : armPcElrOffset();
689 tc->setMiscReg(elr_idx, ret_addr);
690
691 Addr vec_address = getVector64(tc);
692
693 // Update process state
694 OperatingMode64 mode = 0;
695 mode.spX = 1;
696 mode.el = toEL;
697 mode.width = 0;
698 cpsr.mode = mode;
699 cpsr.daif = 0xf;
700 cpsr.il = 0;
701 cpsr.ss = 0;
702 cpsr.pan = span ? 1 : spsr.pan;
703 cpsr.uao = 0;
704 tc->setMiscReg(MISCREG_CPSR, cpsr);
705
706 // If we have a valid instruction then use it to annotate this fault with
707 // extra information. This is used to generate the correct fault syndrome
708 // information
709 [[maybe_unused]] ArmStaticInst *arm_inst = instrAnnotate(inst);
710
711 // Set PC to start of exception handler
712 Addr new_pc = purifyTaggedAddr(vec_address, tc, toEL, true);
713 DPRINTF(Faults, "Invoking Fault (AArch64 target EL):%s cpsr:%#x PC:%#x "
714 "elr:%#x newVec: %#x %s\n", name(), cpsr, curr_pc, ret_addr,
715 new_pc, arm_inst ? csprintf("inst: %#x", arm_inst->encoding()) :
716 std::string());
717 PCState pc(new_pc);
718 pc.aarch64(!cpsr.width);
719 pc.nextAArch64(!cpsr.width);
720 pc.illegalExec(false);
721 pc.stepped(false);
722 tc->pcState(pc);
723
724 // Save exception syndrome
725 if ((nextMode() != MODE_IRQ) && (nextMode() != MODE_FIQ))
727}
728
731{
732 if (inst) {
733 auto arm_inst = static_cast<ArmStaticInst *>(inst.get());
734 arm_inst->annotateFault(this);
735 return arm_inst;
736 } else {
737 return nullptr;
738 }
739}
740
741Addr
743{
744 Addr base;
745
746 // Check for invalid modes
747 [[maybe_unused]] CPSR cpsr = tc->readMiscRegNoEffect(MISCREG_CPSR);
748 assert(ArmSystem::haveEL(tc, EL3) || cpsr.mode != MODE_MON);
749 assert(ArmSystem::haveEL(tc, EL2) || cpsr.mode != MODE_HYP);
750
751 // RVBAR is aliased (implemented as) MVBAR in gem5, since the two
752 // are mutually exclusive; there is no need to check here for
753 // which register to use since they hold the same value
755
756 return base + offset(tc);
757}
758
759void
761{
762 if (FullSystem) {
763 tc->getCpuPtr()->clearInterrupts(tc->threadId());
764 tc->clearArchRegs();
765 }
766 if (!ArmSystem::highestELIs64(tc)) {
767 ArmFault::invoke(tc, inst);
769 getMPIDR(dynamic_cast<ArmSystem*>(tc->getSystemPtr()), tc));
770
771 // Unless we have SMC code to get us there, boot in HYP!
772 if (ArmSystem::haveEL(tc, EL2) &&
773 !ArmSystem::haveEL(tc, EL3)) {
774 CPSR cpsr = tc->readMiscReg(MISCREG_CPSR);
775 cpsr.mode = MODE_HYP;
776 tc->setMiscReg(MISCREG_CPSR, cpsr);
777 }
778 } else {
779 // Advance the PC to the IMPLEMENTATION DEFINED reset value
781 pc.aarch64(true);
782 pc.nextAArch64(true);
783 tc->pcState(pc);
784 }
785}
786
787void
789{
790 if (FullSystem) {
791 ArmFault::invoke(tc, inst);
792 return;
793 }
794
795 // If the mnemonic isn't defined this has to be an unknown instruction.
796 assert(unknown || mnemonic != NULL);
797 auto arm_inst = static_cast<ArmStaticInst *>(inst.get());
798 if (disabled) {
799 panic("Attempted to execute disabled instruction "
800 "'%s' (inst 0x%08x)", mnemonic, arm_inst->encoding());
801 } else if (unknown) {
802 panic("Attempted to execute unknown instruction (inst 0x%08x)",
803 arm_inst->encoding());
804 } else {
805 panic("Attempted to execute unimplemented instruction "
806 "'%s' (inst 0x%08x)", mnemonic, arm_inst->encoding());
807 }
808}
809
810bool
812{
814 return fromEL == EL2 ||
815 (EL2Enabled(tc) && (fromEL == EL0) && hcr.tge);
816}
817
818uint32_t
820{
821
822 // If UndefinedInstruction is routed to hypervisor, iss field is 0.
823 if (hypRouted) {
824 return 0;
825 }
826
828 return issRaw;
829
830 uint32_t new_iss = 0;
831 uint32_t op0, op1, op2, CRn, CRm, Rt, dir;
832
833 dir = bits(machInst, 21, 21);
834 op0 = bits(machInst, 20, 19);
835 op1 = bits(machInst, 18, 16);
836 CRn = bits(machInst, 15, 12);
837 CRm = bits(machInst, 11, 8);
838 op2 = bits(machInst, 7, 5);
839 Rt = bits(machInst, 4, 0);
840
841 new_iss = op0 << 20 | op2 << 17 | op1 << 14 | CRn << 10 |
842 Rt << 5 | CRm << 1 | dir;
843
844 return new_iss;
845}
846
847void
849{
850 if (FullSystem) {
851 ArmFault::invoke(tc, inst);
852 return;
853 }
854
855 // Advance the PC since that won't happen automatically.
856 PCState pc = tc->pcState().as<PCState>();
857 assert(inst);
858 inst->advancePC(pc);
859 tc->pcState(pc);
860
861 // As of now, there isn't a 32 bit thumb version of this instruction.
862 assert(!machInst.bigThumb);
863 tc->getSystemPtr()->workload->syscall(tc);
864}
865
866bool
868{
870 return fromEL == EL2 ||
871 (EL2Enabled(tc) && fromEL == EL0 && hcr.tge);
872}
873
876{
879}
880
881uint32_t
883{
884 // Even if we have a 24 bit imm from an arm32 instruction then we only use
885 // the bottom 16 bits for the ISS value (it doesn't hurt for AArch64 SVC).
886 return issRaw & 0xFFFF;
887}
888
889uint32_t
891{
892 if (from64)
893 return bits(machInst, 20, 5);
894 return 0;
895}
896
899{
900 // If UndefinedInstruction is routed to hypervisor,
901 // HSR.EC field is 0.
902 if (hypRouted)
904 else
906}
907
908
910 ArmFaultVals<HypervisorCall>(mach_inst, _imm)
911{
912 bStep = true;
913}
914
915bool
917{
918 return from64 && fromEL == EL3;
919}
920
921bool
923{
924 return !from64 || fromEL != EL3;
925}
926
929{
931}
932
935{
937}
938
939template<class T>
942{
943 bool isHypTrap = false;
944
945 // Normally we just use the exception vector from the table at the top if
946 // this file, however if this exception has caused a transition to hype
947 // mode, and its an exception type that would only do this if it has been
948 // trapped then we use the hyp trap vector instead of the normal vector
949 if (vals.hypTrappable) {
950 CPSR cpsr = tc->readMiscReg(MISCREG_CPSR);
951 if (cpsr.mode == MODE_HYP) {
952 CPSR spsr = tc->readMiscReg(MISCREG_SPSR_HYP);
953 isHypTrap = spsr.mode != MODE_HYP;
954 }
955 }
956 return isHypTrap ? 0x14 : vals.offset;
957}
958
959template<class T>
962{
963 if (toEL == fromEL) {
964 if (opModeIsT(fromMode))
965 return vals.currELTOffset;
966 return vals.currELHOffset;
967 } else {
968 bool lower_32 = false;
969 if (toEL == EL3) {
970 if (EL2Enabled(tc))
971 lower_32 = ELIs32(tc, EL2);
972 else
973 lower_32 = ELIs32(tc, EL1);
974 } else if (ELIsInHost(tc, fromEL) && fromEL == EL0 && toEL == EL2) {
975 lower_32 = ELIs32(tc, EL0);
976 } else {
977 lower_32 = ELIs32(tc, static_cast<ExceptionLevel>(toEL - 1));
978 }
979
980 if (lower_32)
981 return vals.lowerEL32Offset;
982 return vals.lowerEL64Offset;
983 }
984}
985
986// void
987// SupervisorCall::setSyndrome64(ThreadContext *tc, MiscRegIndex esr_idx)
988// {
989// ESR esr = 0;
990// esr.ec = machInst.aarch64 ? SvcAArch64 : SvcAArch32;
991// esr.il = !machInst.thumb;
992// if (machInst.aarch64)
993// esr.imm16 = bits(machInst.instBits, 20, 5);
994// else if (machInst.thumb)
995// esr.imm16 = bits(machInst.instBits, 7, 0);
996// else
997// esr.imm16 = bits(machInst.instBits, 15, 0);
998// tc->setMiscReg(esr_idx, esr);
999// }
1000
1001void
1003{
1004 if (FullSystem) {
1005 ArmFault::invoke(tc, inst);
1006 return;
1007 }
1008}
1009
1012{
1013 return (from64 ? ExceptionClass::SMC_64 : vals.ec);
1014}
1015
1016bool
1018{
1019 HCR hcr = tc->readMiscRegNoEffect(MISCREG_HCR_EL2);
1020 return EL2Enabled(tc) && currEL(tc) <= EL1 && hcr.tge;
1021}
1022
1023uint32_t
1025{
1026 // If SupervisorTrap is routed to hypervisor, iss field is 0.
1027 if (hypRouted) {
1028 return 0;
1029 }
1030 return issRaw;
1031}
1032
1035{
1036 if (hypRouted)
1038 else
1040}
1041
1044{
1047}
1048
1049template<class T>
1050void
1052{
1053 if (tranMethod == ArmFault::UnknownTran) {
1054 tranMethod = longDescFormatInUse(tc) ? ArmFault::LpaeTran
1056
1057 if ((tranMethod == ArmFault::VmsaTran) && this->routeToMonitor(tc)) {
1058 // See ARM ARM B3-1416
1059 bool override_LPAE = false;
1060 TTBCR ttbcr_s = tc->readMiscReg(MISCREG_TTBCR_S);
1061 [[maybe_unused]] TTBCR ttbcr_ns =
1063 if (ttbcr_s.eae) {
1064 override_LPAE = true;
1065 } else {
1066 // Unimplemented code option, not seen in testing. May need
1067 // extension according to the manual exceprt above.
1068 DPRINTF(Faults, "Warning: Incomplete translation method "
1069 "override detected.\n");
1070 }
1071 if (override_LPAE)
1072 tranMethod = ArmFault::LpaeTran;
1073 }
1074 }
1075
1077 tc->getCpuPtr()->clearInterrupt(tc->threadId(), INT_ABT, 0);
1078 }
1079 // Get effective fault source encoding
1080 CPSR cpsr = tc->readMiscReg(MISCREG_CPSR);
1081
1082 // source must be determined BEFORE invoking generic routines which will
1083 // try to set hsr etc. and are based upon source!
1084 ArmFaultVals<T>::invoke(tc, inst);
1085
1086 if (!this->to64) { // AArch32
1087 FSR fsr = getFsr(tc);
1088 if (cpsr.mode == MODE_HYP) {
1089 tc->setMiscReg(T::HFarIndex, faultAddr);
1090 } else if (stage2) {
1091 tc->setMiscReg(MISCREG_HPFAR, (faultAddr >> 8) & ~0xf);
1092 tc->setMiscReg(T::HFarIndex, OVAddr);
1093 } else if (debugType > ArmFault::NODEBUG) {
1094 DBGDS32 Rext = tc->readMiscReg(MISCREG_DBGDSCRext);
1095 tc->setMiscReg(T::FarIndex, faultAddr);
1096 if (debugType == ArmFault::BRKPOINT){
1097 Rext.moe = 0x1;
1098 } else if (debugType == ArmFault::VECTORCATCH){
1099 Rext.moe = 0x5;
1100 } else if (debugType > ArmFault::VECTORCATCH) {
1101 Rext.moe = 0xa;
1102 fsr.cm = (debugType == ArmFault::WPOINT_CM)? 1 : 0;
1103 }
1104
1105 tc->setMiscReg(T::FsrIndex, fsr);
1106 tc->setMiscReg(MISCREG_DBGDSCRext, Rext);
1107
1108 } else {
1109 tc->setMiscReg(T::FsrIndex, fsr);
1110 tc->setMiscReg(T::FarIndex, faultAddr);
1111 }
1112 DPRINTF(Faults, "Abort Fault source=%#x fsr=%#x faultAddr=%#x "\
1113 "tranMethod=%#x\n", source, fsr, faultAddr, tranMethod);
1114 } else { // AArch64
1115 // Set the FAR register. Nothing else to do if we are in AArch64 state
1116 // because the syndrome register has already been set inside invoke64()
1117 if (stage2) {
1118 // stage 2 fault, set HPFAR_EL2 to the faulting IPA
1119 // and FAR_EL2 to the Original VA
1121 tc->setMiscReg(MISCREG_HPFAR_EL2, bits(faultAddr, 47, 12) << 4);
1122
1123 DPRINTF(Faults, "Abort Fault (Stage 2) VA: 0x%x IPA: 0x%x\n",
1124 OVAddr, faultAddr);
1125 } else {
1127 }
1128 }
1129}
1130
1131template<class T>
1132void
1134{
1135 srcEncoded = getFaultStatusCode(tc);
1136 if (srcEncoded == ArmFault::FaultSourceInvalid) {
1137 panic("Invalid fault source\n");
1138 }
1139 ArmFault::setSyndrome(tc, syndrome_reg);
1140}
1141
1142template<class T>
1143uint8_t
1145{
1146
1147 panic_if(!this->faultUpdated,
1148 "Trying to use un-updated ArmFault internal variables\n");
1149
1150 uint8_t fsc = 0;
1151
1152 if (!this->to64) {
1153 // AArch32
1154 assert(tranMethod != ArmFault::UnknownTran);
1155 if (tranMethod == ArmFault::LpaeTran) {
1156 fsc = ArmFault::longDescFaultSources[source];
1157 } else {
1158 fsc = ArmFault::shortDescFaultSources[source];
1159 }
1160 } else {
1161 // AArch64
1162 fsc = ArmFault::aarch64FaultSources[source];
1163 }
1164
1165 return fsc;
1166}
1167
1168template<class T>
1169FSR
1171{
1172 FSR fsr = 0;
1173
1174 auto fsc = getFaultStatusCode(tc);
1175
1176 // AArch32
1177 assert(tranMethod != ArmFault::UnknownTran);
1178 if (tranMethod == ArmFault::LpaeTran) {
1179 fsr.status = fsc;
1180 fsr.lpae = 1;
1181 } else {
1182 fsr.fsLow = bits(fsc, 3, 0);
1183 fsr.fsHigh = bits(fsc, 4);
1184 fsr.domain = static_cast<uint8_t>(domain);
1185 }
1186
1187 fsr.wnr = (write ? 1 : 0);
1188 fsr.ext = 0;
1189
1190 return fsr;
1191}
1192
1193template<class T>
1194bool
1196{
1197 if (ArmSystem::haveEL(tc, EL3)) {
1198 SCR scr = tc->readMiscRegNoEffect(MISCREG_SCR_EL3);
1199 return (!scr.ns || scr.aw);
1200 }
1201 return true;
1202}
1203
1204template<class T>
1205void
1207{
1208 switch (id)
1209 {
1210 case ArmFault::S1PTW:
1211 s1ptw = val;
1212 break;
1213 case ArmFault::OVA:
1214 OVAddr = val;
1215 break;
1216
1217 // Just ignore unknown ID's
1218 default:
1219 break;
1220 }
1221}
1222
1223template<class T>
1224bool
1226{
1227 // NOTE: Not relying on LL information being aligned to lowest bits here
1228 return
1229 (source == ArmFault::AlignmentFault) ||
1230 ((source >= ArmFault::TranslationLL) &&
1231 (source < ArmFault::TranslationLL + 4)) ||
1232 ((source >= ArmFault::AccessFlagLL) &&
1233 (source < ArmFault::AccessFlagLL + 4)) ||
1234 ((source >= ArmFault::DomainLL) &&
1235 (source < ArmFault::DomainLL + 4)) ||
1236 ((source >= ArmFault::PermissionLL) &&
1237 (source < ArmFault::PermissionLL + 4));
1238}
1239
1240template<class T>
1241bool
1243{
1244 va = (stage2 ? OVAddr : faultAddr);
1245 return true;
1246}
1247
1250{
1251 if (to64) {
1252 // AArch64
1253 if (toEL == fromEL)
1255 else
1257 } else {
1258 // AArch32
1259 // Abort faults have different EC codes depending on whether
1260 // the fault originated within HYP mode, or not. So override
1261 // the method and add the extra adjustment of the EC value.
1262
1264
1265 CPSR spsr = tc->readMiscReg(MISCREG_SPSR_HYP);
1266 if (spsr.mode == MODE_HYP) {
1267 ec = ((ExceptionClass) (((uint32_t) ec) + 1));
1268 }
1269 return ec;
1270 }
1271}
1272
1273uint32_t
1275{
1276 ESR esr = 0;
1277 auto& iss = esr.instruction_abort_iss;
1278
1279 iss.ifsc = srcEncoded & 0x3F;
1280 iss.s1ptw = s1ptw;
1281
1282 return iss;
1283}
1284
1285bool
1287{
1288 SCR scr = tc->readMiscRegNoEffect(MISCREG_SCR_EL3);
1289 return scr.ea && !isMMUFault();
1290}
1291
1292bool
1294{
1295 bool toHyp;
1296
1297 HCR hcr = tc->readMiscRegNoEffect(MISCREG_HCR_EL2);
1298 HDCR hdcr = tc->readMiscRegNoEffect(MISCREG_HDCR);
1299
1300 toHyp = fromEL == EL2;
1301 toHyp |= ArmSystem::haveEL(tc, EL2) && !isSecure(tc) &&
1302 currEL(tc) <= EL1 && (hcr.tge || stage2 ||
1303 (source == DebugEvent && hdcr.tde));
1304 return toHyp;
1305}
1306
1309{
1310 if (to64) {
1311 // AArch64
1313 panic("Asynchronous External Abort should be handled with "
1314 "SystemErrors (SErrors)!");
1315 }
1316 if (toEL == fromEL)
1318 else
1320 } else {
1321 // AArch32
1322 // Abort faults have different EC codes depending on whether
1323 // the fault originated within HYP mode, or not. So override
1324 // the method and add the extra adjustment of the EC value.
1325
1327
1328 CPSR spsr = tc->readMiscReg(MISCREG_SPSR_HYP);
1329 if (spsr.mode == MODE_HYP) {
1330 ec = ((ExceptionClass) (((uint32_t) ec) + 1));
1331 }
1332 return ec;
1333 }
1334}
1335
1336bool
1338{
1339 return !isv? true : AbortFault<DataAbort>::il(tc);
1340}
1341
1342bool
1344{
1345 SCR scr = tc->readMiscRegNoEffect(MISCREG_SCR_EL3);
1346 return scr.ea && !isMMUFault();
1347}
1348
1349bool
1351{
1352 bool toHyp;
1353
1354 HCR hcr = tc->readMiscRegNoEffect(MISCREG_HCR_EL2);
1355 HDCR hdcr = tc->readMiscRegNoEffect(MISCREG_HDCR);
1356
1357 bool amo = hcr.amo;
1358 if (hcr.tge == 1)
1359 amo = (!HaveExt(tc, ArmExtension::FEAT_VHE) || hcr.e2h == 0);
1360
1361 // if in Hyp mode then stay in Hyp mode
1362 toHyp = fromEL == EL2 ||
1363 (EL2Enabled(tc) && fromEL <= EL1
1364 && (hcr.tge || stage2 ||
1366 ((fromEL == EL0) && hcr.tge &&
1367 ((source == AlignmentFault) ||
1369 ((source == DebugEvent) && (hdcr.tde || hcr.tge))));
1370 return toHyp;
1371}
1372
1373uint32_t
1375{
1376 ESR esr = 0;
1377 auto& iss = esr.data_abort_iss;
1378
1379 iss.dfsc = srcEncoded & 0x3F;
1380 iss.wnr = write;
1381 iss.s1ptw = s1ptw;
1382 iss.cm = cm;
1383
1384 // ISS is valid if not caused by a stage 1 page table walk, and when taken
1385 // to AArch64 only when directed to EL2
1386 if (!s1ptw && stage2 && (!to64 || toEL == EL2)) {
1387 iss.isv = isv;
1388 if (isv) {
1389 iss.sas = sas;
1390 iss.sse = sse;
1391 iss.srt = srt;
1392 // AArch64 only. These assignments are safe on AArch32 as well
1393 // because these vars are initialized to false
1394 iss.sf = sf;
1395 iss.ar = ar;
1396 }
1397 }
1398 return iss;
1399}
1400
1401void
1403{
1405 switch (id)
1406 {
1407 case SAS:
1408 isv = true;
1409 sas = val;
1410 break;
1411 case SSE:
1412 isv = true;
1413 sse = val;
1414 break;
1415 case SRT:
1416 isv = true;
1417 srt = val;
1418 break;
1419 case SF:
1420 isv = true;
1421 sf = val;
1422 break;
1423 case AR:
1424 isv = true;
1425 ar = val;
1426 break;
1427 case CM:
1428 cm = val;
1429 break;
1430 case OFA:
1431 faultAddr = val;
1432 break;
1433 // Just ignore unknown ID's
1434 default:
1435 break;
1436 }
1437}
1438
1439void
1441{
1443 HCR hcr = tc->readMiscRegNoEffect(MISCREG_HCR_EL2);
1444 hcr.va = 0;
1446}
1447
1448bool
1450{
1451 assert(ArmSystem::haveEL(tc, EL3));
1452 SCR scr = tc->readMiscRegNoEffect(MISCREG_SCR_EL3);
1453 return scr.irq;
1454}
1455
1456bool
1458{
1459 HCR hcr = tc->readMiscRegNoEffect(MISCREG_HCR_EL2);
1460 return fromEL == EL2 ||
1461 (EL2Enabled(tc) && fromEL <= EL1 && (hcr.tge || hcr.imo));
1462}
1463
1464bool
1466{
1467 if (ArmSystem::haveEL(tc, EL3)) {
1468 SCR scr = tc->readMiscRegNoEffect(MISCREG_SCR_EL3);
1469 return (!scr.ns || scr.aw);
1470 }
1471 return true;
1472}
1473
1475{}
1476
1477bool
1479{
1480 assert(ArmSystem::haveEL(tc, EL3));
1481 SCR scr = tc->readMiscRegNoEffect(MISCREG_SCR_EL3);
1482 return scr.fiq;
1483}
1484
1485bool
1487{
1488 HCR hcr = tc->readMiscRegNoEffect(MISCREG_HCR_EL2);
1489 return fromEL == EL2 ||
1490 (EL2Enabled(tc) && fromEL <= EL1 && (hcr.tge || hcr.fmo));
1491}
1492
1493bool
1495{
1496 if (ArmSystem::haveEL(tc, EL3)) {
1497 SCR scr = tc->readMiscRegNoEffect(MISCREG_SCR_EL3);
1498 return (!scr.ns || scr.aw);
1499 }
1500 return true;
1501}
1502
1503bool
1505{
1506 if (ArmSystem::haveEL(tc, EL2)) {
1507 return true;
1508 } else if (ArmSystem::haveEL(tc, EL3)) {
1509 SCR scr = tc->readMiscRegNoEffect(MISCREG_SCR_EL3);
1510 return (!scr.ns || scr.fw);
1511 }
1512 return true;
1513}
1514
1516{}
1517
1518void
1520{
1522 assert(from64);
1523 // Set the FAR
1525}
1526
1527bool
1529{
1530 HCR hcr = tc->readMiscRegNoEffect(MISCREG_HCR_EL2);
1531 return fromEL == EL2 || (EL2Enabled(tc) && fromEL <= EL1 && hcr.tge);
1532}
1533
1535{}
1536
1537bool
1539{
1540 assert(from64);
1541 HCR hcr = tc->readMiscRegNoEffect(MISCREG_HCR_EL2);
1542 return EL2Enabled(tc) && currEL(tc) <= EL1 && hcr.tge == 1;
1543}
1544
1546{}
1547
1548void
1550{
1551 tc->getCpuPtr()->clearInterrupt(tc->threadId(), INT_ABT, 0);
1552 ArmFault::invoke(tc, inst);
1553}
1554
1555bool
1557{
1558 assert(ArmSystem::haveEL(tc, EL3));
1559 assert(from64);
1560 SCR scr = tc->readMiscRegNoEffect(MISCREG_SCR_EL3);
1561 return scr.ea || fromEL == EL3;
1562}
1563
1564bool
1566{
1567 assert(from64);
1568
1569 HCR hcr = tc->readMiscRegNoEffect(MISCREG_HCR_EL2);
1570
1571 return fromEL == EL2 ||
1572 (EL2Enabled(tc) && fromEL <= EL1 && (hcr.tge || hcr.amo));
1573}
1574
1575
1577 : ArmFaultVals<SoftwareBreakpoint>(mach_inst, _iss)
1578{}
1579
1580bool
1582{
1583 const HCR hcr = tc->readMiscRegNoEffect(MISCREG_HCR_EL2);
1584 const HDCR mdcr = tc->readMiscRegNoEffect(MISCREG_MDCR_EL2);
1585
1586 return fromEL == EL2 ||
1587 (EL2Enabled(tc) && fromEL <= EL1 && (hcr.tge || mdcr.tde));
1588}
1589
1592{
1594}
1595
1597 : ArmFaultVals<HardwareBreakpoint>(0x0, _iss), vAddr(vaddr)
1598{}
1599
1600bool
1602{
1603 const HCR hcr = tc->readMiscRegNoEffect(MISCREG_HCR_EL2);
1604 const HDCR mdcr = tc->readMiscRegNoEffect(MISCREG_MDCR_EL2);
1605
1606 return EL2Enabled(tc) && fromEL <= EL1 && (hcr.tge || mdcr.tde);
1607}
1608
1611{
1612 // AArch64
1613 if (toEL == fromEL)
1615 else
1617}
1618
1619void
1621{
1622
1624 MiscRegIndex elr_idx;
1625 switch (toEL) {
1626 case EL1:
1627 elr_idx = MISCREG_ELR_EL1;
1628 break;
1629 case EL2:
1630 assert(ArmSystem::haveEL(tc, EL2));
1631 elr_idx = MISCREG_ELR_EL2;
1632 break;
1633 case EL3:
1634 assert(ArmSystem::haveEL(tc, EL3));
1635 elr_idx = MISCREG_ELR_EL3;
1636 break;
1637 default:
1638 panic("Invalid target exception level");
1639 break;
1640 }
1641
1642 tc->setMiscReg(elr_idx, vAddr);
1643
1644}
1645
1647 bool _write, bool _cm)
1648 : ArmFaultVals<Watchpoint>(mach_inst), vAddr(_vaddr),
1649 write(_write), cm(_cm)
1650{}
1651
1652uint32_t
1654{
1655 ESR esr = 0;
1656 auto& iss = esr.watchpoint_iss;
1657 iss.dfsc = 0b100010;
1658 iss.cm = cm;
1659 iss.wnr = write;
1660 return iss;
1661}
1662
1663void
1665{
1667 // Set the FAR
1669
1670}
1671
1672bool
1674{
1675 const HCR hcr = tc->readMiscRegNoEffect(MISCREG_HCR_EL2);
1676 const HDCR mdcr = tc->readMiscRegNoEffect(MISCREG_MDCR_EL2);
1677
1678 return fromEL == EL2 ||
1679 (EL2Enabled(tc) && fromEL <= EL1 && (hcr.tge || mdcr.tde));
1680}
1681
1682void
1684{
1686 switch (id)
1687 {
1688 case OFA:
1689 vAddr = val;
1690 break;
1691 // Just ignore unknown ID's
1692 default:
1693 break;
1694 }
1695}
1696
1699{
1700 // AArch64
1701 if (toEL == fromEL)
1703 else
1705}
1706
1708 bool _stepped)
1709 : ArmFaultVals<SoftwareStepFault>(mach_inst), isldx(is_ldx),
1710 stepped(_stepped)
1711{
1712 bStep = true;
1713}
1714
1715bool
1717{
1718 const HCR hcr = tc->readMiscRegNoEffect(MISCREG_HCR_EL2);
1719 const HDCR mdcr = tc->readMiscRegNoEffect(MISCREG_MDCR_EL2);
1720
1721 return fromEL == EL2 ||
1722 (EL2Enabled(tc) && fromEL <= EL1 && (hcr.tge || mdcr.tde));
1723}
1724
1727{
1728 // AArch64
1729 if (toEL == fromEL)
1731 else
1733}
1734
1735uint32_t
1737{
1738 ESR esr = 0;
1739 auto& iss = esr.software_step_iss;
1740 iss.ifsc = 0b100010;
1741 iss.isv = stepped;
1742 iss.ex = isldx;
1743 return iss;
1744}
1745
1746void
1748{
1749 DPRINTF(Faults, "Invoking ArmSev Fault\n");
1750 if (!FullSystem)
1751 return;
1752
1753 // Set sev_mailbox to 1, clear the pending interrupt from remote
1754 // SEV execution and let pipeline continue as pcState is still
1755 // valid.
1757 tc->getCpuPtr()->clearInterrupt(tc->threadId(), INT_SEV, 0);
1758}
1759
1760// Instantiate all the templates to make the linker happy
1761template class ArmFaultVals<Reset>;
1763template class ArmFaultVals<SupervisorCall>;
1764template class ArmFaultVals<SecureMonitorCall>;
1765template class ArmFaultVals<HypervisorCall>;
1766template class ArmFaultVals<PrefetchAbort>;
1767template class ArmFaultVals<DataAbort>;
1768template class ArmFaultVals<VirtualDataAbort>;
1769template class ArmFaultVals<HypervisorTrap>;
1770template class ArmFaultVals<Interrupt>;
1771template class ArmFaultVals<VirtualInterrupt>;
1772template class ArmFaultVals<FastInterrupt>;
1774template class ArmFaultVals<SupervisorTrap>;
1775template class ArmFaultVals<SecureMonitorTrap>;
1776template class ArmFaultVals<PCAlignmentFault>;
1777template class ArmFaultVals<SPAlignmentFault>;
1778template class ArmFaultVals<SystemError>;
1781template class ArmFaultVals<Watchpoint>;
1782template class ArmFaultVals<SoftwareStepFault>;
1783template class ArmFaultVals<ArmSev>;
1784template class AbortFault<PrefetchAbort>;
1785template class AbortFault<DataAbort>;
1786template class AbortFault<VirtualDataAbort>;
1787
1788
1790{}
1791
1792bool
1794{
1795 const HCR hcr = tc->readMiscRegNoEffect(MISCREG_HCR_EL2);
1796 return EL2Enabled(tc) && fromEL == EL0 && hcr.tge;
1797}
1798
1799bool
1801{
1802 auto arm_fault = dynamic_cast<ArmFault *>(fault.get());
1803
1804 if (arm_fault) {
1805 return arm_fault->getFaultVAddr(va);
1806 } else {
1807 auto pgt_fault = dynamic_cast<GenericPageTableFault *>(fault.get());
1808 if (pgt_fault) {
1809 va = pgt_fault->getFaultVAddr();
1810 return true;
1811 }
1812
1813 auto align_fault = dynamic_cast<GenericAlignmentFault *>(fault.get());
1814 if (align_fault) {
1815 va = align_fault->getFaultVAddr();
1816 return true;
1817 }
1818
1819 // Return false since it's not an address triggered exception
1820 return false;
1821 }
1822}
1823
1824} // namespace ArmISA
1825} // namespace gem5
#define DPRINTF(x,...)
Definition trace.hh:210
Addr faultAddr
The virtual address the fault occured at.
Definition faults.hh:477
void setSyndrome(ThreadContext *tc, MiscRegIndex syndrome_reg) override
Definition faults.cc:1133
uint8_t getFaultStatusCode(ThreadContext *tc) const
Definition faults.cc:1144
void annotate(ArmFault::AnnotationIDs id, uint64_t val) override
Definition faults.cc:1206
bool abortDisable(ThreadContext *tc) override
Definition faults.cc:1195
bool getFaultVAddr(Addr &va) const override
Definition faults.cc:1242
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition faults.cc:1051
FSR getFsr(ThreadContext *tc) const override
Definition faults.cc:1170
bool isMMUFault() const
Definition faults.cc:1225
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition faults.hh:304
FaultOffset offset64(ThreadContext *tc) override
Definition faults.cc:961
static FaultVals vals
Definition faults.hh:266
FaultOffset offset(ThreadContext *tc) override
Definition faults.cc:941
ExceptionLevel toEL
Definition faults.hh:75
OperatingMode toMode
Definition faults.hh:77
virtual bool routeToMonitor(ThreadContext *tc) const =0
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition faults.cc:477
MiscRegIndex getFaultAddrReg64() const
Definition faults.cc:382
virtual uint32_t iss() const =0
static uint8_t shortDescFaultSources[NumFaultSources]
Encodings of the fault sources when the short-desc.
Definition faults.hh:125
virtual bool routeToHyp(ThreadContext *tc) const
Definition faults.hh:244
void invoke32(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr)
Definition faults.cc:504
virtual uint8_t thumbPcOffset(bool is_hyp)=0
MiscRegIndex getSyndromeReg64() const
Definition faults.cc:366
virtual void annotate(AnnotationIDs id, uint64_t val)
Definition faults.hh:239
virtual Addr getVector(ThreadContext *tc)
Definition faults.cc:311
virtual bool il(ThreadContext *tc) const =0
ArmStaticInst * instrAnnotate(const StaticInstPtr &inst)
Definition faults.cc:730
virtual FaultOffset offset64(ThreadContext *tc)=0
virtual bool abortDisable(ThreadContext *tc)=0
void update(ThreadContext *tc)
Definition faults.cc:428
static uint8_t longDescFaultSources[NumFaultSources]
Encodings of the fault sources when the long-desc.
Definition faults.hh:128
void invoke64(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr)
Definition faults.cc:634
virtual uint8_t armPcOffset(bool is_hyp)=0
virtual uint8_t thumbPcElrOffset()=0
ExtMachInst machInst
Definition faults.hh:67
virtual bool fiqDisable(ThreadContext *tc)=0
virtual bool getFaultVAddr(Addr &va) const
Definition faults.hh:258
static uint8_t aarch64FaultSources[NumFaultSources]
Encodings of the fault sources in AArch64 state.
Definition faults.hh:130
ExceptionLevel fromEL
Definition faults.hh:74
virtual uint8_t armPcElrOffset()=0
virtual OperatingMode nextMode()=0
Addr getVector64(ThreadContext *tc)
Definition faults.cc:343
virtual void setSyndrome(ThreadContext *tc, MiscRegIndex syndrome_reg)
Definition faults.cc:398
OperatingMode fromMode
Definition faults.hh:76
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition faults.cc:1747
virtual void annotateFault(ArmFault *fault)
MachInst encoding() const
Returns the real encoding of the instruction: the machInst field is in fact always 64 bit wide and co...
bool routeToHyp(ThreadContext *tc) const override
Definition faults.cc:1350
uint32_t iss() const override
Definition faults.cc:1374
void annotate(AnnotationIDs id, uint64_t val) override
Definition faults.cc:1402
bool il(ThreadContext *tc) const override
Definition faults.cc:1337
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition faults.cc:1308
bool routeToMonitor(ThreadContext *tc) const override
Definition faults.cc:1343
bool fiqDisable(ThreadContext *tc) override
Definition faults.cc:1504
bool abortDisable(ThreadContext *tc) override
Definition faults.cc:1494
bool routeToMonitor(ThreadContext *tc) const override
Definition faults.cc:1478
bool routeToHyp(ThreadContext *tc) const override
Definition faults.cc:1486
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition faults.cc:1620
bool routeToHyp(ThreadContext *tc) const override
Definition faults.cc:1601
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition faults.cc:1610
HardwareBreakpoint(Addr _vaddr, uint32_t _iss)
Definition faults.cc:1596
bool routeToMonitor(ThreadContext *tc) const override
Definition faults.cc:916
HypervisorCall(ExtMachInst mach_inst, uint32_t _imm)
Definition faults.cc:909
bool routeToHyp(ThreadContext *tc) const override
Definition faults.cc:922
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition faults.cc:928
ExceptionClass overrideEc
Definition faults.hh:454
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition faults.cc:934
bool routeToHyp(ThreadContext *tc) const override
Definition faults.cc:1793
bool abortDisable(ThreadContext *tc) override
Definition faults.cc:1465
bool routeToHyp(ThreadContext *tc) const override
Definition faults.cc:1457
bool routeToMonitor(ThreadContext *tc) const override
Definition faults.cc:1449
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition faults.cc:1519
bool routeToHyp(ThreadContext *tc) const override
Definition faults.cc:1528
Addr faultPC
The unaligned value of the PC.
Definition faults.hh:631
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition faults.cc:1249
uint32_t iss() const override
Definition faults.cc:1274
bool routeToHyp(ThreadContext *tc) const override
Definition faults.cc:1293
bool routeToMonitor(ThreadContext *tc) const override
Definition faults.cc:1286
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition faults.cc:760
Addr getVector(ThreadContext *tc) override
Definition faults.cc:742
bool routeToHyp(ThreadContext *tc) const override
Definition faults.cc:1538
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition faults.cc:1011
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition faults.cc:1002
uint32_t iss() const override
Definition faults.cc:890
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition faults.cc:1043
Software Breakpoint (AArch64 only)
Definition faults.hh:670
bool routeToHyp(ThreadContext *tc) const override
Definition faults.cc:1581
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition faults.cc:1591
SoftwareBreakpoint(ExtMachInst mach_inst, uint32_t _iss)
Definition faults.cc:1576
bool routeToHyp(ThreadContext *tc) const override
Definition faults.cc:1716
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition faults.cc:1726
uint32_t iss() const override
Definition faults.cc:1736
SoftwareStepFault(ExtMachInst mach_inst, bool is_ldx, bool stepped)
Definition faults.cc:1707
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition faults.cc:848
ExceptionClass overrideEc
Definition faults.hh:362
bool routeToHyp(ThreadContext *tc) const override
Definition faults.cc:867
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition faults.cc:875
uint32_t iss() const override
Definition faults.cc:882
bool routeToHyp(ThreadContext *tc) const override
Definition faults.cc:1017
ExceptionClass overrideEc
Definition faults.hh:404
uint32_t iss() const override
Definition faults.cc:1024
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition faults.cc:1034
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition faults.cc:1549
bool routeToMonitor(ThreadContext *tc) const override
Definition faults.cc:1556
bool routeToHyp(ThreadContext *tc) const override
Definition faults.cc:1565
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition faults.cc:788
bool routeToHyp(ThreadContext *tc) const override
Definition faults.cc:811
uint32_t iss() const override
Definition faults.cc:819
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition faults.cc:898
void invoke(ThreadContext *tc, const StaticInstPtr &inst) override
Definition faults.cc:1440
Watchpoint(ExtMachInst mach_inst, Addr vaddr, bool _write, bool _cm)
Definition faults.cc:1646
bool routeToHyp(ThreadContext *tc) const override
Definition faults.cc:1673
void annotate(AnnotationIDs id, uint64_t val) override
Definition faults.cc:1683
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition faults.cc:1698
uint32_t iss() const override
Definition faults.cc:1653
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition faults.cc:1664
bool highestELIs64() const
Returns true if the register width of the highest implemented exception level is 64 bits (ARMv8)
Definition system.hh:187
Addr resetAddr() const
Returns the reset address if the highest implemented exception level is 64 bits (ARMv8)
Definition system.hh:202
static bool haveEL(ThreadContext *tc, ArmISA::ExceptionLevel el)
Return true if the system implements a specific exception level.
Definition system.cc:132
void clearInterrupts(ThreadID tid)
Definition base.hh:248
void clearInterrupt(ThreadID tid, int int_num, int index)
Definition base.hh:242
virtual FaultName name() const =0
virtual void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr)
Definition faults.cc:58
Target & as()
Definition pcstate.hh:72
Addr instAddr() const
Returns the memory address of the instruction this PC points to.
Definition pcstate.hh:107
T * get() const
Directly access the pointer itself without taking a reference.
Definition refcnt.hh:227
virtual void advancePC(PCStateBase &pc_state) const =0
Workload * workload
OS kernel.
Definition system.hh:326
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual RegVal readMiscReg(RegIndex misc_reg)=0
virtual void setMiscReg(RegIndex misc_reg, RegVal val)=0
virtual RegVal getReg(const RegId &reg) const
virtual void setMiscRegNoEffect(RegIndex misc_reg, RegVal val)=0
virtual System * getSystemPtr()=0
virtual void clearArchRegs()=0
virtual BaseCPU * getCpuPtr()=0
virtual void setReg(const RegId &reg, RegVal val)
virtual const PCStateBase & pcState() const =0
virtual int threadId() const =0
virtual RegVal readMiscRegNoEffect(RegIndex misc_reg) const =0
virtual void syscall(ThreadContext *tc)
Definition workload.hh:111
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
#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
constexpr RegId V
Definition cc.hh:96
constexpr RegId C
Definition cc.hh:95
constexpr RegId Ge
Definition cc.hh:97
constexpr RegId Nz
Definition cc.hh:94
constexpr auto & Lr
Definition int.hh:275
bool ELIs32(ThreadContext *tc, ExceptionLevel el)
Definition utility.cc:273
@ MODE_UNDEFINED
Definition types.hh:295
static bool opModeIsT(OperatingMode mode)
Definition types.hh:384
bool getFaultVAddr(Fault fault, Addr &va)
Returns true if the fault passed as a first argument was triggered by a memory access,...
Definition faults.cc:1800
void syncVecRegsToElems(ThreadContext *tc)
Definition utility.cc:1325
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< 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
const uint32_t HighVecs
Definition faults.cc:63
bool isSecure(ThreadContext *tc)
Definition utility.cc:74
bool longDescFormatInUse(ThreadContext *tc)
Definition utility.cc:131
Bitfield< 20 > il
Definition misc_types.hh:61
Bitfield< 23, 0 > offset
Definition types.hh:144
Bitfield< 7, 4 > domain
bool ELIs64(ThreadContext *tc, ExceptionLevel el)
Definition utility.cc:267
ConditionCode
Definition cc.hh:104
@ COND_UC
Definition cc.hh:120
@ COND_AL
Definition cc.hh:119
bool EL2Enabled(ThreadContext *tc)
Definition utility.cc:258
Bitfield< 55, 48 > itstate
Definition types.hh:70
Bitfield< 7 > s1ptw
@ MISCREG_SCTLR_EL2
Definition misc.hh:589
@ MISCREG_SPSR_HYP
Definition misc.hh:73
@ MISCREG_VBAR_EL3
Definition misc.hh:764
@ MISCREG_SPSR_EL2
Definition misc.hh:631
@ MISCREG_LOCKFLAG
Definition misc.hh:88
@ MISCREG_SCTLR
Definition misc.hh:240
@ MISCREG_SCR_EL3
Definition misc.hh:599
@ MISCREG_SPSR_SVC
Definition misc.hh:70
@ MISCREG_DBGDSCRext
Definition misc.hh:108
@ MISCREG_HDCR
Definition misc.hh:255
@ MISCREG_ESR_EL1
Definition misc.hh:645
@ MISCREG_TTBCR_NS
Definition misc.hh:266
@ MISCREG_VMPIDR
Definition misc.hh:239
@ MISCREG_SPSR_UND
Definition misc.hh:74
@ MISCREG_SPSR_IRQ
Definition misc.hh:69
@ MISCREG_SPSR_ABT
Definition misc.hh:72
@ MISCREG_SCTLR_EL1
Definition misc.hh:584
@ MISCREG_FAR_EL1
Definition misc.hh:655
@ MISCREG_ELR_HYP
Definition misc.hh:75
@ MISCREG_CPSR
Definition misc.hh:66
@ MISCREG_SEV_MAILBOX
Definition misc.hh:96
@ MISCREG_ELR_EL2
Definition misc.hh:632
@ MISCREG_HPFAR
Definition misc.hh:296
@ MISCREG_SPSR_EL3
Definition misc.hh:638
@ MISCREG_ESR_EL3
Definition misc.hh:654
@ MISCREG_SPSR_EL1
Definition misc.hh:618
@ MISCREG_HCR_EL2
Definition misc.hh:591
@ MISCREG_ELR_EL3
Definition misc.hh:639
@ MISCREG_FAR_EL3
Definition misc.hh:659
@ MISCREG_VBAR_EL2
Definition misc.hh:762
@ MISCREG_HPFAR_EL2
Definition misc.hh:658
@ MISCREG_MDCR_EL2
Definition misc.hh:593
@ MISCREG_VBAR
Definition misc.hh:396
@ MISCREG_VBAR_EL1
Definition misc.hh:758
@ MISCREG_HVBAR
Definition misc.hh:402
@ MISCREG_ELR_EL1
Definition misc.hh:620
@ MISCREG_SPSR_MON
Definition misc.hh:71
@ MISCREG_HSCTLR
Definition misc.hh:251
@ MISCREG_TTBCR_S
Definition misc.hh:267
@ MISCREG_HSR
Definition misc.hh:287
@ MISCREG_FAR_EL2
Definition misc.hh:657
@ MISCREG_MVBAR
Definition misc.hh:399
@ MISCREG_ESR_EL2
Definition misc.hh:650
@ MISCREG_SPSR_FIQ
Definition misc.hh:68
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
static ExceptionLevel opModeToEL(OperatingMode mode)
Definition types.hh:391
Bitfield< 13 > cm
Bitfield< 5 > amo
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
Addr FaultOffset
Definition faults.hh:60
Bitfield< 8 > va
Bitfield< 4 > pc
GenericISA::DelaySlotPCState< 4 > PCState
Definition pcstate.hh:40
Bitfield< 51, 12 > base
Definition pagetable.hh:141
Bitfield< 63 > val
Definition misc.hh:776
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
std::shared_ptr< FaultBase > Fault
Definition types.hh:249
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
std::string csprintf(const char *format, const Args &...args)
Definition cprintf.hh:161
Overload hash function for BasicBlockRange type.
Definition misc.hh:2910
const ExceptionClass ec
Definition faults.hh:194

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