diff options
| author | Robert Norton | 2016-06-07 12:53:27 +0100 |
|---|---|---|
| committer | Robert Norton | 2016-06-07 12:53:27 +0100 |
| commit | a7e59e7d4fb06a33c0dcb4d5c5aed0fffedac796 (patch) | |
| tree | 21d89c20329971ef2c71f27cea9ef1333eb9eff6 | |
| parent | 254d19111f20034e7f13f45377d99d655dfe3cfb (diff) | |
cheri: implement the csub instruciton (new instruction)
| -rw-r--r-- | cheri/cheri_insts.sail | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/cheri/cheri_insts.sail b/cheri/cheri_insts.sail index 71f76170..d3d84a53 100644 --- a/cheri/cheri_insts.sail +++ b/cheri/cheri_insts.sail @@ -178,6 +178,23 @@ function clause execute(CToPtr(rd, cb, ct)) = } } +union ast member regregreg CSub +function clause decode (0b010010 : 0b00000 : (regno) rd : (regno) cb : (regno) ct : 0b001010) = Some(CSub(rd, cb, ct)) +function clause execute(CSub(rd, cb, ct)) = +{ + checkCP2usable(); + ct_val := readCapReg(ct); + cb_val := readCapReg(cb); + if (register_inaccessible(cb)) then + exit (raise_c2_exception_v(cb)) + else if (register_inaccessible(ct)) then + exit (raise_c2_exception_v(ct)) + else + { + wGPR(rd) := (bit[64])(getCapCursor(cb_val) - getCapCursor(ct_val)) + } +} + union ast member (regno, regno, regno, CPtrCmpOp) CPtrCmp function clause decode (0b010010 : 0b01110 : (regno) rd : (regno) cb : (regno) ct : 0b000 : 0b000) = Some(CPtrCmp(rd, cb, ct, CEQ)) function clause decode (0b010010 : 0b01110 : (regno) rd : (regno) cb : (regno) ct : 0b000 : 0b001) = Some(CPtrCmp(rd, cb, ct, CNE)) |
