mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-27 03:13:23 +00:00
Refactor architecture-specific page fault handling
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
c5009e38f1
commit
2a6733579d
@ -196,7 +196,7 @@ impl UserContextApiInternal for UserContext {
|
||||
///
|
||||
/// But there exists some vector which are special. Vector 1 can be both fault or trap and vector 2 is interrupt.
|
||||
/// So here we also define FaultOrTrap and Interrupt
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||
pub enum CpuExceptionType {
|
||||
/// CPU faults. Faults can be corrected, and the program may continue as if nothing happened.
|
||||
Fault,
|
||||
@ -213,7 +213,7 @@ pub enum CpuExceptionType {
|
||||
}
|
||||
|
||||
/// CPU exception.
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
|
||||
pub struct CpuException {
|
||||
/// The ID of the CPU exception.
|
||||
pub number: u16,
|
||||
@ -323,6 +323,13 @@ impl CpuException {
|
||||
}
|
||||
}
|
||||
|
||||
impl CpuExceptionInfo {
|
||||
/// Get corresponding CPU exception
|
||||
pub fn cpu_exception(&self) -> CpuException {
|
||||
EXCEPTION_LIST[self.id]
|
||||
}
|
||||
}
|
||||
|
||||
impl UserContextApi for UserContext {
|
||||
fn trap_number(&self) -> usize {
|
||||
self.user_context.trap_num
|
||||
|
Reference in New Issue
Block a user