diff options
| -rw-r--r-- | cheri/cheri_insts.sail | 8 | ||||
| -rw-r--r-- | cheri/cheri_prelude_common.sail | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/cheri/cheri_insts.sail b/cheri/cheri_insts.sail index 92c56cc4..a1ddc8aa 100644 --- a/cheri/cheri_insts.sail +++ b/cheri/cheri_insts.sail @@ -1159,7 +1159,7 @@ function clause execute (CLoad(rd, cb, rt, offset, signext, width, linked)) = { let 'size = wordWidthBytes(width); let cursor = getCapCursor(cb_val); - let vAddr = cursor + unsigned(rGPR(rt)) + (size*signed(offset)); + let vAddr = (cursor + unsigned(rGPR(rt)) + size*signed(offset)) % pow2(64); let vAddr64 = to_bits(64, vAddr); if ((vAddr + size) > getCapTop(cb_val)) then raise_c2_exception(CapEx_LengthViolation, cb) @@ -1203,7 +1203,7 @@ function clause execute (CStore(rs, cb, rt, rd, offset, width, conditional)) = { size = wordWidthBytes(width); cursor = getCapCursor(cb_val); - vAddr = cursor + unsigned(rGPR(rt)) + (size * signed(offset)); + vAddr = (cursor + unsigned(rGPR(rt)) + size * signed(offset)) % pow2(64); vAddr64= to_bits(64, vAddr); if ((vAddr + size) > getCapTop(cb_val)) then raise_c2_exception(CapEx_LengthViolation, cb) @@ -1266,7 +1266,7 @@ function clause execute (CSC(cs, cb, rt, rd, offset, conditional)) = else { cursor = getCapCursor(cb_val); - vAddr = cursor + unsigned(rGPR(rt)) + (16 * signed(offset)); + vAddr = (cursor + unsigned(rGPR(rt)) + 16 * signed(offset)) % pow2(64); vAddr64= to_bits(64, vAddr); if ((vAddr + cap_size) > getCapTop(cb_val)) then raise_c2_exception(CapEx_LengthViolation, cb) @@ -1313,7 +1313,7 @@ function clause execute (CLC(cd, cb, rt, offset, linked)) = else { cursor = getCapCursor(cb_val); - vAddr = cursor + unsigned(rGPR(rt)) + (16 * signed(offset)); + vAddr = (cursor + unsigned(rGPR(rt)) + 16 * signed(offset)) % pow2(64); vAddr64= to_bits(64, vAddr); if ((vAddr + cap_size) > getCapTop(cb_val)) then raise_c2_exception(CapEx_LengthViolation, cb) diff --git a/cheri/cheri_prelude_common.sail b/cheri/cheri_prelude_common.sail index 09e07f70..9c51966b 100644 --- a/cheri/cheri_prelude_common.sail +++ b/cheri/cheri_prelude_common.sail @@ -355,7 +355,7 @@ function addrWrapper(addr, accessType, width) = StoreData => if (~(cap.permit_store)) then (raise_c2_exception(CapEx_PermitStoreViolation, capno)) }; cursor = getCapCursor(cap); - vAddr = cursor + unsigned(addr); + vAddr = (cursor + unsigned(addr)) % pow2(64); size = wordWidthBytes(width); base = getCapBase(cap); top = getCapTop(cap); @@ -364,7 +364,7 @@ function addrWrapper(addr, accessType, width) = else if (vAddr < base) then (raise_c2_exception(CapEx_LengthViolation, capno)) else - to_bits(64, vAddr); /* XXX vAddr not truncated because top <= 2^64 and size > 0 */ + to_bits(64, vAddr); } $ifdef _MIPS_TLB_STUB |
