Bounds Check fixes

This commit is contained in:
Peter Rugg
2020-04-20 21:23:42 +01:00
parent 7db3fa539f
commit b4be80eba1
3 changed files with 13 additions and 5 deletions

View File

@@ -744,7 +744,8 @@ function DecodeResult decode(Instruction inst);
dInst.capChecks.check_enable = True;
dInst.capChecks.check_authority_src = Src1;
dInst.capChecks.check_low_src = Src1Addr;
dInst.capChecks.check_high_src = ResultAddr;
dInst.capChecks.check_high_src = ResultTop;
dInst.capChecks.check_inclusive = True;
dInst.iType = Alu;
regs.dst = Valid(tagged Gpr rd);
@@ -777,7 +778,11 @@ function DecodeResult decode(Instruction inst);
dInst.capChecks.src1_tag = True;
dInst.capChecks.src1_unsealed = True;
// TODO bounds check
dInst.capChecks.check_enable = True;
dInst.capChecks.check_authority_src = Src1;
dInst.capChecks.check_low_src = Src1Addr;
dInst.capChecks.check_high_src = ResultTop;
dInst.capChecks.check_inclusive = True;
dInst.iType = Alu;
regs.dst = Valid(tagged Gpr rd);
@@ -795,7 +800,8 @@ function DecodeResult decode(Instruction inst);
dInst.capChecks.check_enable = True;
dInst.capChecks.check_authority_src = Src1;
dInst.capChecks.check_low_src = Src1Addr;
dInst.capChecks.check_high_src = ResultAddr;
dInst.capChecks.check_high_src = ResultTop;
dInst.capChecks.check_inclusive = True;
dInst.iType = Alu;
regs.dst = Valid(tagged Gpr rd);
@@ -923,6 +929,7 @@ function DecodeResult decode(Instruction inst);
dInst.capChecks.check_authority_src = Src1;
dInst.capChecks.check_low_src = Src2Type;
dInst.capChecks.check_high_src = Src2Type;
dInst.capChecks.check_inclusive = False;
dInst.iType = Alu;
regs.dst = Valid(tagged Gpr rd);
@@ -1002,6 +1009,7 @@ function DecodeResult decode(Instruction inst);
dInst.capChecks.check_authority_src = Src2;
dInst.capChecks.check_low_src = Src1Base;
dInst.capChecks.check_high_src = Src1Top;
dInst.capChecks.check_inclusive = True;
// Swap arguments so SCR possibly goes in RS2
dInst.iType = Alu;

View File

@@ -101,7 +101,7 @@ function Maybe#(BoundsCheck) prepareBoundsCheck(CapPipe a, CapPipe b, CapPipe c,
Src1Top: ret.check_high = getTop(a);
Src2Addr: ret.check_high = {0,getAddr(b)};
Src2Type: ret.check_high = zeroExtend(getType(b));
ResultAddr: ret.check_high = {0,getAddr(c)};
ResultTop: ret.check_high = {0,getTop(c)}; // TODO will be bad for timing
endcase
ret.check_inclusive = toCheck.check_inclusive;

View File

@@ -692,7 +692,7 @@ typedef enum {
Src1Top,
Src2Addr,
Src2Type,
ResultAddr
ResultTop
} CheckHighSrc deriving(Bits, Eq, FShow);
typedef struct {