From 19eac921db1b608c6d4ef9cd8d0d2b5c6c48e46f Mon Sep 17 00:00:00 2001 From: Stephen Marz Date: Wed, 9 Oct 2019 20:27:45 -0400 Subject: [PATCH] Change to id_map_range --- risc_v/ch3/src/lib.rs | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/risc_v/ch3/src/lib.rs b/risc_v/ch3/src/lib.rs index 1cfab08..f698d38 100755 --- a/risc_v/ch3/src/lib.rs +++ b/risc_v/ch3/src/lib.rs @@ -208,32 +208,18 @@ extern "C" fn kinit() -> usize { page::EntryBits::ReadWrite.val(), ); // PLIC - // -> Source priority - page::map( - &mut root, - 0x0c00_0000, - 0x0c00_0000, - page::EntryBits::ReadWrite.val(), + id_map_range( + &mut root, + 0x0c00_0000, + 0x0c00_2000, + page::EntryBits::ReadWrite.val(), ); - // -> Pending array - page::map( - &mut root, - 0x0c00_1000, - 0x0c00_1000, - page::EntryBits::ReadWrite.val(), + id_map_range( + &mut root, + 0x0c20_0000, + 0x0c20_8000, + page::EntryBits::ReadWrite.val(), ); - // -> Interrupt enables - page::map( - &mut root, - 0x0c00_2000, - 0x0c00_2000, - page::EntryBits::ReadWrite.val(), - ); - // -> Priority threshold and claim/complete registers - for i in 0..=8 { - let m = 0x0c20_0000 + (i << 12); - page::map(&mut root, m, m, page::EntryBits::ReadWrite.val()); - } // When we return from here, we'll go back to boot.S and switch into // supervisor mode We will return the SATP register to be written when