Skip to content

Commit

Permalink
CHERI-RISC-V: Use a bit in xCCSR to report we are tag clearing
Browse files Browse the repository at this point in the history
This will allow detecting required CHERI features more easily and is
helpful for the transition period where older implementations still exist.

See also: CTSRD-CHERI/sail-cheri-riscv#74
  • Loading branch information
arichardson committed Jun 16, 2023
1 parent aa32e4d commit 15d296d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions target/riscv/cpu_bits.h
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@
#define XCCSR_DIRTY 0x2 /* Capability register written */
#define SCCSR_SGCLG 0x4 /* Supervisor Global Cap Load Generation */
#define SCCSR_UGCLG 0x8 /* User Global Cap Load Generation */
#define XCCSR_TAG_CLEARING 0x80000000 /* CHERI has tag-clearing semantics. */
#endif

/* mstatus CSR bits */
Expand Down
2 changes: 2 additions & 0 deletions target/riscv/csr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,8 @@ static int read_ccsr(CPURISCVState *env, int csrno, target_ulong *val)
target_ulong ccsr = 0;
ccsr = set_field(ccsr, XCCSR_ENABLE, cpu->cfg.ext_cheri);
ccsr = set_field(ccsr, XCCSR_DIRTY, 1); /* Always report dirty */
/* Read-only feature bits. */
ccsr = set_field(ccsr, XCCSR_TAG_CLEARING, 1);

#if !defined(TARGET_RISCV32)
if (csrno == CSR_SCCSR)
Expand Down

0 comments on commit 15d296d

Please sign in to comment.