Update set/inc/modify offset API

This commit is contained in:
Alexandre Joannou
2019-10-22 10:38:43 +01:00
parent 12f8cb3ed9
commit 97ee2f262b
2 changed files with 11 additions and 5 deletions

View File

@@ -130,8 +130,14 @@ 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);
// Modify the offset of the capability. Result invalid if not exact
function Exact#(t) modifyOffset (t cap, Bit#(n) offset, Bool doInc);
// Set the offset of the capability. Result invalid if not exact
function Exact#(t) setOffset (t cap, Bit#(n) offset, Bool increment);
function Exact#(t) setOffset (t cap, Bit#(n) offset) =
modifyOffset(cap, offset, False);
// Set the offset of the capability. Result invalid if not exact
function Exact#(t) incOffset (t cap, Bit#(n) inc) =
modifyOffset(cap, inc, True);
// Get the base
function Bit#(n) getBase (t cap);