sel4_sys/fault/
mod.rs
1use crate::bf::*;
8use crate::c::*;
9
10mod arch;
11
12impl seL4_Fault {
13 pub fn get_from_ipc_buffer(info: &seL4_MessageInfo, ipcbuf: &seL4_IPCBuffer) -> Self {
14 Self::get_with(info.get_label(), info.get_length(), |i| {
15 ipcbuf.msg[i as usize]
16 })
17 }
18
19 pub fn get_with(
20 label: seL4_Word,
21 length: seL4_Word,
22 f: impl Fn(core::ffi::c_ulong) -> seL4_Word,
23 ) -> Self {
24 match label {
25 seL4_Fault_tag::seL4_Fault_NullFault => {
26 seL4_Fault_NullFault_Unpacked {}.unsplay()
29 }
30 seL4_Fault_tag::seL4_Fault_CapFault => {
31 seL4_Fault_CapFault_Unpacked {
34 IP: f(seL4_CapFault_Msg::seL4_CapFault_IP),
35 Addr: f(seL4_CapFault_Msg::seL4_CapFault_Addr),
36 InRecvPhase: f(seL4_CapFault_Msg::seL4_CapFault_InRecvPhase),
37 LookupFailureType: f(seL4_CapFault_Msg::seL4_CapFault_LookupFailureType),
38 MR4: f(seL4_CapFault_Msg::seL4_CapFault_BitsLeft),
39 MR5: f(seL4_CapFault_Msg::seL4_CapFault_GuardMismatch_GuardFound),
40 MR6: f(seL4_CapFault_Msg::seL4_CapFault_GuardMismatch_BitsFound),
41 }
42 .unsplay()
43 }
44 _ => match Self::arch_get_with(label, length, f) {
45 Some(fault) => fault,
46 None => panic!(),
47 },
48 }
49 }
50}