mirror of
https://github.com/panpaul/tiny_os
synced 2024-09-20 09:45:19 +08:00
chore: uapi: split fault
This commit is contained in:
parent
9c1b39b6d7
commit
fb94285028
@ -1,20 +1,3 @@
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum CapFault {
|
||||
InvalidRoot,
|
||||
MissingCapability {
|
||||
bits_left: usize,
|
||||
},
|
||||
DepthMismatch {
|
||||
bits_found: usize,
|
||||
bits_left: usize,
|
||||
},
|
||||
GuardMismatch {
|
||||
bits_left: usize,
|
||||
guard_found: usize,
|
||||
guard_size: usize,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, FromPrimitive, ToPrimitive)]
|
||||
pub enum SysError {
|
||||
Ok,
|
||||
|
51
uapi/src/fault.rs
Normal file
51
uapi/src/fault.rs
Normal file
@ -0,0 +1,51 @@
|
||||
use utils::addr::VirtAddr;
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum LookupFailure {
|
||||
InvalidRoot,
|
||||
MissingCapability {
|
||||
bits_left: usize,
|
||||
},
|
||||
DepthMismatch {
|
||||
bits_found: usize,
|
||||
bits_left: usize,
|
||||
},
|
||||
GuardMismatch {
|
||||
bits_left: usize,
|
||||
guard_found: usize,
|
||||
guard_size: usize,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct CapFault {
|
||||
address: usize,
|
||||
in_receive_phase: bool,
|
||||
lookup_failure: LookupFailure,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct UnknownSyscall {
|
||||
fault_ip: VirtAddr,
|
||||
syscall: usize,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct UserException {
|
||||
fault_ip: VirtAddr,
|
||||
number: usize,
|
||||
code: usize,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct VMFault {
|
||||
ip: VirtAddr,
|
||||
}
|
||||
|
||||
pub enum Fault {
|
||||
Null,
|
||||
CapFault(CapFault),
|
||||
UnknownSyscall(UnknownSyscall),
|
||||
UserException(UserException),
|
||||
VMFault(VMFault),
|
||||
}
|
@ -6,5 +6,6 @@ extern crate num_derive;
|
||||
|
||||
pub mod cap;
|
||||
pub mod error;
|
||||
pub mod fault;
|
||||
pub mod syscall;
|
||||
pub mod vspace;
|
||||
|
@ -7,7 +7,14 @@ use crate::error::SysError;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, FromPrimitive, ToPrimitive)]
|
||||
pub enum Syscall {
|
||||
Invalid = 0,
|
||||
Invalid = 0,
|
||||
DebugPutChar = 1,
|
||||
Yield = 2,
|
||||
Identify = 3,
|
||||
Send = 4,
|
||||
Recv = 5,
|
||||
Call = 6,
|
||||
Reply = 7,
|
||||
}
|
||||
|
||||
/* in vanilla seL4, MessageInfo layout:
|
||||
@ -22,7 +29,7 @@ pub enum Syscall {
|
||||
* > Call:
|
||||
* > > [a0]: MessageInfo
|
||||
* > > [a1]: Capability Pointer
|
||||
* > > [a3..a7]: extra arguments
|
||||
* > > [a2..a7]: extra arguments
|
||||
* > > length = (a0..a?).len()
|
||||
* > Reply:
|
||||
* > TODO: figure out how vanilla seL4 handle reply
|
||||
|
Loading…
Reference in New Issue
Block a user