Skip to content

Commit

Permalink
fix: pmpaddr should save bit 55-2
Browse files Browse the repository at this point in the history
Signed-off-by: Woshiluo Luo <woshiluo.luo@outlook.com>
  • Loading branch information
woshiluo committed Nov 15, 2024
1 parent 8b1e4d6 commit 28ade23
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions prototyper/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ SECTIONS {
*(.eh_frame)
}
. = ALIGN(8);
sbi_end = .;
.text 0x80100000 : ALIGN(8) {
Expand Down
4 changes: 2 additions & 2 deletions prototyper/src/platform/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ pub fn set_pmp() {
pmpcfg0::set_pmp(0, Range::OFF, Permission::NONE, false);
pmpaddr0::write(0);
pmpcfg0::set_pmp(1, Range::TOR, Permission::RWX, false);
pmpaddr1::write(sbi_start_address);
pmpaddr1::write(sbi_start_address >> 2);
pmpcfg0::set_pmp(2, Range::TOR, Permission::NONE, false);
pmpaddr2::write(sbi_end_address);
pmpaddr2::write(sbi_end_address >> 2);
pmpcfg0::set_pmp(3, Range::TOR, Permission::RWX, false);
pmpaddr3::write(usize::MAX >> 2);
}
Expand Down

0 comments on commit 28ade23

Please sign in to comment.