#![no_std]
#![feature(asm)]
#![allow(bad_style, unused_parens, unused_assignments)]
#![doc(html_root_url = "https://doc.robigalia.org/")]
#[cfg(not(any(
all(target_arch = "arm", target_pointer_width = "32"),
all(target_arch = "x86"),
all(target_arch = "x86_64"),
)))]
use architecture_not_supported_sorry;
extern crate rlibc;
extern crate bitflags;
pub use seL4_Error::*;
pub use seL4_LookupFailureType::*;
pub use seL4_ObjectType::*;
pub use seL4_BreakpointType::*;
pub use seL4_BreakpointAccess::*;
use core::mem::size_of;
macro_rules! error_types {
($int_width:ident) => {
#[repr($int_width)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum seL4_Error {
seL4_NoError = 0,
seL4_InvalidArgument,
seL4_InvalidCapability,
seL4_IllegalOperation,
seL4_RangeError,
seL4_AlignmentError,
seL4_FailedLookup,
seL4_TruncatedMessage,
seL4_DeleteFirst,
seL4_RevokeFirst,
seL4_NotEnoughMemory,
}
#[repr($int_width)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum seL4_LookupFailureType {
seL4_NoFailure = 0,
seL4_InvalidRoot,
seL4_MissingCapability,
seL4_DepthMismatch,
seL4_GuardMismatch,
}
#[repr($int_width)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum seL4_BreakpointType {
seL4_DataBreakpoint = 0,
seL4_InstructionBreakpoint,
seL4_SingleStep,
seL4_SoftwareBreakRequest,
}
#[repr($int_width)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum seL4_BreakpointAccess {
seL4_BreakOnRead = 0,
seL4_BreakOnWrite,
seL4_BreakOnReadWrite,
}
}
}
pub type seL4_Word = usize;
pub type seL4_CPtr = usize;
#[cfg(target_arch = "x86")]
include!("arch/x86.rs");
#[cfg(target_arch = "x86_64")]
include!("arch/x86_64.rs");
#[cfg(all(target_arch = "arm", target_pointer_width = "32"))]
include!("arch/arm.rs");
#[cfg(all(target_arch = "x86"))]
include!(concat!(env!("OUT_DIR"), "/ia32_invocation.rs"));
#[cfg(all(target_arch = "x86_64"))]
include!(concat!(env!("OUT_DIR"), "/x86_64_invocation.rs"));
#[cfg(all(target_arch = "arm", target_pointer_width = "32"))]
include!(concat!(env!("OUT_DIR"), "/aarch32_invocation.rs"));
#[cfg(all(target_arch = "x86"))]
include!(concat!(env!("OUT_DIR"), "/ia32_syscall_stub.rs"));
#[cfg(all(target_arch = "x86_64"))]
include!(concat!(env!("OUT_DIR"), "/x86_64_syscall_stub.rs"));
#[cfg(all(target_arch = "arm", target_pointer_width = "32"))]
include!(concat!(env!("OUT_DIR"), "/aarch32_syscall_stub.rs"));
#[cfg(target_pointer_width = "32")]
include!(concat!(env!("OUT_DIR"), "/types32.rs"));
#[cfg(target_pointer_width = "64")]
include!(concat!(env!("OUT_DIR"), "/types64.rs"));
include!(concat!(env!("OUT_DIR"), "/syscalls.rs"));
pub type seL4_CNode = seL4_CPtr;
pub type seL4_IRQHandler = seL4_CPtr;
pub type seL4_IRQControl = seL4_CPtr;
pub type seL4_TCB = seL4_CPtr;
pub type seL4_Untyped = seL4_CPtr;
pub type seL4_DomainSet = seL4_CPtr;
pub const seL4_MsgLengthBits: usize = 7;
pub const seL4_MsgMaxLength: usize = 120;
pub const seL4_MsgExtraCapBits: usize = 2;
pub const seL4_MsgMaxExtraCaps: usize = (1usize << seL4_MsgExtraCapBits) - 1;
#[derive(Copy)]
pub struct seL4_IPCBuffer {
pub tag: seL4_MessageInfo,
pub msg: [seL4_Word; seL4_MsgMaxLength],
pub userData: seL4_Word,
pub caps_or_badges: [seL4_Word; seL4_MsgMaxExtraCaps],
pub receiveCNode: seL4_CPtr,
pub receiveIndex: seL4_CPtr,
pub receiveDepth: seL4_Word,
}
impl ::core::clone::Clone for seL4_IPCBuffer {
fn clone(&self) -> Self {
*self
}
}
pub static seL4_CapNull: seL4_Word = 0;
pub static seL4_CapInitThreadTCB: seL4_Word = 1;
pub static seL4_CapInitThreadCNode: seL4_Word = 2;
pub static seL4_CapInitThreadVSpace: seL4_Word = 3;
pub static seL4_CapIRQControl: seL4_Word = 4;
pub static seL4_CapASIDControl: seL4_Word = 5;
pub static seL4_CapInitThreadASIDPool: seL4_Word = 6;
pub static seL4_CapIOPort: seL4_Word = 7;
pub static seL4_CapIOSpace: seL4_Word = 8;
pub static seL4_CapBootInfoFrame: seL4_Word = 9;
pub static seL4_CapInitThreadIPCBuffer: seL4_Word = 10;
pub static seL4_CapDomain: seL4_Word = 11;
#[repr(C, packed)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct seL4_SlotRegion {
pub start: seL4_Word,
pub end: seL4_Word,
}
#[repr(C, packed)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct seL4_UntypedDesc {
pub paddr: seL4_Word,
pub padding1: u8,
pub padding2: u8,
pub sizeBits: u8,
pub isDevice: u8,
}
#[repr(C, packed)]
#[derive(Debug, PartialEq, Eq)]
pub struct seL4_BootInfo {
pub extraLen: seL4_Word,
pub nodeID: seL4_Word,
pub numNodes: seL4_Word,
pub numIOPTLevels: seL4_Word,
pub ipcBuffer: *mut seL4_IPCBuffer,
pub empty: seL4_SlotRegion,
pub sharedFrames: seL4_SlotRegion,
pub userImageFrames: seL4_SlotRegion,
pub userImagePaging: seL4_SlotRegion,
pub ioSpaceCaps: seL4_SlotRegion,
pub extraBIPages: seL4_SlotRegion,
pub initThreadCNodeSizeBits: u8,
pub initThreadDomain: u32,
pub archInfo: seL4_Word,
pub untyped: seL4_SlotRegion,
pub untypedList: seL4_UntypedDesc,
}
#[repr(C, packed)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct seL4_BootInfoHeader {
pub id: seL4_Word,
pub len: seL4_Word,
}
impl seL4_BootInfo {
pub unsafe fn untyped_descs(&self) -> &[seL4_UntypedDesc] {
let len = self.untyped.end - self.untyped.start;
debug_assert!(len <= (4096 - size_of::<seL4_BootInfo>() + size_of::<seL4_UntypedDesc>()) / size_of::<seL4_UntypedDesc>()) ;
core::slice::from_raw_parts(&self.untypedList, len)
}
}