Return 0 on CToPtr if authority tag unset

This commit is contained in:
Peter Rugg
2022-05-16 11:42:35 +01:00
parent 338b98e0d2
commit e37339b147
2 changed files with 1 additions and 2 deletions

View File

@@ -1194,7 +1194,6 @@ function DecodeResult decode(Instruction inst, Bool cap_mode);
end
f7_cap_CToPtr: begin
dInst.capChecks.src1_unsealed = True;
dInst.capChecks.src2_tag = True;
dInst.iType = Cap;
regs.dst = Valid(tagged Gpr rd);

View File

@@ -320,7 +320,7 @@ function Data capInspect(CapPipe a, CapPipe b, CapInspectFunc func);
tagged SEALED_WITH_TYPE .t: zeroExtend(t);
endcase
tagged ToPtr :
(isValidCap(a) ? (getAddr(a) - getBase(b)) : 0);
(isValidCap(a) && isValidCap(b) ? (getAddr(a) - getBase(b)) : 0);
default: ?;
endcase);
return res;