diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-02-25 17:45:06 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-02-25 20:38:20 +0100 |
commit | faaffbd913c0e4e39444b2b4b0e0bfb93cc1a0a2 (patch) | |
tree | 22e840b74ab2f28e275ade935d98116e40e3df19 /cpukit/score/cpu/riscv/include/rtems/score/cpuimpl.h | |
parent | bsps/riscv: Add missing include (diff) | |
download | rtems-faaffbd913c0e4e39444b2b4b0e0bfb93cc1a0a2.tar.bz2 |
riscv: Use zicsr architecture extension
This is required for ISA 2.0 support, see chapter
"Zicsr", Control and Status Register (CSR) Instructions, Version 2.0
in
RISC-V Instruction Set Manual, Volume I: RISC-V User-Level ISA
Diffstat (limited to '')
-rw-r--r-- | cpukit/score/cpu/riscv/include/rtems/score/cpuimpl.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/cpukit/score/cpu/riscv/include/rtems/score/cpuimpl.h b/cpukit/score/cpu/riscv/include/rtems/score/cpuimpl.h index eee6ad7328..5162cbbd51 100644 --- a/cpukit/score/cpu/riscv/include/rtems/score/cpuimpl.h +++ b/cpukit/score/cpu/riscv/include/rtems/score/cpuimpl.h @@ -399,7 +399,13 @@ static inline struct Per_CPU_Control *_RISCV_Get_current_per_CPU_control( void ) { struct Per_CPU_Control *cpu_self; - __asm__ volatile ( "csrr %0, mscratch" : "=r" ( cpu_self ) ); + __asm__ volatile ( + ".option push\n" + ".option arch, +zicsr\n" + "csrr %0, mscratch\n" + ".option pop" : + "=r" ( cpu_self ) + ); return cpu_self; } |