From a7e59e7d4fb06a33c0dcb4d5c5aed0fffedac796 Mon Sep 17 00:00:00 2001 From: Robert Norton Date: Tue, 7 Jun 2016 12:53:27 +0100 Subject: cheri: implement the csub instruciton (new instruction) --- cheri/cheri_insts.sail | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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)) -- cgit v1.2.3