pub struct FrameLease { /* private fields */ }Expand description
A bounded capability for a physical frame range owned by a PageObject.
Allocation/deallocation policy remains in the architecture allocator; the
MM layer never treats a bare PhysAddr as ownership.
Implementations§
Source§impl FrameLease
impl FrameLease
pub fn new(paddr: PhysAddr) -> Self
Sourcepub fn borrowed(
paddr: PhysAddr,
bytes: usize,
anchor: Option<Arc<dyn Any + Send + Sync>>,
) -> Option<Self>
pub fn borrowed( paddr: PhysAddr, bytes: usize, anchor: Option<Arc<dyn Any + Send + Sync>>, ) -> Option<Self>
Creates a non-releasing lease whose provider remains alive for as long as any PageObject or sublease can name this physical range.
Sourcepub unsafe fn owned(paddr: PhysAddr, align: usize) -> Self
pub unsafe fn owned(paddr: PhysAddr, align: usize) -> Self
Creates an owning lease for a frame allocated by the Starry MM backend.
The alignment is the same order/size passed to alloc_frame.
Ownership cannot be fabricated from an arbitrary physical address:
fn fabricate_owner() -> starry_kernel::FrameLease {
starry_kernel::FrameLease::owned(ax_memory_addr::PhysAddr::from(0x1000usize), 4096)
}§Safety
paddr must be the unique, still-owned result of the Starry MM frame
allocator for exactly align bytes/alignment. The caller transfers
that ownership and must neither free it nor construct another owner.
Sourcepub fn owned_with_releaser(
paddr: PhysAddr,
align: usize,
release: fn(PhysAddr, usize),
) -> Self
pub fn owned_with_releaser( paddr: PhysAddr, align: usize, release: fn(PhysAddr, usize), ) -> Self
Creates an owning lease whose release function belongs to another allocator domain (for example page-table frames). The function is a static capability, not a closure, so dropping a lease remains IRQ-safe and cannot allocate.
pub const fn paddr(&self) -> PhysAddr
pub const fn size(&self) -> usize
Trait Implementations§
Source§impl Clone for FrameLease
impl Clone for FrameLease
Source§fn clone(&self) -> FrameLease
fn clone(&self) -> FrameLease
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for FrameLease
impl !UnwindSafe for FrameLease
impl Freeze for FrameLease
impl Send for FrameLease
impl Sync for FrameLease
impl Unpin for FrameLease
impl UnsafeUnpin for FrameLease
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DirectoryReadState for T
impl<T> DirectoryReadState for T
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more