From db624448cb51a07b34439a438c2b08a8202ba2da Mon Sep 17 00:00:00 2001 From: Nick Spinale Date: Wed, 13 Mar 2024 23:49:18 +0000 Subject: [PATCH] crates/sel4: Don't export cap::* Signed-off-by: Nick Spinale --- .../root-task/spawn-task/child/src/main.rs | 4 +-- .../root-task/spawn-task/src/child_vspace.rs | 14 ++++---- .../spawn-task/src/object_allocator.rs | 6 ++-- .../root-task/spawn-thread/src/main.rs | 6 ++-- .../sel4-simple-task/runtime/src/lib.rs | 14 ++++---- .../sel4-simple-task/threading/src/lib.rs | 24 +++++++------- crates/sel4-capdl-initializer/core/src/lib.rs | 32 ++++++++----------- crates/sel4-microkit/base/src/channel.rs | 6 ++-- crates/sel4-microkit/src/defer.rs | 6 ++-- crates/sel4-microkit/src/handler.rs | 6 ++-- crates/sel4-root-task/src/heap.rs | 8 ++--- crates/sel4-sync/src/mutex.rs | 21 ++++++------ crates/sel4/src/debug.rs | 4 +-- crates/sel4/src/ipc_buffer.rs | 4 +-- crates/sel4/src/lib.rs | 3 -- crates/sel4/src/reply_authority.rs | 4 +-- crates/sel4/src/syscalls.rs | 8 ++--- 17 files changed, 82 insertions(+), 88 deletions(-) diff --git a/crates/examples/root-task/spawn-task/child/src/main.rs b/crates/examples/root-task/spawn-task/child/src/main.rs index 14b4eef2e..aada82c5f 100644 --- a/crates/examples/root-task/spawn-task/child/src/main.rs +++ b/crates/examples/root-task/spawn-task/child/src/main.rs @@ -12,9 +12,9 @@ mod runtime; fn main() -> ! { sel4::debug_println!("In child task"); - sel4::Notification::from_bits(1).signal(); + sel4::cap::Notification::from_bits(1).signal(); - sel4::Tcb::from_bits(2).tcb_suspend().unwrap(); + sel4::cap::Tcb::from_bits(2).tcb_suspend().unwrap(); unreachable!() } diff --git a/crates/examples/root-task/spawn-task/src/child_vspace.rs b/crates/examples/root-task/spawn-task/src/child_vspace.rs index bad7ad2e6..6de47e59e 100644 --- a/crates/examples/root-task/spawn-task/src/child_vspace.rs +++ b/crates/examples/root-task/spawn-task/src/child_vspace.rs @@ -19,10 +19,10 @@ const GRANULE_SIZE: usize = sel4::FrameObjectType::GRANULE.bytes(); pub(crate) fn create_child_vspace<'a>( allocator: &mut ObjectAllocator, image: &'a impl Object<'a, 'a>, - caller_vspace: sel4::VSpace, + caller_vspace: sel4::cap::VSpace, free_page_addr: usize, - asid_pool: sel4::AsidPool, -) -> (sel4::VSpace, usize, sel4::Granule) { + asid_pool: sel4::cap::AsidPool, +) -> (sel4::cap::VSpace, usize, sel4::cap::Granule) { let child_vspace = allocator.allocate_fixed_sized::(); asid_pool.asid_pool_assign(child_vspace).unwrap(); @@ -77,7 +77,7 @@ fn footprint<'a>(image: &'a impl Object<'a, 'a>) -> Range { fn map_intermediate_translation_tables( allocator: &mut ObjectAllocator, - vspace: sel4::VSpace, + vspace: sel4::cap::VSpace, footprint: Range, ) { for level in 1..sel4::vspace_levels::NUM_LEVELS { @@ -102,10 +102,10 @@ fn map_intermediate_translation_tables( fn map_image<'a>( allocator: &mut ObjectAllocator, - vspace: sel4::VSpace, + vspace: sel4::cap::VSpace, footprint: Range, image: &'a impl Object<'a, 'a>, - caller_vspace: sel4::VSpace, + caller_vspace: sel4::cap::VSpace, free_page_addr: usize, ) { let num_pages = footprint.len() / GRANULE_SIZE; @@ -116,7 +116,7 @@ fn map_image<'a>( sel4::CapRightsBuilder::none(), ) }) - .collect::>(); + .collect::>(); for seg in image.segments() { let segment_addr = usize::try_from(seg.address()).unwrap(); diff --git a/crates/examples/root-task/spawn-task/src/object_allocator.rs b/crates/examples/root-task/spawn-task/src/object_allocator.rs index 34a83b630..882ff0459 100644 --- a/crates/examples/root-task/spawn-task/src/object_allocator.rs +++ b/crates/examples/root-task/spawn-task/src/object_allocator.rs @@ -8,7 +8,7 @@ use core::ops::Range; pub(crate) struct ObjectAllocator { empty_slots: Range, - ut: sel4::Untyped, + ut: sel4::cap::Untyped, } impl ObjectAllocator { @@ -19,7 +19,7 @@ impl ObjectAllocator { } } - pub(crate) fn allocate(&mut self, blueprint: sel4::ObjectBlueprint) -> sel4::Unspecified { + pub(crate) fn allocate(&mut self, blueprint: sel4::ObjectBlueprint) -> sel4::cap::Unspecified { let slot_index = self.empty_slots.next().unwrap(); self.ut .untyped_retype( @@ -46,7 +46,7 @@ impl ObjectAllocator { } } -fn find_largest_untyped(bootinfo: &sel4::BootInfo) -> sel4::Untyped { +fn find_largest_untyped(bootinfo: &sel4::BootInfo) -> sel4::cap::Untyped { let (ut_ix, _desc) = bootinfo .untyped_list() .iter() diff --git a/crates/examples/root-task/spawn-thread/src/main.rs b/crates/examples/root-task/spawn-thread/src/main.rs index fd3bfa330..daec71c1c 100644 --- a/crates/examples/root-task/spawn-thread/src/main.rs +++ b/crates/examples/root-task/spawn-thread/src/main.rs @@ -74,7 +74,7 @@ fn main(bootinfo: &sel4::BootInfoPtr) -> sel4::Result { struct ObjectAllocator { empty_slots: Range, - ut: sel4::Untyped, + ut: sel4::cap::Untyped, } impl ObjectAllocator { @@ -116,7 +116,7 @@ impl ObjectAllocator { } } -fn find_largest_untyped(bootinfo: &sel4::BootInfo) -> sel4::Untyped { +fn find_largest_untyped(bootinfo: &sel4::BootInfo) -> sel4::cap::Untyped { let (ut_ix, _desc) = bootinfo .untyped_list() .iter() @@ -284,7 +284,7 @@ impl IpcBufferFrame { self.0.get().cast() } - fn cap(&self, bootinfo: &sel4::BootInfo) -> sel4::Granule { + fn cap(&self, bootinfo: &sel4::BootInfo) -> sel4::cap::Granule { get_user_image_frame_slot(bootinfo, self.ptr() as usize).cap() } } diff --git a/crates/private/support/sel4-simple-task/runtime/src/lib.rs b/crates/private/support/sel4-simple-task/runtime/src/lib.rs index e6f8c21cd..a9f185c7e 100644 --- a/crates/private/support/sel4-simple-task/runtime/src/lib.rs +++ b/crates/private/support/sel4-simple-task/runtime/src/lib.rs @@ -15,7 +15,6 @@ extern crate alloc; use core::ptr; use core::slice; -use sel4::Endpoint; use sel4_dlmalloc::StaticHeapBounds; use sel4_immediate_sync_once_cell::ImmediateSyncOnceCell; use sel4_panicking::ExternalPanicInfo; @@ -91,11 +90,12 @@ pub unsafe extern "C" fn cont_fn(cont_arg: *mut sel4_runtime_common::ContArg) -> sel4_runtime_common::run_ctors(); __sel4_simple_task_main(config.arg()); } else { - let endpoint = Endpoint::from_bits(thread_config.endpoint().unwrap().try_into().unwrap()); + let endpoint = + sel4::cap::Endpoint::from_bits(thread_config.endpoint().unwrap().try_into().unwrap()); let reply_authority = { sel4::sel4_cfg_if! { if #[sel4_cfg(KERNEL_MCS)] { - sel4::Reply::from_bits(thread_config.reply_authority().unwrap()) + sel4::cap::Reply::from_bits(thread_config.reply_authority().unwrap()) } else { assert!(thread_config.reply_authority().is_none()); sel4::ImplicitReplyAuthority @@ -114,8 +114,8 @@ pub fn try_idle() { .and_then(RuntimeConfig::idle_notification) .map(sel4::CPtrBits::try_from) .map(Result::unwrap) - .map(sel4::Notification::from_bits) - .map(sel4::Notification::wait); + .map(sel4::cap::Notification::from_bits) + .map(sel4::cap::Notification::wait); } pub fn idle() -> ! { @@ -152,14 +152,14 @@ fn get_static_heap_bounds() -> StaticHeapBounds { ) } -fn get_static_heap_mutex_notification() -> sel4::Notification { +fn get_static_heap_mutex_notification() -> sel4::cap::Notification { CONFIG .get() .unwrap() .static_heap_mutex_notification() .map(sel4::CPtrBits::try_from) .map(Result::unwrap) - .map(sel4::Notification::from_bits) + .map(sel4::cap::Notification::from_bits) .unwrap() } diff --git a/crates/private/support/sel4-simple-task/threading/src/lib.rs b/crates/private/support/sel4-simple-task/threading/src/lib.rs index d352eca7b..fd5139d71 100644 --- a/crates/private/support/sel4-simple-task/threading/src/lib.rs +++ b/crates/private/support/sel4-simple-task/threading/src/lib.rs @@ -9,24 +9,25 @@ use core::mem; -use sel4::{Endpoint, RecvWithMRs, ReplyAuthority, Word}; - #[cfg(feature = "alloc")] extern crate alloc; -pub type StaticThreadEntryFn = extern "C" fn(arg0: Word, arg1: Word); +pub type StaticThreadEntryFn = extern "C" fn(arg0: sel4::Word, arg1: sel4::Word); #[derive(Copy, Clone, Debug)] -pub struct StaticThread(Endpoint); +pub struct StaticThread(sel4::cap::Endpoint); impl StaticThread { - pub fn new(endpoint: Endpoint) -> Self { + pub fn new(endpoint: sel4::cap::Endpoint) -> Self { Self(endpoint) } #[allow(clippy::missing_safety_doc)] - pub unsafe fn recv_and_run(endpoint: Endpoint, reply_authority: ReplyAuthority) { - let RecvWithMRs { + pub unsafe fn recv_and_run( + endpoint: sel4::cap::Endpoint, + reply_authority: sel4::ReplyAuthority, + ) { + let sel4::RecvWithMRs { msg: [entry_vaddr, entry_arg0, entry_arg1, ..], .. } = endpoint.recv_with_mrs(reply_authority); @@ -35,8 +36,8 @@ impl StaticThread { } } -impl From for StaticThread { - fn from(endpoint: Endpoint) -> Self { +impl From for StaticThread { + fn from(endpoint: sel4::cap::Endpoint) -> Self { Self::new(endpoint) } } @@ -46,7 +47,6 @@ mod when_alloc { use alloc::boxed::Box; use core::panic::UnwindSafe; - use sel4::Word; use sel4_panicking::catch_unwind; use crate::StaticThread; @@ -57,12 +57,12 @@ mod when_alloc { let f_arg = Box::into_raw(b); self.0.send_with_mrs( sel4::MessageInfoBuilder::default().length(3).build(), - [entry as usize as Word, f_arg as Word, 0], + [entry as usize as sel4::Word, f_arg as sel4::Word, 0], ); } } - extern "C" fn entry(f_arg: Word) { + extern "C" fn entry(f_arg: sel4::Word) { let f = unsafe { Box::from_raw(f_arg as *mut Box) }; let _ = catch_unwind(f); } diff --git a/crates/sel4-capdl-initializer/core/src/lib.rs b/crates/sel4-capdl-initializer/core/src/lib.rs index 90692b591..e248eba48 100644 --- a/crates/sel4-capdl-initializer/core/src/lib.rs +++ b/crates/sel4-capdl-initializer/core/src/lib.rs @@ -19,14 +19,10 @@ use log::{debug, info, trace}; use sel4::{ cap_type, init_thread::{self, Slot}, - AbsoluteCPtr, BootInfoPtr, CNodeCapData, Cap, CapRights, CapType, - CapTypeForFrameObjectOfFixedSize, ObjectBlueprint, Untyped, UserContext, + CapRights, CapTypeForFrameObjectOfFixedSize, }; use sel4_capdl_initializer_types::*; -#[allow(unused_imports)] -use sel4::{CapTypeForFrameObject, FrameObjectType, VSpace}; - mod buffers; mod cslot_allocator; mod error; @@ -45,7 +41,7 @@ compile_error!("unsupported configuration"); type Result = result::Result; pub struct Initializer<'a, N: ObjectName, D: Content, M: GetEmbeddedFrame, B> { - bootinfo: &'a BootInfoPtr, + bootinfo: &'a sel4::BootInfoPtr, user_image_bounds: Range, copy_addrs: CopyAddrs, spec_with_sources: &'a SpecWithSources<'a, N, D, M>, @@ -57,7 +53,7 @@ impl<'a, N: ObjectName, D: Content, M: GetEmbeddedFrame, B: BorrowMut<[PerObject Initializer<'a, N, D, M, B> { pub fn initialize( - bootinfo: &BootInfoPtr, + bootinfo: &sel4::BootInfoPtr, user_image_bounds: Range, spec_with_sources: &SpecWithSources, buffers: &mut InitializerBuffers, @@ -246,7 +242,7 @@ impl<'a, N: ObjectName, D: Content, M: GetEmbeddedFrame, B: BorrowMut<[PerObject max_size_bits ); self.ut_cap(*i_ut).untyped_retype( - &ObjectBlueprint::Untyped { + &sel4::ObjectBlueprint::Untyped { size_bits: max_size_bits, }, &init_thread_cnode_relative_cptr(), @@ -494,7 +490,7 @@ impl<'a, N: ObjectName, D: Content, M: GetEmbeddedFrame, B: BorrowMut<[PerObject fn fill_frame( &self, - frame: Cap, + frame: sel4::Cap, frame_object_type: sel4::FrameObjectType, fill: &[FillEntry], ) -> Result<()> { @@ -554,7 +550,7 @@ impl<'a, N: ObjectName, D: Content, M: GetEmbeddedFrame, B: BorrowMut<[PerObject fn init_vspace( &mut self, - vspace: VSpace, + vspace: sel4::cap::VSpace, level: usize, vaddr: usize, obj: &object::PageTable, @@ -637,7 +633,7 @@ impl<'a, N: ObjectName, D: Content, M: GetEmbeddedFrame, B: BorrowMut<[PerObject { let cspace = self.orig_cap(obj.cspace().object); - let cspace_root_data = CNodeCapData::new( + let cspace_root_data = sel4::CNodeCapData::new( obj.cspace().guard, obj.cspace().guard_size.try_into().unwrap(), ); @@ -734,7 +730,7 @@ impl<'a, N: ObjectName, D: Content, M: GetEmbeddedFrame, B: BorrowMut<[PerObject } { - let mut regs = UserContext::default(); + let mut regs = sel4::UserContext::default(); *regs.pc_mut() = obj.extra.ip; *regs.sp_mut() = obj.extra.sp; for (i, value) in obj.extra.gprs.iter().enumerate() { @@ -784,7 +780,7 @@ impl<'a, N: ObjectName, D: Content, M: GetEmbeddedFrame, B: BorrowMut<[PerObject // - fn copy(&mut self, cap: Cap) -> Result> { + fn copy(&mut self, cap: sel4::Cap) -> Result> { let slot = self.cslot_alloc_or_panic(); let src = init_thread::slot::CNODE.cap().relative(cap); cslot_to_relative_cptr(slot).copy(&src, CapRights::all())?; @@ -811,23 +807,23 @@ impl<'a, N: ObjectName, D: Content, M: GetEmbeddedFrame, B: BorrowMut<[PerObject slot } - fn orig_cap(&self, obj_id: ObjectId) -> Cap { + fn orig_cap(&self, obj_id: ObjectId) -> sel4::Cap { self.orig_cslot(obj_id).cap().downcast() } - fn orig_relative_cptr(&self, obj_id: ObjectId) -> AbsoluteCPtr { + fn orig_relative_cptr(&self, obj_id: ObjectId) -> sel4::AbsoluteCPtr { cslot_to_relative_cptr(self.orig_cslot(obj_id)) } - fn ut_cap(&self, ut_index: usize) -> Untyped { + fn ut_cap(&self, ut_index: usize) -> sel4::cap::Untyped { self.bootinfo.untyped().index(ut_index).cap() } } -fn cslot_to_relative_cptr(slot: Slot) -> AbsoluteCPtr { +fn cslot_to_relative_cptr(slot: Slot) -> sel4::AbsoluteCPtr { init_thread::slot::CNODE.cap().relative(slot.cptr()) } -fn init_thread_cnode_relative_cptr() -> AbsoluteCPtr { +fn init_thread_cnode_relative_cptr() -> sel4::AbsoluteCPtr { init_thread::slot::CNODE.cap().relative_self() } diff --git a/crates/sel4-microkit/base/src/channel.rs b/crates/sel4-microkit/base/src/channel.rs index 50924d7e6..e44af0e35 100644 --- a/crates/sel4-microkit/base/src/channel.rs +++ b/crates/sel4-microkit/base/src/channel.rs @@ -31,17 +31,17 @@ impl Channel { } #[doc(hidden)] - pub fn notification(&self) -> sel4::Notification { + pub fn notification(&self) -> sel4::cap::Notification { self.cap::(BASE_OUTPUT_NOTIFICATION_SLOT) } #[doc(hidden)] - pub fn irq_handler(&self) -> sel4::IrqHandler { + pub fn irq_handler(&self) -> sel4::cap::IrqHandler { self.cap::(BASE_IRQ_SLOT) } #[doc(hidden)] - pub fn endpoint(&self) -> sel4::Endpoint { + pub fn endpoint(&self) -> sel4::cap::Endpoint { self.cap::(BASE_ENDPOINT_SLOT) } diff --git a/crates/sel4-microkit/src/defer.rs b/crates/sel4-microkit/src/defer.rs index 0ac374905..d0c6c2665 100644 --- a/crates/sel4-microkit/src/defer.rs +++ b/crates/sel4-microkit/src/defer.rs @@ -73,16 +73,16 @@ impl DeferredAction { #[derive(Debug, Clone, Eq, PartialEq)] pub(crate) struct PreparedDeferredAction { - cptr: sel4::Unspecified, + cptr: sel4::cap::Unspecified, msg_info: sel4::MessageInfo, } impl PreparedDeferredAction { - pub(crate) fn new(cptr: sel4::Unspecified, msg_info: sel4::MessageInfo) -> Self { + pub(crate) fn new(cptr: sel4::cap::Unspecified, msg_info: sel4::MessageInfo) -> Self { Self { cptr, msg_info } } - pub(crate) fn cptr(&self) -> sel4::Unspecified { + pub(crate) fn cptr(&self) -> sel4::cap::Unspecified { self.cptr } diff --git a/crates/sel4-microkit/src/handler.rs b/crates/sel4-microkit/src/handler.rs index e383b13e8..327974eb5 100644 --- a/crates/sel4-microkit/src/handler.rs +++ b/crates/sel4-microkit/src/handler.rs @@ -15,9 +15,9 @@ use crate::{ pub use core::convert::Infallible; -const INPUT_CAP: sel4::Endpoint = sel4::Cap::from_bits(1); -const REPLY_CAP: sel4::Reply = sel4::Cap::from_bits(4); -const MONITOR_EP_CAP: sel4::Endpoint = sel4::Cap::from_bits(5); +const INPUT_CAP: sel4::cap::Endpoint = sel4::Cap::from_bits(1); +const REPLY_CAP: sel4::cap::Reply = sel4::Cap::from_bits(4); +const MONITOR_EP_CAP: sel4::cap::Endpoint = sel4::Cap::from_bits(5); const EVENT_TYPE_MASK: sel4::Word = 1 << (sel4::WORD_SIZE - 1); diff --git a/crates/sel4-root-task/src/heap.rs b/crates/sel4-root-task/src/heap.rs index bc68f545a..5fa6a153b 100644 --- a/crates/sel4-root-task/src/heap.rs +++ b/crates/sel4-root-task/src/heap.rs @@ -7,17 +7,17 @@ use sel4_immediate_sync_once_cell::ImmediateSyncOnceCell; use sel4_panicking_env::abort; -static GLOBAL_ALLOCATOR_MUTEX_NOTIFICATION: ImmediateSyncOnceCell = +static GLOBAL_ALLOCATOR_MUTEX_NOTIFICATION: ImmediateSyncOnceCell = ImmediateSyncOnceCell::new(); -pub fn set_global_allocator_mutex_notification(nfn: sel4::Notification) { +pub fn set_global_allocator_mutex_notification(nfn: sel4::cap::Notification) { GLOBAL_ALLOCATOR_MUTEX_NOTIFICATION .set(nfn) .unwrap_or_else(|_| abort!("global allocator mutex notification already initialized")) } #[doc(hidden)] -pub fn get_global_allocator_mutex_notification() -> sel4::Notification { +pub fn get_global_allocator_mutex_notification() -> sel4::cap::Notification { *GLOBAL_ALLOCATOR_MUTEX_NOTIFICATION .get() .unwrap_or_else(|| { @@ -45,7 +45,7 @@ macro_rules! declare_heap { #[global_allocator] static GLOBAL_ALLOCATOR: StaticDlmallocGlobalAlloc< GenericRawMutex< - IndirectNotificationMutexSyncOps sel4::Notification>, + IndirectNotificationMutexSyncOps sel4::cap::Notification>, >, &'static StaticHeap<{ SIZE }>, > = StaticDlmallocGlobalAlloc::new( diff --git a/crates/sel4-sync/src/mutex.rs b/crates/sel4-sync/src/mutex.rs index 7982e7514..a5328124f 100644 --- a/crates/sel4-sync/src/mutex.rs +++ b/crates/sel4-sync/src/mutex.rs @@ -7,7 +7,6 @@ use core::sync::atomic::{fence, AtomicBool, AtomicIsize, Ordering}; -use sel4::Notification; use sel4_immediate_sync_once_cell::ImmediateSyncOnceCell; pub struct PanickingRawMutex { @@ -96,7 +95,7 @@ pub trait MutexSyncOpsWithInteriorMutability { } pub trait MutexSyncOpsWithNotification { - fn notification(&self) -> Notification; + fn notification(&self) -> sel4::cap::Notification; } impl MutexSyncOps for O { @@ -109,14 +108,14 @@ impl MutexSyncOps for O { } } -impl MutexSyncOpsWithNotification for Notification { - fn notification(&self) -> Notification { +impl MutexSyncOpsWithNotification for sel4::cap::Notification { + fn notification(&self) -> sel4::cap::Notification { *self } } pub struct DeferredNotificationMutexSyncOps { - inner: ImmediateSyncOnceCell, + inner: ImmediateSyncOnceCell, } impl DeferredNotificationMutexSyncOps { @@ -128,13 +127,13 @@ impl DeferredNotificationMutexSyncOps { } impl MutexSyncOpsWithNotification for DeferredNotificationMutexSyncOps { - fn notification(&self) -> Notification { + fn notification(&self) -> sel4::cap::Notification { *self.inner.get().unwrap() } } impl MutexSyncOpsWithInteriorMutability for DeferredNotificationMutexSyncOps { - type ModifyInput = Notification; + type ModifyInput = sel4::cap::Notification; type ModifyOutput = (); fn modify(&self, input: Self::ModifyInput) -> Self::ModifyOutput { @@ -146,14 +145,16 @@ pub struct IndirectNotificationMutexSyncOps { get_notification: T, } -impl Notification> IndirectNotificationMutexSyncOps { +impl sel4::cap::Notification> IndirectNotificationMutexSyncOps { pub const fn new(get_notification: T) -> Self { Self { get_notification } } } -impl Notification> MutexSyncOpsWithNotification for IndirectNotificationMutexSyncOps { - fn notification(&self) -> Notification { +impl sel4::cap::Notification> MutexSyncOpsWithNotification + for IndirectNotificationMutexSyncOps +{ + fn notification(&self) -> sel4::cap::Notification { (self.get_notification)() } } diff --git a/crates/sel4/src/debug.rs b/crates/sel4/src/debug.rs index 984326efb..7e6fefa7a 100644 --- a/crates/sel4/src/debug.rs +++ b/crates/sel4/src/debug.rs @@ -5,7 +5,7 @@ // SPDX-License-Identifier: MIT // -use crate::{sys, InvocationContext, CapType, Tcb, Cap}; +use crate::{sys, InvocationContext, CapType, cap, Cap}; /// Corresponds to `seL4_DebugPutChar`. pub fn debug_put_char(c: u8) { @@ -17,7 +17,7 @@ pub fn debug_snapshot() { sys::seL4_DebugSnapshot() } -impl Tcb { +impl cap::Tcb { /// Corresponds to `seL4_DebugNameThread`. pub fn debug_name(self, name: &[u8]) { self.invoke(|cptr, ipc_buffer| { diff --git a/crates/sel4/src/ipc_buffer.rs b/crates/sel4/src/ipc_buffer.rs index c69b755b2..24d1ed62e 100644 --- a/crates/sel4/src/ipc_buffer.rs +++ b/crates/sel4/src/ipc_buffer.rs @@ -8,7 +8,7 @@ use core::mem; use core::slice; -use crate::{newtype_methods, sys, AbsoluteCPtr, CNode, Word}; +use crate::{cap, newtype_methods, sys, AbsoluteCPtr, Word}; /// Corresponds to `seL4_IPCBuffer`. #[derive(Default)] @@ -58,7 +58,7 @@ impl IpcBuffer { pub fn recv_slot(&self) -> AbsoluteCPtr { let inner = self.inner(); - CNode::from_bits(inner.receiveCNode) + cap::CNode::from_bits(inner.receiveCNode) .relative_bits_with_depth(inner.receiveIndex, inner.receiveCNode.try_into().unwrap()) } diff --git a/crates/sel4/src/lib.rs b/crates/sel4/src/lib.rs index b7825b51e..80f7c595a 100644 --- a/crates/sel4/src/lib.rs +++ b/crates/sel4/src/lib.rs @@ -154,9 +154,6 @@ pub use syscalls::set_tls_base; pub use arch::top_level::*; -#[doc(no_inline)] -pub use cap::*; - pub(crate) use helper_macros::{ declare_cap_alias, declare_cap_type, declare_cap_type_for_object, declare_cap_type_for_object_of_fixed_size, declare_cap_type_for_object_of_variable_size, diff --git a/crates/sel4/src/reply_authority.rs b/crates/sel4/src/reply_authority.rs index 2ebc1c4b1..8e06dc61d 100644 --- a/crates/sel4/src/reply_authority.rs +++ b/crates/sel4/src/reply_authority.rs @@ -9,14 +9,14 @@ use sel4_config::{sel4_cfg, sel4_cfg_if}; use crate::sys; #[sel4_cfg(KERNEL_MCS)] -use crate::Reply; +use crate::cap; /// Configuration-dependant alias for conveying reply authority to syscalls. pub type ReplyAuthority = ReplyAuthorityImpl; sel4_cfg_if! { if #[sel4_cfg(KERNEL_MCS)] { - pub type ReplyAuthorityImpl = Reply; + pub type ReplyAuthorityImpl = cap::Reply; impl ReplyAuthority { pub(crate) fn into_sys_reply_authority(self) -> sys::ReplyAuthority { diff --git a/crates/sel4/src/syscalls.rs b/crates/sel4/src/syscalls.rs index 45b0f7b55..a85e1048b 100644 --- a/crates/sel4/src/syscalls.rs +++ b/crates/sel4/src/syscalls.rs @@ -9,8 +9,8 @@ use core::array; use sel4_config::{sel4_cfg, sel4_cfg_if}; use crate::{ - cap_type, const_helpers::u32_into_usize, sys, Cap, CapType, ConveysReplyAuthority, Endpoint, - InvocationContext, MessageInfo, Notification, Word, NUM_FAST_MESSAGE_REGISTERS, + cap, cap_type, const_helpers::u32_into_usize, sys, Cap, CapType, ConveysReplyAuthority, + InvocationContext, MessageInfo, Word, NUM_FAST_MESSAGE_REGISTERS, }; #[sel4_cfg(not(KERNEL_MCS))] @@ -48,7 +48,7 @@ sel4_cfg_if! { } } -impl Endpoint { +impl cap::Endpoint { /// Corresponds to `seL4_Send`. pub fn send(self, info: MessageInfo) { self.invoke(|cptr, ipc_buffer| { @@ -176,7 +176,7 @@ impl Endpoint { } } -impl Notification { +impl cap::Notification { /// Corresponds to `seL4_Signal`. pub fn signal(self) { self.invoke(|cptr, ipc_buffer| ipc_buffer.inner_mut().seL4_Signal(cptr.bits()))