Fixes issue in the RiscVCounterCsrHigh<> class.
PiperOrigin-RevId: 671861339
Change-Id: I3d35a82d48cd6a62fd5f009ef15cd3c1da9fd0fb
diff --git a/cheriot/cheriot_state.cc b/cheriot/cheriot_state.cc
index 39ac0bf..6dc3ca0 100644
--- a/cheriot/cheriot_state.cc
+++ b/cheriot/cheriot_state.cc
@@ -199,7 +199,9 @@
CHECK_NE(minstret, nullptr);
if (sizeof(T) == sizeof(uint32_t)) {
CHECK_NE(CreateCsr<RiscVCounterCsrHigh<CheriotState>>(
- state, csr_vec, "minstreth", RiscVCsrEnum::kMInstretH, state),
+ state, csr_vec, "minstreth", RiscVCsrEnum::kMInstretH, state,
+ reinterpret_cast<RiscVCounterCsr<uint32_t, CheriotState> *>(
+ minstret)),
nullptr);
}
// mcycle/mcycleh
@@ -208,7 +210,9 @@
CHECK_NE(mcycle, nullptr);
if (sizeof(T) == sizeof(uint32_t)) {
CHECK_NE(CreateCsr<RiscVCounterCsrHigh<CheriotState>>(
- state, csr_vec, "mcycleh", RiscVCsrEnum::kMCycleH, state),
+ state, csr_vec, "mcycleh", RiscVCsrEnum::kMCycleH, state,
+ reinterpret_cast<RiscVCounterCsr<uint32_t, CheriotState> *>(
+ mcycle)),
nullptr);
}