This commit is contained in:
@@ -38,6 +38,7 @@ export CapReg;
|
||||
export CapPipe;
|
||||
|
||||
export encodeDelta;
|
||||
export addDelta;
|
||||
export decodeDelta;
|
||||
|
||||
export CapFat;
|
||||
@@ -1185,6 +1186,7 @@ instance CHERICap #(CapMem, OTypeW, FlagsW, CapAddrW, CapW, TSub #(MW, 3));
|
||||
function isDerivable = error ("isDerivable not implemented for CapMem");
|
||||
|
||||
function encodeDelta (cap, delta) = error ("encode delta not implemented");
|
||||
function addDelta (cap, delta) = error ("addDelta not implemented");
|
||||
function decodeDelta (cap) = error ("decode delta not implemented");
|
||||
|
||||
endinstance
|
||||
@@ -1342,6 +1344,7 @@ instance CHERICap #(CapReg, OTypeW, FlagsW, CapAddrW, CapW, TSub #(MW, 3));
|
||||
function setBoundsCombined (cap, length) = error ("setBoundsCombined not implemented for CapReg");
|
||||
|
||||
function encodeDelta (cap, delta) = error ("encode delta not implemented");
|
||||
function addDelta (cap, delta) = error ("addDelta not implemented");
|
||||
function decodeDelta (cap) = error ("decode delta not implemented");
|
||||
|
||||
//function setBounds = error ("setBounds not implemented for CapReg");
|
||||
@@ -1428,6 +1431,13 @@ instance CHERICap #(CapPipe, OTypeW, FlagsW, CapAddrW, CapW, TSub#(MW, 3));
|
||||
cap.capFat.address = {d, va_bits};
|
||||
return cap;
|
||||
endfunction
|
||||
|
||||
function addDelta(cap, delta);
|
||||
Bit#(25) d = truncate(delta);
|
||||
cap.capFat.address = cap.capFat.address + zeroExtend(delta);
|
||||
return cap;
|
||||
endfunction
|
||||
|
||||
|
||||
// Extract the delta stored in bits 63:39 of the address
|
||||
function decodeDelta(cap);
|
||||
|
||||
@@ -173,6 +173,7 @@ typeclass CHERICap #( type capT // type of the CHERICap capability
|
||||
function capT setFlags (capT cap, Bit #(flgW) flags);
|
||||
|
||||
function capT encodeDelta(capT cap, Bit #(64) delta);
|
||||
function capT addDelta(capT cap, Bit #(25) delta);
|
||||
|
||||
function Bit #(25) decodeDelta(capT cap);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user