Skip to content

Commit 0789cbc

Browse files
committed
Move field descriptions to a config file.
1 parent 97756fe commit 0789cbc

5 files changed

Lines changed: 191 additions & 159 deletions

File tree

Cargo.lock

Lines changed: 78 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generate-sysregs/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ clap = { version = "4.5.51", features = ["derive"] }
1616
eyre = "0.6.12"
1717
log = "0.4.28"
1818
pretty_env_logger = "0.5.0"
19+
serde = { version = "1.0.228", features = ["derive"] }
1920
serde_json = "1.0.145"
21+
toml = "0.9.8"

generate-sysregs/registers.toml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
[registers.ICC_SRE_EL2]
2+
3+
[registers.SCR_EL3.field_descriptions]
4+
NS = "Non-secure."
5+
IRQ = "Take physical IRQs at EL3."
6+
FIQ = "Take physical FIQs at EL3."
7+
EA = "Take external abort and SError exceptions at EL3."
8+
SMD = "Disable SMC instructions."
9+
HCE = "Enable HVC instructions."
10+
SIF = "Disable execution from non-secure memory."
11+
RW = "Enable AArch64 in lower ELs."
12+
ST = "Trap physical secure timer to EL3."
13+
TWI = "Trap WFI to EL3."
14+
TWE = "Trap WFE to EL3."
15+
TLOR = "Trap LOR register access to EL3."
16+
TERR = "Trap error record register access to EL3."
17+
APK = "Don't trap PAC key registers to EL3."
18+
API = "Don't trap PAuth instructions to EL3."
19+
EEL2 = "Enable Secure EL2."
20+
EASE = "Synchronous external aborts are taken as SErrors."
21+
NMEA = "Take SError exceptions at EL3."
22+
FIEN = "Enable fault injection at lower ELs."
23+
TID3 = "Trap ID group 3 registers to EL3."
24+
TID5 = "Trap ID group 5 register to EL3."
25+
EnSCXT = "Enable SCXT at lower ELs."
26+
ATA = "Enable memory tagging at lower ELs."
27+
FGTEn = "Enable fine-grained traps to EL2."
28+
ECVEn = "Enable access to CNTPOFF_EL2."
29+
TWEDEn = "Enable a configurable delay for WFE traps."
30+
TME = "Enable access to TME at lower ELs."
31+
AMVOFFEN = "Enable acivity monitors virtual offsets."
32+
EnAS0 = "Enable ST64BV0 at lower ELs."
33+
ADEn = "Enable ACCDATA_EL1 at lower ELs."
34+
HXEn = "Enable HCRX_EL2."
35+
GCSEn = "Enable gaurded control stack."
36+
TRNDR = "Trap RNDR and RNDRRS to EL3."
37+
EnTP2 = "Enable TPIDR2_EL0 at lower ELs."
38+
RCWMASKEn = "Enable RCW and RCWS mask registers at lower ELs."
39+
TCR2En = "Enable TCR2_ELx registers at lower ELs."
40+
SCTLR2En = "Enable SCTLR2_ELx rogisters at lower ELs."
41+
PIEn = "Enable permission indirection and overlay registers at lower ELs."
42+
AIEn = "Enable MAIR2_ELx and AMAIR2_ELx at lower ELs."
43+
D128En = "Enable 128-bit system registers at lower ELs."
44+
GPF = "Route GPFs to EL3."
45+
MECEn = "Enable MECID registers at EL2."
46+
EnFPM = "Enable access to FPMR at lower ELs."
47+
TMEA = "Take synchronous external abort and physical SError exception to EL3."
48+
TWERR = "Trap writes to Error Record registers to EL3."
49+
PFAREn = "Enable access to physical fault address registers at lower ELs."
50+
SRMASKEn = "Enable access to mask registers at lower ELs."
51+
EnIDCP128 = "Enable implementation-defined 128-bit system registers."
52+
DSE = "A delegated SError exception is pending."
53+
EnDSE = "Enable delegated SError exceptions."
54+
FGTEn2 = "Enable fine-grained traps to EL2."
55+
HDBSSEn = "Enable HDBSSBR_EL2 and HDBSSPROD_EL2 registers at EL2."
56+
HACDBSEn = "Enable HACDBSBR_EL2 and HACDBSCONS_EL2 registers at EL2."
57+
NSE = "Non-secure realm world bit."
58+
59+
[registers.CLIDR_EL1.field_descriptions]
60+
LoC = "Level of Coherence for the cache hierarchy."

generate-sysregs/src/config.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2025 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
use serde::{Deserialize, Serialize};
16+
use std::collections::BTreeMap;
17+
18+
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
19+
#[serde(deny_unknown_fields)]
20+
pub struct Config {
21+
pub registers: BTreeMap<String, RegisterConfig>,
22+
}
23+
24+
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
25+
#[serde(deny_unknown_fields)]
26+
pub struct RegisterConfig {
27+
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
28+
pub field_descriptions: BTreeMap<String, String>,
29+
}

0 commit comments

Comments
 (0)