Merge pull request #19 from CTSRD-CHERI/mv380-ccopytypepullrequest

Added ccopytype_bypass
This commit is contained in:
Marno van der Maas
2021-11-17 09:54:57 +00:00
committed by GitHub
3 changed files with 7 additions and 0 deletions

View File

@@ -22,4 +22,5 @@
`CAP_CHECK_FIELD(src1_derivable,"src1_derivable")
`CAP_CHECK_FIELD(cfromptr_bypass,"cfromptr_bypass")
`CAP_CHECK_FIELD(ccseal_bypass,"ccseal_bypass")
`CAP_CHECK_FIELD(ccopytype_bypass,"ccopytype_bypass")
`CAP_CHECK_FIELD(cap_exact,"cap_exact")

View File

@@ -1174,6 +1174,7 @@ function DecodeResult decode(Instruction inst, Bool cap_mode);
dInst.capChecks.check_low_src = Src1Type;
dInst.capChecks.check_high_src = Src1Type;
dInst.capChecks.check_inclusive = False;
dInst.capChecks.ccopytype_bypass = True;
dInst.iType = Cap;
regs.dst = Valid(tagged Gpr rd);

View File

@@ -5,6 +5,7 @@
// Copyright (c) 2020 Alexandre Joannou
// Copyright (c) 2020 Peter Rugg
// Copyright (c) 2020 Jonathan Woodruff
// Copyright (c) 2021 Marno van der Maas
// All rights reserved.
//
// This software was developed by SRI International and the University of
@@ -424,6 +425,10 @@ function ExecResult basicExec(DecodedInst dInst, CapPipe rVal1, CapPipe rVal2, C
capException = Invalid;
boundsCheck = Invalid;
end
if (dInst.capChecks.ccopytype_bypass && isValidCap(rVal2) && getKind(rVal2) == UNSEALED && (getKind(rVal1) matches tagged SEALED_WITH_TYPE .t ? !validAsType(rVal2, zeroExtend(t)) : True)) begin
capException = Invalid;
boundsCheck = Invalid;
end
cf.nextPc = setKind(cf.nextPc, UNSEALED);
cf.mispredict = cf.nextPc != ppc;