@@ -944,7 +944,7 @@ function clause execute (CLoadCap(rd, cs, is_unsigned, width)) =
944
944
945
945
union load_cap_ptw_ext_result = {
946
946
LCPE_OK : Capability,
947
- LCPE_Exn : CapEx
947
+ LCPE_Exn : ExceptionType
948
948
}
949
949
950
950
val handle_load_cap_ptw_ext : (Capability, bool, ext_ptw_lcm) -> load_cap_ptw_ext_result
@@ -954,7 +954,7 @@ function handle_load_cap_ptw_ext (v, vialc, ptw_info) =
954
954
else match ptw_info {
955
955
PTW_LCM_OK => LCPE_OK({v with tag = v.tag & vialc}),
956
956
PTW_LCM_CLR => LCPE_OK({v with tag = false}),
957
- PTW_LCM_TRAP => LCPE_Exn(CapEx_CapLoadGen )
957
+ PTW_LCM_TRAP => LCPE_Exn(E_Extension(EXC_CHERI_MMU_LOAD_CAP) )
958
958
}
959
959
960
960
val handle_load_cap_via_cap : (regidx, capreg_idx, Capability, xlenbits) -> Retired effect {escape, rmem, rmemt, rreg, wmv, wmvt, wreg}
@@ -985,14 +985,15 @@ function handle_load_cap_via_cap(rd, cs, cap_val, vaddrBits) = {
985
985
986
986
if ~(load_cap_data_dep_trap) & vialc & lcav == PTW_LCM_TRAP then {
987
987
/* If we're not permitted to do tag-dependent traps, trap now */
988
- handle_cheri_cap_exception(CapEx_CapLoadGen, cs); RETIRE_FAIL
988
+ handle_mem_exception(vaddrBits, E_Extension(EXC_CHERI_MMU_LOAD_CAP));
989
+ RETIRE_FAIL
989
990
} else {
990
991
let c = mem_read_cap(addr, aq, rl, false);
991
992
match c {
992
993
MemValue(v) => {
993
994
match handle_load_cap_ptw_ext(v, vialc, lcav) {
994
995
LCPE_OK(v') => { writeCapReg(rd, v'); RETIRE_SUCCESS },
995
- LCPE_Exn(e) => { handle_cheri_cap_exception(e, cs ); RETIRE_FAIL }
996
+ LCPE_Exn(e) => { handle_mem_exception(vaddrBits, e ); RETIRE_FAIL }
996
997
}
997
998
},
998
999
MemException(e) => {handle_mem_exception(vaddrBits, e); RETIRE_FAIL }
@@ -1090,14 +1091,15 @@ if not(cap_val.tag) then {
1090
1091
1091
1092
if ~(load_cap_data_dep_trap) & vialc & lcav == PTW_LCM_TRAP then {
1092
1093
/* If we're not permitted to do tag-dependent traps, trap now */
1093
- handle_cheri_cap_exception(CapEx_CapLoadGen, cs); RETIRE_FAIL
1094
+ handle_mem_exception(vaddrBits, E_Extension(EXC_CHERI_MMU_LOAD_CAP));
1095
+ RETIRE_FAIL
1094
1096
} else {
1095
1097
let c = mem_read_cap(addr, aq, rl, false);
1096
1098
match c {
1097
1099
MemValue(v) => {
1098
1100
match handle_load_cap_ptw_ext(v, vialc, lcav) {
1099
1101
LCPE_OK(v') => { load_reservation(addr); writeCapReg(cd, v'); RETIRE_SUCCESS },
1100
- LCPE_Exn(e) => { handle_cheri_cap_exception(e, cs ); RETIRE_FAIL }
1102
+ LCPE_Exn(e) => { handle_mem_exception(vaddrBits, e ); RETIRE_FAIL }
1101
1103
}
1102
1104
},
1103
1105
MemException(e) => {handle_mem_exception(vaddrBits, e); RETIRE_FAIL }
@@ -1248,16 +1250,16 @@ function handle_store_cap_via_cap(rs, cs, cap_val, vaddrBits) = {
1248
1250
handle_mem_exception(vaddrBits, E_SAMO_Addr_Align());
1249
1251
RETIRE_FAIL
1250
1252
} else match translateAddr(vaddrBits, Write(if rs_val.tag then Cap else Data)) {
1251
- TR_Failure(E_Extension(EXC_CHERI_VMEM_STORE_CAP ), _) => {
1252
- handle_cheri_cap_exception(CapEx_MMUNoStoreCap, cs );
1253
+ TR_Failure(E_Extension(EXC_CHERI_MMU_STORE_CAP ), _) => {
1254
+ handle_mem_exception(vaddrBits, E_Extension(EXC_CHERI_MMU_STORE_CAP) );
1253
1255
RETIRE_FAIL
1254
1256
},
1255
1257
TR_Failure(E_Extension(_), _) => { internal_error("unexpected cheri exception for cap store") },
1256
1258
TR_Failure(e, _) => { handle_mem_exception(vaddrBits, e); RETIRE_FAIL },
1257
1259
TR_Address(addr, caveats) => {
1258
1260
match (caveats.ptw_sc_mod, rs_val.tag) {
1259
1261
(PTW_SCM_TRAP, true) => {
1260
- handle_cheri_cap_exception(CapEx_MMUNoStoreCap, cs );
1262
+ handle_mem_exception(vaddrBits, E_Extension(EXC_CHERI_MMU_STORE_CAP) );
1261
1263
RETIRE_FAIL
1262
1264
},
1263
1265
_ => {
@@ -1405,15 +1407,15 @@ function handle_store_cond_cap_via_cap(cs2, cs, cap_val, vaddrBits) = {
1405
1407
} else {
1406
1408
match translateAddr(vaddrBits, Write(if cs2_val.tag then Cap else Data)) {
1407
1409
TR_Failure(E_Extension(EXC_CHERI_VMEM_STORE_CAP), _) => {
1408
- handle_cheri_cap_exception(CapEx_MMUNoStoreCap, cs );
1410
+ handle_mem_exception(vaddrBits, E_Extension(EXC_CHERI_MMU_STORE_CAP) );
1409
1411
RETIRE_FAIL
1410
1412
},
1411
1413
TR_Failure(E_Extension(_), _) => { internal_error("unexpected cheri exception for cap store") },
1412
1414
TR_Failure(e, _) => { handle_mem_exception(vaddrBits, e); RETIRE_FAIL },
1413
1415
TR_Address(addr, caveats) => {
1414
1416
match (caveats.ptw_sc_mod, cs2_val.tag) {
1415
1417
(PTW_SCM_TRAP, true) => {
1416
- handle_cheri_cap_exception(CapEx_MMUNoStoreCap, cs );
1418
+ handle_mem_exception(vaddrBits, E_Extension(EXC_CHERI_MMU_STORE_CAP) );
1417
1419
RETIRE_FAIL
1418
1420
},
1419
1421
_ => {
0 commit comments