From bc9f058976b2cda89b87a221d1199b4bd36de984 Mon Sep 17 00:00:00 2001 From: Peter Rugg Date: Thu, 5 Sep 2019 11:09:05 +0100 Subject: [PATCH] Add incOffset as option for setOffset --- CHERICC_Fat.bsv | 4 ++-- CHERICap.bsv | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHERICC_Fat.bsv b/CHERICC_Fat.bsv index 4263d33..43d7059 100644 --- a/CHERICC_Fat.bsv +++ b/CHERICC_Fat.bsv @@ -1006,8 +1006,8 @@ instance CHERICap #(CapPipe, OTypeW, FlagsW, CapAddressW, CapW); function getOffset (x) = getOffsetFat(x.capFat, x.tempFields); - function Exact#(CapPipe) setOffset (CapPipe cap, Bit#(CapAddressW) offset); - let result = incOffset(cap.capFat, ?, zeroExtend(offset), cap.tempFields, True); //TODO split into separate incOffset and setOffset functions? + function Exact#(CapPipe) setOffset (CapPipe cap, Bit#(CapAddressW) offset, Bool increment); + let result = incOffset(cap.capFat, ?, zeroExtend(offset), cap.tempFields, !increment); cap.capFat = result.d; cap.tempFields = getTempFields(cap.capFat); return Exact {exact: result.v, value: cap}; diff --git a/CHERICap.bsv b/CHERICap.bsv index 3beb423..bdab959 100644 --- a/CHERICap.bsv +++ b/CHERICap.bsv @@ -127,7 +127,7 @@ typeclass CHERICap#(type t, numeric type ot, numeric type flg, numeric type n, n // Get the offset of the capability function Bit#(n) getOffset (t cap) = getAddr(cap) - getBase(cap); // Set the offset of the capability. Result invalid if not exact - function Exact#(t) setOffset (t cap, Bit#(n) offset); + function Exact#(t) setOffset (t cap, Bit#(n) offset, Bool increment); // Get the base function Bit#(n) getBase (t cap);