Checking tag and seal on rVal2 and checking type on rVal1 in a way that does not use undefined behavior.

This commit is contained in:
Marno
2021-11-11 11:36:45 +00:00
parent 4d1dc29f79
commit 6ae92f786b

View File

@@ -424,7 +424,7 @@ function ExecResult basicExec(DecodedInst dInst, CapPipe rVal1, CapPipe rVal2, C
capException = Invalid;
boundsCheck = Invalid;
end
if (dInst.capChecks.ccopytype_bypass && isValidCap(rVal1) && getKind(rVal1) == UNSEALED && !validAsType(rVal1, zeroExtend(getKind(rVal1).SEALED_WITH_TYPE))) begin
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