From afd2eb53449df925a863211af9d7a9cae56d88a2 Mon Sep 17 00:00:00 2001 From: Robert Norton Date: Tue, 6 Mar 2018 16:31:09 +0000 Subject: Check tag of pcc in TranslatePC. This could happen after an ERET with untagged EPCC. ISA says this results in undefined behaviour but it should probably not permit execution of code with untagged PCC. --- cheri/cheri_prelude_common.sail | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cheri') diff --git a/cheri/cheri_prelude_common.sail b/cheri/cheri_prelude_common.sail index 0a491145..5dd14974 100644 --- a/cheri/cheri_prelude_common.sail +++ b/cheri/cheri_prelude_common.sail @@ -369,6 +369,8 @@ function TranslatePC (vAddr) = { let absPC = base + unsigned(vAddr); if ((absPC % 4) != 0) then /* bad PC alignment */ (SignalExceptionBadAddr(AdEL, to_bits(64, absPC))) /* XXX absPC may be truncated */ + else if not (pcc.tag) then + (raise_c2_exception_noreg(CapEx_TagViolation)) else if ((absPC + 4) > top) then (raise_c2_exception_noreg(CapEx_LengthViolation)) else -- cgit v1.2.3