Implement CSetHigh

This commit is contained in:
Peter Rugg
2025-01-22 16:07:06 +00:00
parent f71a3d61a9
commit 773d5c1107
4 changed files with 14 additions and 1 deletions

View File

@@ -138,7 +138,9 @@ Bit #(7) f7_cap_CIncOffset = 7'h11;
Bit #(7) f7_cap_CToPtr = 7'h12;
Bit #(7) f7_cap_CFromPtr = 7'h13;
Bit #(7) f7_cap_CSub = 7'h14;
// 7'h15-7'h1c unused
// 7'h15 unused
Bit #(7) f7_cap_CSetHigh = 7'h16;
// 7'h17-7'h1c unused
Bit #(7) f7_cap_CBuildCap = 7'h1d;
Bit #(7) f7_cap_CCopyType = 7'h1e;
Bit #(7) f7_cap_CCSeal = 7'h1f;

View File

@@ -1156,6 +1156,14 @@ function DecodeResult decode(Instruction inst, Bool cap_mode);
regs.src2 = Valid(tagged Gpr rs2);
dInst.execFunc = Alu (Sub);
end
f7_cap_CSetHigh: begin
legalInst = True;
dInst.iType = Cap;
regs.dst = Valid(tagged Gpr rd);
regs.src1 = Valid(tagged Gpr rs1);
regs.src2 = Valid(tagged Gpr rs2);
dInst.capFunc = CapModify (SetHigh);
end
f7_cap_CBuildCap: begin
legalInst = True;
// Swap arguments so SCR possibly goes in RS2

View File

@@ -270,6 +270,8 @@ function CapPipe capModify(CapPipe a, CapPipe b, CapModifyFunc func);
setFlags(a_mut, truncate(getAddr(b)));
tagged FromPtr :
(getAddr(a) == 0 ? nullCap : setOffset(b_mut, getAddr(a)).value);
tagged SetHigh:
fromMem(tuple2(False, {getAddr(b), getAddr(a)}));
tagged BuildCap :
setKind(setValidCap(a_mut, !buildCapIllegal), getKind(a)==SENTRY ? SENTRY : UNSEALED);
tagged Move :

View File

@@ -344,6 +344,7 @@ typedef union tagged {
SrcSelector Unseal;
void AndPerm;
void SetFlags;
void SetHigh;
void BuildCap;
void Move;
void ClearTag;