pub trait AddrTranslator: Sync {
// Required method
fn virt_to_phys(&self, va: usize) -> Option<usize>;
}Expand description
Address translator used by allocators to reason about physical addresses.
Implementations should provide a stable virtual-to-physical mapping for the allocator-managed address range.
§Examples
use buddy_slab_allocator::AddrTranslator;
struct SimpleMapper;
impl AddrTranslator for SimpleMapper {
fn virt_to_phys(&self, va: usize) -> Option<usize> {
// Identity mapping for this example
Some(va)
}
}Required Methods§
Sourcefn virt_to_phys(&self, va: usize) -> Option<usize>
fn virt_to_phys(&self, va: usize) -> Option<usize>
Translate a virtual address to a physical address.
Returns None if the address is not valid or not mapped.