@@ -80,27 +80,41 @@ fields:
8080
8181      *Locked rules cannot be removed or modified until a PMP reset, unless mseccfg.RLB is set. 
8282type() : | 
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; 
9097MMWP :
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. 
96103type() : | 
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; 
104118RLB :
105119    location : 2 
106120    description : | 
@@ -113,4 +127,5 @@ fields:
113127type() : | 
114128      return MUTABLE_MSECCFG_RLB ? CsrFieldType::RW : CsrFieldType:RO; 
115129definedBy : Smepmp 
116-     reset_value : UNDEFINED_LEGAL 
130+     reset_value() : | 
131+       return MUTABLE_MSECCFG_RLB ? 0 : UNDEFINED_LEGAL; 
0 commit comments