From a8974231eb26af1802038b0fc70afd0d9533b27f Mon Sep 17 00:00:00 2001 From: Peter Rugg Date: Mon, 13 May 2019 23:35:34 +0100 Subject: [PATCH] Add tag bit checks for fully unpacked capabilities --- CHERICC_Fat.bsv | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/CHERICC_Fat.bsv b/CHERICC_Fat.bsv index 0c2e749..b5bb417 100644 --- a/CHERICC_Fat.bsv +++ b/CHERICC_Fat.bsv @@ -848,8 +848,15 @@ typedef struct { } CapPipe deriving (Bits, FShow); instance CHERICap #(CapMem, OTypeW, FlagsW, CapAddressW); - function isValidCap = error("feature not implemented for this cap type"); - function setValidCap = error("feature not implemented for this cap type"); + function isValidCap (x); + CapabilityInMemory capMem = unpack(x); + return capMem.isCapability; + endfunction + function setValidCap (x, v); + CapabilityInMemory capMem = unpack(x); + capMem.isCapability = v; + return pack(capMem); + endfunction function getFlags = error("feature not implemented for this cap type"); function setFlags = error("feature not implemented for this cap type"); function getHardPerms = error("feature not implemented for this cap type");