summaryrefslogtreecommitdiff
path: root/mips/mips_prelude.sail
diff options
context:
space:
mode:
authorRobert Norton2016-06-28 14:23:11 +0100
committerRobert Norton2016-06-28 14:25:28 +0100
commit28874bde2f7ad58e76ebe8d779d3920d74ca1db6 (patch)
tree5abc4c1c32e16e71029ca9e3367235f99bc627fd /mips/mips_prelude.sail
parent90c7ab7d28d68d943ebae7be6b687550d57a357c (diff)
Munge exception destination PC so we hit the correct address even when kcc.base is non-zero.
Diffstat (limited to 'mips/mips_prelude.sail')
-rw-r--r--mips/mips_prelude.sail6
1 files changed, 4 insertions, 2 deletions
diff --git a/mips/mips_prelude.sail b/mips/mips_prelude.sail
index 5cccee3f..5be1a3cc 100644
--- a/mips/mips_prelude.sail
+++ b/mips/mips_prelude.sail
@@ -279,7 +279,7 @@ function (bit[5]) ExceptionCode ((Exception) ex) =
val Exception -> unit effect {rreg, wreg} SignalException
-function unit SignalExceptionMIPS ((Exception) ex) =
+function unit SignalExceptionMIPS ((Exception) ex, (bit[64]) kccBase) =
{
(* Only update EPC and BD if not already in EXL mode *)
if (~ (CP0Status.EXL)) then
@@ -311,7 +311,9 @@ function unit SignalExceptionMIPS ((Exception) ex) =
0xFFFFFFFFBFC00200
else
0xFFFFFFFF80000000;
- nextPC := vectorBase + EXTS(vectorOffset);
+ (* On CHERI we have to subtract KCC.base so that we end up at the
+ right absolute vector address after indirecting via new PCC *)
+ nextPC := ((bit[64])(vectorBase + EXTS(vectorOffset))) - kccBase;
CP0Cause.ExcCode := ExceptionCode(ex);
CP0Status.EXL := 1;
}