diff --git a/CHERICC_Fat.bsv b/CHERICC_Fat.bsv index da7c395..d150ab4 100644 --- a/CHERICC_Fat.bsv +++ b/CHERICC_Fat.bsv @@ -1014,7 +1014,10 @@ instance CHERICap #(CapReg, OTypeW, FlagsW, CapAddressW, CapW, TSub#(MW, 3)); function getAddr (cap) = truncate(getAddress(cap)); function setAddr = error("feature not implemented for this cap type"); - function setAddrUnsafe = error("feature not implemented for this cap type"); + + function CapReg setAddrUnsafe (CapReg cap, Bit#(CapAddressW) address); + return setCapPointer(cap, zeroExtend(address)); + endfunction function getOffset = error("feature not implemented for this cap type"); function modifyOffset = error("feature not implemented for this cap type"); @@ -1145,8 +1148,7 @@ instance CHERICap #(CapPipe, OTypeW, FlagsW, CapAddressW, CapW, TSub#(MW, 3)); endfunction function CapPipe setAddrUnsafe (CapPipe cap, Bit#(CapAddressW) address); - let result = setCapPointer(cap.capFat, zeroExtend(address)); - cap.capFat = result; + cap.capFat = setAddrUnsafe(cap.capFat, address); cap.tempFields = getTempFields(cap.capFat); return cap; endfunction diff --git a/CHERICap.bsv b/CHERICap.bsv index 5fcf36e..1e6c887 100644 --- a/CHERICap.bsv +++ b/CHERICap.bsv @@ -186,9 +186,6 @@ typeclass CHERICap#(type t, numeric type ot, numeric type flg, numeric type n, n // Get representable length function Bit#(n) getRepresentableLength (t dummy, Bit#(n) length_request); - let mask = getRepresentableAlignmentMask(dummy, length_request); - return (length_request + ~mask) & mask; - endfunction endtypeclass