added working cheri assembly
This commit is contained in:
@@ -241,6 +241,7 @@ function CapPipe capModify(CapPipe a, CapPipe b, CapModifyFunc func);
|
||||
new_hard_perms.global = new_hard_perms.global && getHardPerms(b).global;
|
||||
Bool unsealIllegal = !isValidCap(b) || getKind(b) != UNSEALED || getKind(a) == UNSEALED || a_res || getAddr(b) != a_type || !getHardPerms(b).permitUnseal || !isInBounds(b, False);
|
||||
Bool buildCapIllegal = !isValidCap(b) || getKind(b) != UNSEALED || !isDerivable(a) || (getPerms(a) & getPerms(b)) != getPerms(a) || getBase(a) < getBase(b) || getTop(a) > getTop(b); // XXX needs optimisation
|
||||
// TODO: Delta handler function
|
||||
CapPipe res = (case(func) matches
|
||||
tagged ModifyOffset .offsetOp :
|
||||
modifyOffset(a_mut, getAddr(b), offsetOp == IncOffset).value;
|
||||
@@ -274,6 +275,8 @@ function CapPipe capModify(CapPipe a, CapPipe b, CapModifyFunc func);
|
||||
(getAddr(a) == 0 ? nullCap : setAddr(b_mut, getAddr(a)).value);
|
||||
tagged SetHigh:
|
||||
fromMem(tuple2(False, {getAddr(b), getAddr(a)}));
|
||||
// capFromAddrs(a,b);
|
||||
// getTruncatedTuple(getAddr(b))
|
||||
tagged BuildCap :
|
||||
setKind(setValidCap(a_mut, !buildCapIllegal), getKind(a)==SENTRY ? SENTRY : UNSEALED);
|
||||
tagged Move :
|
||||
@@ -285,6 +288,38 @@ function CapPipe capModify(CapPipe a, CapPipe b, CapModifyFunc func);
|
||||
return res;
|
||||
endfunction
|
||||
|
||||
// function CapPipe capFromAddrs (CapPipe a, CapPipe b)
|
||||
// provisos (
|
||||
// CHERICap#(CapPipe, o, f, addrW, CapW, m, d)
|
||||
// );
|
||||
|
||||
// // Get full serialized capability of 'a'
|
||||
// match {.tag, .rawA} = toMem(a); // rawA : Bit#(inMemW)
|
||||
|
||||
// // Replace low addrW bits with address from b
|
||||
// Bit#(addrW) newAddr = getAddr(b);
|
||||
|
||||
// Bit#(inMemW) newRaw =
|
||||
// { rawA[CapW-1 : addrW] // keep upper metadata
|
||||
// , newAddr // replace address field
|
||||
// };
|
||||
|
||||
// return fromMem(tuple2(tag, newRaw));
|
||||
|
||||
// endfunction
|
||||
// function CapPipe capFromAddrs(capT a, capT b)
|
||||
// // Extract addresses
|
||||
// Bit#(64) addrA = getAddr(a);
|
||||
// Bit#(64) addrB = getAddr(b);
|
||||
// // Extra bits to reach inMemW = 180
|
||||
// Bit#(52) extra = 0; // can be zeros or delta bits if needed
|
||||
|
||||
// // Concatenate explicitly typed
|
||||
// Bit#(180) rawBits = {addrB, addrA, extra};
|
||||
|
||||
// return fromMem(tuple2(False, rawBits));
|
||||
// endfunction
|
||||
|
||||
(* noinline *)
|
||||
function Data capInspect(CapPipe a, CapPipe b, CapInspectFunc func);
|
||||
Data res = (case(func) matches
|
||||
@@ -323,6 +358,17 @@ function Data capInspect(CapPipe a, CapPipe b, CapInspectFunc func);
|
||||
return res;
|
||||
endfunction
|
||||
|
||||
// function CapPipe getTruncatedTuple(AddrType a, AddrType b)
|
||||
// provisos (
|
||||
// Add#(a__, b__, 180) // Defines that a__ + b__ must equal 180
|
||||
// );
|
||||
|
||||
// // Use a list literal or a Tuple constructor
|
||||
// let address_bits = { getAddr(b), getAddr(a) };
|
||||
|
||||
// return fromMem(tuple2(False, address_bits));
|
||||
// endfunction
|
||||
|
||||
function CapPipe capALU(CapPipe a, CapPipe b, CapFunc func);
|
||||
CapPipe res = (case (func) matches
|
||||
tagged CapInspect .x:
|
||||
|
||||
Reference in New Issue
Block a user