pub struct Config { /* private fields */ }full only.Expand description
A Mapping builder, providing control over the way the underlying buffer is mapped.
Implementations§
Source§impl Config
impl Config
Sourcepub fn map<R: Mappable + Default>(
self,
) -> Result<Mapping<R, Kernel>, AllocError>
pub fn map<R: Mappable + Default>( self, ) -> Result<Mapping<R, Kernel>, AllocError>
Creates a Mapping in the kernel address space.
The type parameter R is used to determine how the physical and virtual allocations are aligned, as
well as some configuration values if left as default values. This can be used to require extra virtual
memory to be allocated and left unmapped to act as a guard page. See the module level documentation
for more information.
§Errors
Propagates an AllocError if the virtual or physical memory allocators have an allocation failure.
Sourcepub fn map_in<'a, R: Mappable + Default + Send + 'static>(
self,
name: Cow<'static, str>,
address_space: &'a AddressSpace,
) -> Result<MappingMeta<impl DerefMut<Target = Mapping<Box<dyn Mappable + Send>, Userspace>> + 'a>, AllocError>
pub fn map_in<'a, R: Mappable + Default + Send + 'static>( self, name: Cow<'static, str>, address_space: &'a AddressSpace, ) -> Result<MappingMeta<impl DerefMut<Target = Mapping<Box<dyn Mappable + Send>, Userspace>> + 'a>, AllocError>
Creates a Mapping in a user address space.
On success, returns a MappingMeta which allows access to the created mapping.
The type parameter R is used to determine how the physical and virtual allocations are aligned, as
well as some configuration values if left as default values. This can be used to require extra virtual
memory to be allocated and left unmapped to act as a guard page. See the module level documentation
for more information.
§Errors
Propagates an AllocError if the virtual or physical memory allocators have an allocation failure.
Sourcepub const fn new(page_count: NonZero<usize>, ty: Ty) -> Self
pub const fn new(page_count: NonZero<usize>, ty: Ty) -> Self
Constructs a new Config for creating a Mapping with size page_count number of pages.
The following defaults are used:
- Any physical memory location, including discontiguous memory
- Any virtual memory location
highmemused to allocate physical memory- Read-only
- Inaccessible from userspace
Normalcache strategy
Any unspecified defaults are not guaranteed, and should be explicitly specified with the relevant methods if specific behaviour is required.
Sourcepub const fn caching(self, caching: Caching) -> Self
pub const fn caching(self, caching: Caching) -> Self
Sets the caching method used for the mapping.
See Caching for more information.
Sourcepub const fn protection(
self,
writable: bool,
executable: bool,
user_accessible: bool,
) -> Self
pub const fn protection( self, writable: bool, executable: bool, user_accessible: bool, ) -> Self
Sets the protection bits used when creating the mapping.
Sourcepub fn with_allocator<const RAM_ONLY: bool>(
self,
allocator: impl Into<DynPmm<'static, RAM_ONLY>>,
) -> Self
pub fn with_allocator<const RAM_ONLY: bool>( self, allocator: impl Into<DynPmm<'static, RAM_ONLY>>, ) -> Self
Uses allocator to supply the physical memory for the mapping.
Sourcepub const fn physical_location(self, at: RawFrame) -> Self
pub const fn physical_location(self, at: RawFrame) -> Self
Requires the mapping to be at a specific physical address.
Sourcepub const fn virtual_location(self, at: RawPage) -> Self
pub const fn virtual_location(self, at: RawPage) -> Self
Requires the mapping to be at a specific virtual address.