Skip to content

Commit 8d753b3

Browse files
authored
Merge pull request #60 from kisum9/complete-EC-field
Complete EC field
2 parents aa94403 + bc4cd0e commit 8d753b3

File tree

2 files changed

+176
-70
lines changed

2 files changed

+176
-70
lines changed

src/registers/esr_el1.rs

Lines changed: 82 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
// SPDX-License-Identifier: Apache-2.0 OR MIT
22
//
3-
// Copyright (c) 2018-2023 by the author(s)
3+
// Copyright (c) 2018-2025 by the author(s)
44
//
55
// Author(s):
66
// - Andre Richter <[email protected]>
77
// - Berkus Decker <[email protected]>
8+
// - Yan Tan <[email protected]>
89

910
//! Exception Syndrome Register - EL1
1011
//!
@@ -24,43 +25,89 @@ register_bitfields! {u64,
2425
/// - The cause of the exception, for example the configuration required to enable the
2526
/// trap.
2627
/// - The encoding of the associated ISS.
27-
///
28-
/// Incomplete listing - to be done.
2928
EC OFFSET(26) NUMBITS(6) [
30-
Unknown = 0b00_0000,
31-
TrappedWFIorWFE = 0b00_0001,
32-
TrappedMCRorMRC = 0b00_0011, // A32
33-
TrappedMCRRorMRRC = 0b00_0100, // A32
34-
TrappedMCRorMRC2 = 0b00_0101, // A32
35-
TrappedLDCorSTC = 0b00_0110, // A32
36-
TrappedFP = 0b00_0111,
37-
TrappedMRRC = 0b00_1100, // A32
38-
BranchTarget = 0b00_1101,
29+
/// Unknown reason
30+
Unknown = 0b00_0000,
31+
/// Trapped WF* instruction execution
32+
TrappedWFIorWFE = 0b00_0001,
33+
/// Trapped MCR or MRC access with (coproc==0b1111) (FEAT_AA32)
34+
TrappedMCRorMRC = 0b00_0011,
35+
/// Trapped MCRR or MRRC access with (coproc==0b1111) (FEAT_AA32)
36+
TrappedMCRRorMRRC = 0b00_0100,
37+
/// Trapped MCR or MRC access with (coproc==0b1110) (FEAT_AA32)
38+
TrappedMCRorMRC2 = 0b00_0101,
39+
/// Trapped LDC or STC access (FEAT_AA32)
40+
TrappedLDCorSTC = 0b00_0110,
41+
/// Access to SME, SVE, Advanced SIMD or floating-point functionality trapped
42+
TrappedFP = 0b00_0111,
43+
/// Trapped execution of any instruction not covered by other EC values (FEAT_LS64)
44+
TrappedNotCovered = 0b00_1010,
45+
/// Trapped MRRC access with (coproc==0b1110) (FEAT_AA32)
46+
TrappedMRRC = 0b00_1100,
47+
/// Branch Target Exception (FEAT_BTI)
48+
BranchTarget = 0b00_1101,
49+
/// Illegal Execution state (FEAT_BTI)
3950
IllegalExecutionState = 0b00_1110,
40-
SVC32 = 0b01_0001, // A32
41-
SVC64 = 0b01_0101,
42-
HVC64 = 0b01_0110,
43-
SMC64 = 0b01_0111,
44-
TrappedMsrMrs = 0b01_1000,
45-
TrappedSve = 0b01_1001,
46-
PointerAuth = 0b01_1100,
47-
InstrAbortLowerEL = 0b10_0000,
48-
InstrAbortCurrentEL = 0b10_0001,
49-
PCAlignmentFault = 0b10_0010,
50-
DataAbortLowerEL = 0b10_0100,
51-
DataAbortCurrentEL = 0b10_0101,
52-
SPAlignmentFault = 0b10_0110,
53-
TrappedFP32 = 0b10_1000, // A32
54-
TrappedFP64 = 0b10_1100,
55-
SError = 0b10_1111,
56-
BreakpointLowerEL = 0b11_0000,
57-
BreakpointCurrentEL = 0b11_0001,
58-
SoftwareStepLowerEL = 0b11_0010,
51+
/// SVC instruction execution in AArch32 state (FEAT_AA32)
52+
SVC32 = 0b01_0001,
53+
/// Trapped MSRR, MRRS or System instruction execution in AArch64 state (FEAT_SYSREG128/FEAT_SYSINSTR128)
54+
TrappedMSRR_MRRS = 0b01_0100,
55+
/// SVC instruction execution in AArch64 state
56+
SVC64 = 0b01_0101,
57+
/// HVC instruction execution in AArch64 state
58+
HVC64 = 0b01_0110,
59+
/// SMC instruction execution in AArch64 state
60+
SMC64 = 0b01_0111,
61+
/// Trapped MSR, MRS or System instruction execution in AArch64 state
62+
TrappedMsrMrs = 0b01_1000,
63+
/// Access to SVE functionality trapped (FEAT_SVE)
64+
TrappedSve = 0b01_1001,
65+
/// Exception from TSTART instruction (FEAT_TME)
66+
TrappedTSTART = 0b01_1011,
67+
/// Exception from a PAC Fail (FEAT_FPAC)
68+
PointerAuth = 0b01_1100,
69+
/// Access to SME functionality trapped (FEAT_SME)
70+
TrappedSME = 0b01_1101,
71+
/// Instruction Abort from a lower Exception level
72+
InstrAbortLowerEL = 0b10_0000,
73+
/// Instruction Abort taken without a change in Exception level
74+
InstrAbortCurrentEL = 0b10_0001,
75+
/// PC alignment fault exception
76+
PCAlignmentFault = 0b10_0010,
77+
/// Data Abort exception from a lower Exception level
78+
DataAbortLowerEL = 0b10_0100,
79+
/// Data Abort exception without a change in Exception level
80+
DataAbortCurrentEL = 0b10_0101,
81+
/// SP alignment fault exception
82+
SPAlignmentFault = 0b10_0110,
83+
/// Memory Operation Exception (FEAT_MOPS)
84+
MemoryOperationException = 0b10_0111,
85+
/// Trapped floating-point exception taken from AArch32 state (FEAT_AA32)
86+
TrappedFP32 = 0b10_1000,
87+
/// Trapped floating-point exception taken from AArch64 state
88+
TrappedFP64 = 0b10_1100,
89+
/// GCS exception (FEAT_GCS)
90+
GCSException = 0b10_1101,
91+
/// SError exception
92+
SError = 0b10_1111,
93+
/// Breakpoint exception from a lower Exception level
94+
BreakpointLowerEL = 0b11_0000,
95+
/// Breakpoint exception taken without a change in Exception level
96+
BreakpointCurrentEL = 0b11_0001,
97+
/// Software Step exception from a lower Exception level
98+
SoftwareStepLowerEL = 0b11_0010,
99+
/// Software Step exception taken without a change in Exception level
59100
SoftwareStepCurrentEL = 0b11_0011,
60-
WatchpointLowerEL = 0b11_0100,
61-
WatchpointCurrentEL = 0b11_0101,
62-
Bkpt32 = 0b11_1000, // A32 BKTP instruction
63-
Brk64 = 0b11_1100 // A64 BRK instruction
101+
/// Watchpoint exception from a lower Exception level
102+
WatchpointLowerEL = 0b11_0100,
103+
/// Watchpoint exception taken without a change in Exception level
104+
WatchpointCurrentEL = 0b11_0101,
105+
/// BKPT instruction execution in AArch32 state (FEAT_AA32)
106+
Bkpt32 = 0b11_1000,
107+
/// BRK instruction execution in AArch64 state
108+
Brk64 = 0b11_1100,
109+
/// Profiling exception (FEAT_EBEP/FEAT_SPE_EXC/FEAT_TRBE_EXC)
110+
ProfilingException = 0b11_1101
64111
],
65112

66113
/// Instruction Length for synchronous exceptions.

src/registers/esr_el2.rs

Lines changed: 94 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
// SPDX-License-Identifier: Apache-2.0 OR MIT
22
//
3-
// Copyright (c) 2018-2023 by the author(s)
3+
// Copyright (c) 2018-2025 by the author(s)
44
//
55
// Author(s):
66
// - Andre Richter <[email protected]>
77
// - Berkus Decker <[email protected]>
88
// - Bradley Landherr <[email protected]>
9+
// - Yan Tan <[email protected]>
910

1011
//! Exception Syndrome Register - EL2
1112
//!
@@ -36,43 +37,101 @@ register_bitfields! {u64,
3637
/// - The cause of the exception, for example the configuration required to enable the
3738
/// trap.
3839
/// - The encoding of the associated ISS.
39-
///
40-
/// Incomplete listing - to be done.
4140
EC OFFSET(26) NUMBITS(6) [
42-
Unknown = 0b00_0000,
43-
TrappedWFIorWFE = 0b00_0001,
44-
TrappedMCRorMRC = 0b00_0011, // A32
45-
TrappedMCRRorMRRC = 0b00_0100, // A32
46-
TrappedMCRorMRC2 = 0b00_0101, // A32
47-
TrappedLDCorSTC = 0b00_0110, // A32
48-
TrappedFP = 0b00_0111,
49-
TrappedMRRC = 0b00_1100, // A32
50-
BranchTarget = 0b00_1101,
41+
/// Unknown reason
42+
Unknown = 0b00_0000,
43+
/// Trapped WF* instruction execution
44+
TrappedWFIorWFE = 0b00_0001,
45+
/// Trapped MCR or MRC access with (coproc==0b1111) (FEAT_AA32)
46+
TrappedMCRorMRC = 0b00_0011,
47+
/// Trapped MCRR or MRRC access with (coproc==0b1111) (FEAT_AA32)
48+
TrappedMCRRorMRRC = 0b00_0100,
49+
/// Trapped MCR or MRC access with (coproc==0b1110) (FEAT_AA32)
50+
TrappedMCRorMRC2 = 0b00_0101,
51+
/// Trapped LDC or STC access (FEAT_AA32)
52+
TrappedLDCorSTC = 0b00_0110,
53+
/// Access to SME, SVE, Advanced SIMD or floating-point functionality trapped
54+
TrappedFP = 0b00_0111,
55+
/// Trapped VMRS access, from ID group trap (FEAT_AA32)
56+
TrappedVMRS = 0b00_1000,
57+
/// Trapped use of a Pointer authentication instruction (FEAT_PAuth)
58+
TrappedPointerAuth = 0b00_1001,
59+
/// Trapped execution of any instruction not covered by other EC values (FEAT_LS64/FEAT_SPEv1p5/FEAT_TRBEv1p1)
60+
TrappedNotCovered = 0b00_1010,
61+
/// Trapped MRRC access with (coproc==0b1110) (FEAT_AA32)
62+
TrappedMRRC = 0b00_1100,
63+
/// Branch Target Exception (FEAT_BTI)
64+
BranchTarget = 0b00_1101,
65+
/// Illegal Execution state
5166
IllegalExecutionState = 0b00_1110,
52-
SVC32 = 0b01_0001, // A32
53-
SVC64 = 0b01_0101,
54-
HVC64 = 0b01_0110,
55-
SMC64 = 0b01_0111,
56-
TrappedMsrMrs = 0b01_1000,
57-
TrappedSve = 0b01_1001,
58-
PointerAuth = 0b01_1100,
59-
InstrAbortLowerEL = 0b10_0000,
60-
InstrAbortCurrentEL = 0b10_0001,
61-
PCAlignmentFault = 0b10_0010,
62-
DataAbortLowerEL = 0b10_0100,
63-
DataAbortCurrentEL = 0b10_0101,
64-
SPAlignmentFault = 0b10_0110,
65-
TrappedFP32 = 0b10_1000, // A32
66-
TrappedFP64 = 0b10_1100,
67-
SError = 0b10_1111,
68-
BreakpointLowerEL = 0b11_0000,
69-
BreakpointCurrentEL = 0b11_0001,
70-
SoftwareStepLowerEL = 0b11_0010,
67+
/// SVC instruction execution in AArch32 state (FEAT_AA32)
68+
SVC32 = 0b01_0001,
69+
/// HVC instruction execution in AArch32 state (FEAT_AA32)
70+
HVC32 = 0b01_0010,
71+
/// SMC instruction execution in AArch32 state (FEAT_AA32)
72+
SMC32 = 0b01_0011,
73+
/// Trapped MSRR, MRRS or System instruction execution in AArch64 state (FEAT_SYSREG128/FEAT_SYSINSTR128)
74+
TrappedMSRR_MRRS = 0b01_0100,
75+
/// SVC instruction execution in AArch64 state (FEAT_AA64)
76+
SVC64 = 0b01_0101,
77+
/// HVC instruction execution in AArch64 state (FEAT_AA64)
78+
HVC64 = 0b01_0110,
79+
/// SMC instruction execution in AArch64 state (FEAT_AA64)
80+
SMC64 = 0b01_0111,
81+
/// Trapped MSR, MRS or System instruction execution in AArch64 state (FEAT_AA64)
82+
TrappedMsrMrs = 0b01_1000,
83+
/// Access to SVE functionality trapped (FEAT_SVE)
84+
TrappedSve = 0b01_1001,
85+
/// Trapped ERET, ERETAA, or ERETAB instruction execution (FEAT_FGT/FEAT_NV)
86+
TrappedERET = 0b01_1010,
87+
/// Exception from TSTART instruction (FEAT_TME)
88+
TrappedTSTART = 0b01_1011,
89+
/// Exception from a PAC Fail (FEAT_FPAC)
90+
PointerAuth = 0b01_1100,
91+
/// Access to SME functionality trapped (FEAT_SME)
92+
TrappedSME = 0b01_1101,
93+
/// Instruction Abort from a lower Exception level
94+
InstrAbortLowerEL = 0b10_0000,
95+
/// Instruction Abort taken without a change in Exception level
96+
InstrAbortCurrentEL = 0b10_0001,
97+
/// PC alignment fault exception
98+
PCAlignmentFault = 0b10_0010,
99+
/// Data Abort exception from a lower Exception level
100+
DataAbortLowerEL = 0b10_0100,
101+
/// Data Abort exception without a change in Exception level
102+
DataAbortCurrentEL = 0b10_0101,
103+
/// SP alignment fault exception
104+
SPAlignmentFault = 0b10_0110,
105+
/// Memory Operation Exception (FEAT_MOPS)
106+
MemoryOperationException = 0b10_0111,
107+
/// Trapped floating-point exception taken from AArch32 state (FEAT_AA32)
108+
TrappedFP32 = 0b10_1000,
109+
/// Trapped floating-point exception taken from AArch64 state (FEAT_AA64)
110+
TrappedFP64 = 0b10_1100,
111+
/// GCS exception (FEAT_GCS)
112+
GCSException = 0b10_1101,
113+
/// SError exception
114+
SError = 0b10_1111,
115+
/// Breakpoint exception from a lower Exception level
116+
BreakpointLowerEL = 0b11_0000,
117+
/// Breakpoint exception taken without a change in Exception level
118+
BreakpointCurrentEL = 0b11_0001,
119+
/// Software Step exception from a lower Exception level
120+
SoftwareStepLowerEL = 0b11_0010,
121+
/// Software Step exception taken without a change in Exception level
71122
SoftwareStepCurrentEL = 0b11_0011,
72-
WatchpointLowerEL = 0b11_0100,
73-
WatchpointCurrentEL = 0b11_0101,
74-
Bkpt32 = 0b11_1000, // A32 BKTP instruction
75-
Brk64 = 0b11_1100 // A64 BRK instruction
123+
/// Watchpoint exception from a lower Exception level
124+
WatchpointLowerEL = 0b11_0100,
125+
/// Watchpoint exception taken without a change in Exception level
126+
WatchpointCurrentEL = 0b11_0101,
127+
/// BKPT instruction execution in AArch32 state (FEAT_AA32)
128+
Bkpt32 = 0b11_1000,
129+
/// Vector Catch exception from AArch32 state (FEAT_AA32)
130+
VectorCatch32 = 0b11_1010,
131+
/// BRK instruction execution in AArch64 state (FEAT_AA64)
132+
Brk64 = 0b11_1100,
133+
/// Profiling exception (FEAT_EBEP/FEAT_SPE_EXC/FEAT_TRBE_EXC)
134+
ProfilingException = 0b11_1101
76135
],
77136

78137
/// Instruction Length for synchronous exceptions.

0 commit comments

Comments
 (0)