From af71c8e8cedff69da826e2b62ffc68ad641d9ad0 Mon Sep 17 00:00:00 2001 From: Peter Rugg Date: Tue, 19 Mar 2019 17:45:18 +0000 Subject: [PATCH] Add typeclass function for getting combined permissions --- CHERICap.bsv | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHERICap.bsv b/CHERICap.bsv index 51fd8e2..21102e8 100644 --- a/CHERICap.bsv +++ b/CHERICap.bsv @@ -96,6 +96,9 @@ typeclass CHERICap#(type t, numeric type ot, numeric type n) // Get the architectural permissions function Bit#(31) getPerms (t cap) = zeroExtend({pack(getSoftPerms(cap)), 4'h0, pack(getHardPerms(cap))}); + // Set the architectural permissions + function t setPerms (t cap, Bit#(31) perms) = + setSoftPerms(setHardPerms(cap, unpack(perms[11:0])), unpack(truncate(perms[30:15]))); // Get the kind of the capability, i.e. whether it is sealed, sentry, unsealed, ... function Kind getKind (t cap);