pub struct Config<'physical_allocator, A: AddressSpaceTy = Kernel> {
physical_location: Location<Frame>,
virtual_location: Location<Page>,
_laziness: Laziness,
length: NonZero<usize>,
physical_allocator: &'physical_allocator dyn PhysicalAllocator,
address_space: A,
protection: Protection,
}
use_std
only.Expand description
Configuration for creating a mapping
By default, it will allocate memory anywhere that is valid, using the kernel AddressSpace
, and the
highmem
physical allocator
. It will lazily allocate physical memory, and map it
with read, write and execute permissions.
Fields§
§physical_location: Location<Frame>
§virtual_location: Location<Page>
§_laziness: Laziness
§length: NonZero<usize>
§physical_allocator: &'physical_allocator dyn PhysicalAllocator
§address_space: A
§protection: Protection
Implementations§
Source§impl Config<'static, Kernel>
impl Config<'static, Kernel>
1.1.0 · Sourcepub fn new(length: NonZero<usize>) -> Self
pub fn new(length: NonZero<usize>) -> Self
Creates a new mapping configuration with default options
length
is specified in pages
The default options are not guaranteed, but at the moment are:
- physical and virtual locations: anywhere
- lazily allocated
- Highmem physical allocator
- Kernel address space
- Readable, writable and executable
Source§impl Config<'static, Userspace>
impl Config<'static, Userspace>
1.1.0 · Sourcepub fn new_in(length: NonZero<usize>, address_space: &AddressSpace) -> Self
pub fn new_in(length: NonZero<usize>, address_space: &AddressSpace) -> Self
Creates a new mapping configuration with default options, but in the specified address space
length
is specified in pages
The default options are not guaranteed, but at the moment are:
- physical and virtual locations: anywhere
- lazily allocated
- Highmem physical allocator
- Readable, writable and executable
Source§impl<'physical_allocator, A: AddressSpaceTy> Config<'physical_allocator, A>
impl<'physical_allocator, A: AddressSpaceTy> Config<'physical_allocator, A>
Sourcepub fn physical_allocator<'a>(
self,
allocator: &'a dyn PhysicalAllocator,
) -> Config<'a, A>
🔬This is a nightly-only experimental API. (kernel_mmap_config
#24)
pub fn physical_allocator<'a>( self, allocator: &'a dyn PhysicalAllocator, ) -> Config<'a, A>
kernel_mmap_config
#24)Set the physical allocator to use
This is used for both the underlying memory and any page tables that need creating
pub fn protection(self, protection: Protection) -> Self
kernel_mmap_config
#24)1.1.0 · Sourcepub fn physical_location(self, location: Location<Frame>) -> Self
pub fn physical_location(self, location: Location<Frame>) -> Self
Set the physical location of the low address of the mapping
Sourcepub fn virtual_location(self, location: Location<Page>) -> Self
🔬This is a nightly-only experimental API. (kernel_mmap_config
#24)
pub fn virtual_location(self, location: Location<Page>) -> Self
kernel_mmap_config
#24)Set the virtual location of the low address of the mapping
This is currently ignored