CTSRD-CHERI / cheri-specification

CHERI ISA Specification
Other
17 stars 6 forks source link

Change CSetBounds* behavior #121

Open andresag01 opened 8 months ago

andresag01 commented 8 months ago

CHERI-RISC-V currently has the following instructions to set a capability's bounds:

  1. CSetBounds
  2. CSetBoundsImm
  3. CSetBoundsExact

Currently (1) and (2) round down the base and round up the length while (3) does the same but clears the tag if rounding was required. Ideally, software is aware of the rounding and most commonly uses (3) instead of (2)/(1), so it would be ideal to change these instructions into:

  1. CSetBounds: the same operation as the old CSetBoundsExact
  2. CSetBoundsImm: the same operation as the old CSetBoundsExact but with an immediate operand
  3. CSetBoundsInexact: the same operation as the old CSetBounds

A further proposal is also to eliminate CSetBoundsInexact altogether because it could be emulated with the new CSetBounds followed by CBuildCap although it is not a very natural way of performing that operation.

tariqkurd-repo commented 7 months ago

@jonwoodruff also suggested to make the implementation of CSetBounds[Imm] simpler as it no longer needs to round, so it can execute with a shorter latency than CSetBoundsInexact which does the rounding up (and shares logic with CRAM/CRRL)