-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The number of PMP (Physical Memory Protection) registers is limited on any RISC-V platform. Currently, each memory-mapped virtual device requires a separate PMP entry. This commit introduces a solution that allows grouping all virtual devices under a single PMP entry by implementing a pass-through module in front of them.
- Loading branch information
1 parent
8308af0
commit d3cddb1
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use crate::device::{DeviceAccess, VirtDevice, Width}; | ||
|
||
// ———————————————————————————— Empty device ————————————————————————————— // | ||
|
||
pub struct EmptyDevice {} | ||
|
||
impl DeviceAccess for EmptyDevice { | ||
fn read_device(&self, _: usize, _: Width) -> Result<usize, &'static str> { | ||
panic!("Trying to read the empty device!"); | ||
} | ||
|
||
fn write_device(&self, _: usize, _: Width, _: usize) -> Result<(), &'static str> { | ||
panic!("Trying to write the empty device!"); | ||
} | ||
} | ||
|
||
impl EmptyDevice { | ||
pub const fn new() -> VirtDevice { | ||
VirtDevice { | ||
start_addr: 0, | ||
size: 0, | ||
name: "", | ||
device_interface: &EmptyDevice {}, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters