-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use local
memory_addr
for memory_set
, update memory_set
, move g…
…eneric params of mapping structures into `MappingBackEnd` as associated types
- Loading branch information
Showing
7 changed files
with
172 additions
and
120 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
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
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
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,33 @@ | ||
use memory_addr::MemoryAddr; | ||
|
||
/// Underlying operations to do when manipulating mappings within the specific | ||
/// [`MemoryArea`]. | ||
/// | ||
/// The backend can be different for different memory areas. e.g., for linear | ||
/// mappings, the target physical address is known when it is added to the page | ||
/// table. For lazy mappings, an empty mapping needs to be added to the page table | ||
/// to trigger a page fault. | ||
pub trait MappingBackend: Clone { | ||
type Addr: MemoryAddr; | ||
type Flags: Copy; | ||
type PageTable; | ||
|
||
/// What to do when mapping a region within the area with the given flags. | ||
fn map( | ||
&self, | ||
start: Self::Addr, | ||
size: usize, | ||
flags: Self::Flags, | ||
page_table: &mut Self::PageTable, | ||
) -> bool; | ||
/// What to do when unmaping a memory region within the area. | ||
fn unmap(&self, start: Self::Addr, size: usize, page_table: &mut Self::PageTable) -> bool; | ||
/// What to do when changing access flags. | ||
fn protect( | ||
&self, | ||
start: Self::Addr, | ||
size: usize, | ||
new_flags: Self::Flags, | ||
page_table: &mut Self::PageTable, | ||
) -> bool; | ||
} |
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
Oops, something went wrong.