Skip to content

Commit

Permalink
[riscv] switch stimecmp/stimecmph registers to using the raw integer …
Browse files Browse the repository at this point in the history
…format

Though using the named nmemonics is a generally better idea it has the
unforunate property of not working on older compilers. In this case,
these new registers are for the Sstic extension, which is new enough
that even reasonably recent compilers as GCC 12.1 doesn't understand it.

Fixes issue #410
  • Loading branch information
travisg committed Jun 17, 2024
1 parent 371a033 commit 69b8bcc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions arch/riscv/include/arch/riscv.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
#define RISCV_CSR_TIMEH (0xc81)
#define RISCV_CSR_INSRETH (0xc82)

// CSRs that exist in both machine and supervisor mode. Synthesize the appropriate
// one based on prefixing the name with either m or s.
#define RISCV_CSR_XSTATUS __CONCAT(RISCV_MODE_PREFIX, status)
#define RISCV_CSR_XIE __CONCAT(RISCV_MODE_PREFIX, ie)
#define RISCV_CSR_XTVEC __CONCAT(RISCV_MODE_PREFIX, tvec)
Expand All @@ -59,8 +61,8 @@
#if RISCV_S_MODE // Supervisor-mode only CSRs
#define RISCV_CSR_SATP satp
// sstc feature
#define RISCV_CSR_STIMECMP stimecmp
#define RISCV_CSR_STIMECMPH stimecmph
#define RISCV_CSR_STIMECMP (0x14d)
#define RISCV_CSR_STIMECMPH (0x15d)
#endif

#define RISCV_CSR_XSTATUS_IE (1ul << (RISCV_XMODE_OFFSET + 0))
Expand Down

0 comments on commit 69b8bcc

Please sign in to comment.