holey-bytes/hbvm/src/mem/pfhandler.rs

21 lines
493 B
Rust
Raw Normal View History

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