diff options
| author | Robert Norton | 2016-05-04 13:31:31 +0100 |
|---|---|---|
| committer | Robert Norton | 2016-05-04 13:31:31 +0100 |
| commit | d26a230b63e5e6ba528d3d5930521d23c8bdd727 (patch) | |
| tree | f7962289a933b53d276cbcf1a53c9239864484b5 /cheri | |
| parent | 87c56d3a270c4f7cf151a5e2519227bc80ee29b9 (diff) | |
check for PC alignment on instruction fetch.
Diffstat (limited to 'cheri')
| -rw-r--r-- | cheri/cheri_prelude.sail | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/cheri/cheri_prelude.sail b/cheri/cheri_prelude.sail index 8fa3b180..7853caad 100644 --- a/cheri/cheri_prelude.sail +++ b/cheri/cheri_prelude.sail @@ -412,7 +412,9 @@ function (bit[64]) TranslateAddress ((bit[64]) vAddr, (MemAccessType) accessType let (bit[64]) base = x[127..64] in let (bit[64]) length = x[63..0] in let (bit[64]) absPC = (base + vAddr) in - if ((unsigned(vAddr) + 4) > unsigned(length)) then + if (absPC[1..0] != 0b00) then (* bad PC alignment *) + exit (SignalExceptionBadAddr(AdEL, absPC)) + else if ((unsigned(vAddr) + 4) > unsigned(length)) then exit (raise_c2_exception_noreg(CapEx_LengthViolation)) (* XXX take exception properly *) else TLBTranslate(absPC, accessType) |
