diff options
| -rw-r--r-- | cheri/Makefile | 1 | ||||
| -rw-r--r-- | cheri/cheri_insts.sail | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/cheri/Makefile b/cheri/Makefile index 21fd1e51..44dc3c24 100644 --- a/cheri/Makefile +++ b/cheri/Makefile @@ -78,6 +78,7 @@ extract: cheri_insts.sail $(call EXTRACT_INST,CGetLen) $(call EXTRACT_INST,CGetTag) $(call EXTRACT_INST,CGetSealed) + $(call EXTRACT_INST,CGetAddr) $(call EXTRACT_INST,CGetPCC) $(call EXTRACT_INST,CGetPCCSetOffset) $(call EXTRACT_INST,CGetCause) diff --git a/cheri/cheri_insts.sail b/cheri/cheri_insts.sail index 532f0fef..0a4538b9 100644 --- a/cheri/cheri_insts.sail +++ b/cheri/cheri_insts.sail @@ -103,6 +103,8 @@ function clause decode (0b010010 @ 0b00000 @ cd : regno @ rs : regno @ 0b0011 function clause decode (0b010010 @ 0b00000 @ cd : regno @ sel : regno @ 0b01101 @ 0b111111) = Some(CReadHwr(cd, sel)) function clause decode (0b010010 @ 0b00000 @ cb : regno @ sel : regno @ 0b01110 @ 0b111111) = Some(CWriteHwr(cb, sel)) +function clause decode (0b010010 @ 0b00000 @ cb : regno @ sel : regno @ 0b01111 @ 0b111111) = Some(CGetAddr(cb, sel)) + /* Three operand */ /* Capability Modification */ @@ -197,6 +199,7 @@ union clause ast = CGetLen : (regno, regno) union clause ast = CGetTag : (regno, regno) union clause ast = CGetSealed : (regno, regno) union clause ast = CGetOffset : (regno, regno) +union clause ast = CGetAddr : (regno, regno) function clause execute (CGetPerm(rd, cb)) = { @@ -285,6 +288,18 @@ function clause execute (CGetSealed(rd, cb)) = /* END_CGetSealed */ } +function clause execute (CGetAddr(rd, cb)) = +{ + /* START_CGetAddr */ + checkCP2usable(); + if (register_inaccessible(cb)) then + raise_c2_exception(CapEx_AccessSystemRegsViolation, cb) + else + let capVal = readCapReg(cb) in + wGPR(rd) = to_bits(64, getCapCursor(capVal)); + /* END_CGetAddr */ +} + union clause ast = CGetPCC : regno function clause execute (CGetPCC(cd)) = { |
