Skip to content

Commit 881c2b4

Browse files
addressed the concerns so far.
1 parent faa3aba commit 881c2b4

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

spec/std/isa/csr/mseccfg.yaml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,27 +80,41 @@ fields:
8080
8181
*Locked rules cannot be removed or modified until a PMP reset, unless mseccfg.RLB is set.
8282
type(): |
83-
if (MSECCFG_MML_TYPE == "read-only-0" || MSECCFG_MML_TYPE == "read-only-1") {
83+
if ((MSECCFG_MML_TYPE == "read-only-0") || (MSECCFG_MML_TYPE == "read-only-1")) {
8484
return CsrFieldType::RO;
8585
} else if (MSECCFG_MML_TYPE == "sticky") {
8686
return CsrFieldType::RW-R; // restricted: 0→1 allowed, 1→0 not allowed
8787
}
88-
sw_write(csr_value): return csr_value.MML | CSR[mseccfg].MML;
89-
reset_value: UNDEFINED_LEGAL
88+
sw_write(csr_value): |
89+
return (MSECCFG_MML_TYPE == "read-only-1") ? 1 : (csr_value.MML | CSR[mseccfg].MML);
90+
reset_value(): |
91+
if ((MSECCFG_MML_TYPE == "read-only-0") || (MSECCFG_MML_TYPE == "sticky")) {
92+
return 0;
93+
} else if (MSECCFG_MML_TYPE == "read-only-1") {
94+
return 1;
95+
}
96+
return UNDEFINED_LEGAL;
9097
MMWP:
9198
location: 1
9299
definedBy: Smepmp
93100
description: |
94101
Machine-Mode Allowlist Policy (mseccfg.MMWP) is a sticky bit, meaning that once set it cannot be unset until a PMP reset. When set it
95102
changes the default PMP policy for M-mode when accessing memory regions that don't have a matching PMP rule, to denied instead of ignored.
96103
type(): |
97-
if (MSECCFG_MML_TYPE == "read-only-0" || MSECCFG_MML_TYPE == "read-only-1") {
104+
if ((MSECCFG_MMWP_TYPE == "read-only-0") || (MSECCFG_MMWP_TYPE == "read-only-1")) {
98105
return CsrFieldType::RO;
99-
} else if (MSECCFG_MML_TYPE == "sticky") {
106+
} else if (MSECCFG_MMWP_TYPE == "sticky") {
100107
return CsrFieldType::RW-R; // restricted: 0→1 allowed, 1→0 not allowed
101108
}
102-
sw_write(csr_value): return csr_value.MMWP | CSR[mseccfg].MMWP;
103-
reset_value: UNDEFINED_LEGAL
109+
sw_write(csr_value): |
110+
return (MSECCFG_MMWP_TYPE == "read-only-1") ? 1 : (csr_value.MMWP | CSR[mseccfg].MMWP);
111+
reset_value(): |
112+
if ((MSECCFG_MMWP_TYPE == "read-only-0") || (MSECCFG_MMWP_TYPE == "sticky")) {
113+
return 0;
114+
} else if (MSECCFG_MMWP_TYPE == "read-only-1") {
115+
return 1;
116+
}
117+
return UNDEFINED_LEGAL;
104118
RLB:
105119
location: 2
106120
description: |
@@ -113,4 +127,5 @@ fields:
113127
type(): |
114128
return MUTABLE_MSECCFG_RLB ? CsrFieldType::RW : CsrFieldType:RO;
115129
definedBy: Smepmp
116-
reset_value: UNDEFINED_LEGAL
130+
reset_value(): |
131+
return MUTABLE_MSECCFG_RLB ? 0 : UNDEFINED_LEGAL;

spec/std/isa/ext/Smepmp.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ description: |
158158
params:
159159
MSECCFG_MML_TYPE:
160160
schema:
161+
type: string
161162
enum: [read-only-0, read-only-1, sticky]
162163
description: |
163164
Determines the behavior of the mseccfg.MML bit:
@@ -167,6 +168,7 @@ params:
167168
* "sticky": Bit resets to 0, can be set to 1 by software, but once set it cannot be cleared until reset.
168169
MSECCFG_MMWP_TYPE:
169170
schema:
171+
type: string
170172
enum: [read-only-0, read-only-1, sticky]
171173
description: |
172174
Determines the behavior of the mseccfg.MMWP bit:

0 commit comments

Comments
 (0)