2023-07-11 15:04:48 +00:00
|
|
|
//! Program trap handling interfaces
|
|
|
|
|
|
|
|
use super::{Memory, MemoryAccessReason, PageSize};
|
|
|
|
|
|
|
|
/// Handle VM traps
|
|
|
|
pub trait HandlePageFault {
|
|
|
|
/// Handle page fault
|
2023-07-22 00:26:03 +00:00
|
|
|
///
|
|
|
|
/// Return true if handling was sucessful,
|
|
|
|
/// otherwise the program will be interrupted and will
|
|
|
|
/// yield an error.
|
2023-07-11 15:04:48 +00:00
|
|
|
fn page_fault(
|
|
|
|
&mut self,
|
|
|
|
reason: MemoryAccessReason,
|
|
|
|
memory: &mut Memory,
|
|
|
|
vaddr: u64,
|
|
|
|
size: PageSize,
|
|
|
|
dataptr: *mut u8,
|
|
|
|
) -> bool;
|
|
|
|
}
|