Sfoglia il codice sorgente

fix: pmpaddr should save bit 55-2

Signed-off-by: Woshiluo Luo <woshiluo.luo@outlook.com>
Woshiluo Luo 4 mesi fa
parent
commit
7658708c67
2 ha cambiato i file con 3 aggiunte e 2 eliminazioni
  1. 1 0
      prototyper/build.rs
  2. 2 2
      prototyper/src/platform/mod.rs

+ 1 - 0
prototyper/build.rs

@@ -55,6 +55,7 @@ SECTIONS {
         *(.eh_frame)
     }
 
+    . = ALIGN(8);
     sbi_end = .;
 
     .text 0x80100000 : ALIGN(8) {

+ 2 - 2
prototyper/src/platform/mod.rs

@@ -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);
     }