Initial (slow) implementation of CTestSubset

This commit is contained in:
Peter Rugg
2020-05-21 15:49:25 +01:00
parent 0a84227f93
commit 791e862377
2 changed files with 9 additions and 7 deletions

View File

@@ -1128,13 +1128,11 @@ function DecodeResult decode(Instruction inst, Bool cap_mode);
dInst.capFunc = CapModify (Unseal (Src1));
end
f7_cap_CTestSubset: begin
illegalInst = True;
// TODO
dInst.iType = Cap;
regs.dst = Valid(tagged Gpr rd);
regs.src1 = Valid(tagged Gpr rs1);
regs.src2 = Valid(tagged Gpr rs2);
dInst.imm = Invalid;
regs.src1 = Valid(tagged Gpr rs2);
regs.src2 = rs1 == 0 ? Invalid : Valid(tagged Gpr rs1);
dInst.scr = rs1 == 0 ? Valid (SCR_DDC) : Invalid;
dInst.capFunc = CapInspect (TestSubset);
end
f7_cap_CCopyType: begin

View File

@@ -230,8 +230,12 @@ endfunction
(* noinline *)
function Data capInspect(CapPipe a, CapPipe b, CapInspectFunc func);
Data res = (case(func) matches
//tagged TestSubset :
// error("TestSubset not yet implemented");
tagged TestSubset :
// TODO will be bad for timing. Would like to reuse bounds check
zeroExtend(pack( (isValidCap(b) == isValidCap(a))
&& ((getPerms(a) & getPerms(b)) == getPerms(a))
&& (getBase(a) >= getBase(b))
&& (getTop(a) >= getTop(b))));
tagged GetLen :
truncate(getLength(a));
tagged GetBase :