From e31c8b89760bfaf7b017c351f11780b418394045 Mon Sep 17 00:00:00 2001 From: Robert Norton Date: Tue, 3 May 2016 12:56:36 +0100 Subject: immediate offset of load/store via capability is scaled by word size (ISA change). --- cheri/cheri_insts.sail | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cheri/cheri_insts.sail b/cheri/cheri_insts.sail index 486e33b1..20df3a62 100644 --- a/cheri/cheri_insts.sail +++ b/cheri/cheri_insts.sail @@ -515,7 +515,7 @@ function clause execute (CLoad(rd, cb, rt, offset, signext, width, linked)) = { size := wordWidthBytes(width); cursor := getCapCursor(cb_val); - vAddr := cursor + unsigned(rGPR(rt)) + signed(offset); + vAddr := cursor + unsigned(rGPR(rt)) + (size*signed(offset)); vAddr64:= (bit[64]) vAddr; if ((vAddr + size) > ((nat) (cb_val.base) + ((nat) (cb_val.length)))) then exit (raise_c2_exception(CapEx_LengthViolation, cb)) @@ -569,7 +569,7 @@ function clause execute (CStore(rs, cb, rt, rd, offset, width, conditional)) = { size := wordWidthBytes(width); cursor := getCapCursor(cb_val); - vAddr := cursor + unsigned(rGPR(rt)) + signed(offset); + vAddr := cursor + unsigned(rGPR(rt)) + (size * signed(offset)); vAddr64:= (bit[64]) vAddr; if ((vAddr + size) > ((nat) (cb_val.base) + ((nat) (cb_val.length)))) then exit (raise_c2_exception(CapEx_LengthViolation, cb)) -- cgit v1.2.3