mirror of
https://github.com/panpaul/tiny_os
synced 2024-09-20 09:45:19 +08:00
fix: uapi: add missing conversions between LookupFailure and SysError
This commit is contained in:
parent
8bf63bfb5d
commit
e1e772dca5
@ -7,7 +7,7 @@ pub enum SysError {
|
|||||||
RangeError, // Untyped
|
RangeError, // Untyped
|
||||||
NotMapped, // Frame
|
NotMapped, // Frame
|
||||||
AlreadyMapped, // Frame
|
AlreadyMapped, // Frame
|
||||||
MissingEntry, // Frame
|
MissingEntry, // CNode, Frame
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type SysResult<T = ()> = Result<T, SysError>;
|
pub type SysResult<T = ()> = Result<T, SysError>;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
use crate::error::SysError;
|
||||||
use utils::addr::VirtAddr;
|
use utils::addr::VirtAddr;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
@ -17,6 +18,17 @@ pub enum LookupFailure {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<LookupFailure> for SysError {
|
||||||
|
fn from(e: LookupFailure) -> SysError {
|
||||||
|
match e {
|
||||||
|
LookupFailure::InvalidRoot => SysError::MissingEntry,
|
||||||
|
LookupFailure::MissingCapability { .. } => SysError::MissingEntry,
|
||||||
|
LookupFailure::DepthMismatch { .. } => SysError::InvalidArgument,
|
||||||
|
LookupFailure::GuardMismatch { .. } => SysError::InvalidArgument,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
pub struct CapFault {
|
pub struct CapFault {
|
||||||
address: usize,
|
address: usize,
|
||||||
|
Loading…
Reference in New Issue
Block a user