Skip to content

Commit 0259333

Browse files
bors[bot]archshift
andauthored
Merge #34
34: mip, satp: Allow writing to these privileged registers r=laanwj a=archshift Per the RISC-V privileged ISA, these registers should be writable. Co-authored-by: Gui Andrade <[email protected]>
2 parents 0eda3c5 + 7a9aa06 commit 0259333

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

src/register/mip.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,30 @@ impl Mip {
7171
}
7272

7373
read_csr_as!(Mip, 0x344, __read_mip);
74+
set!(0x344, __set_mip);
75+
clear!(0x344, __clear_mip);
76+
77+
set_clear_csr!(
78+
/// User Software Interrupt Pending
79+
, set_usoft, clear_usoft, 1 << 0);
80+
set_clear_csr!(
81+
/// Supervisor Software Interrupt Pending
82+
, set_ssoft, clear_ssoft, 1 << 1);
83+
set_clear_csr!(
84+
/// Machine Software Interrupt Pending
85+
, set_msoft, clear_msoft, 1 << 3);
86+
set_clear_csr!(
87+
/// User Timer Interrupt Pending
88+
, set_utimer, clear_utimer, 1 << 4);
89+
set_clear_csr!(
90+
/// Supervisor Timer Interrupt Pending
91+
, set_stimer, clear_stimer, 1 << 5);
92+
set_clear_csr!(
93+
/// Machine Timer Interrupt Pending
94+
, set_mtimer, clear_mtimer, 1 << 7);
95+
set_clear_csr!(
96+
/// User External Interrupt Pending
97+
, set_uext, clear_uext, 1 << 8);
98+
set_clear_csr!(
99+
/// Supervisor External Interrupt Pending
100+
, set_sext, clear_sext, 1 << 9);

src/register/satp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ pub enum Mode {
8787
}
8888

8989
read_csr_as!(Satp, 0x180, __read_satp);
90-
write_csr!(0x180, __write_satp);
90+
write_csr_as_usize!(0x180, __write_satp);
9191

9292
#[inline]
9393
#[cfg(riscv32)]

0 commit comments

Comments
 (0)