Add linear_phys_to_virt and vice versa.
However, since not all platforms will allow the entire physical address space to be simultaneously mapped to part of the virtual address space, we may still require some dynamic mapping.
This commit is contained in:
@@ -335,6 +335,14 @@ impl InactivePageTable {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn linear_phys_to_virt(physical: PhysicalAddress) -> Option<VirtualAddress> {
|
||||
physical.data().checked_add(crate::KERNEL_OFFSET).map(VirtualAddress::new)
|
||||
}
|
||||
pub fn linear_virt_to_phys(virt: VirtualAddress) -> Option<PhysicalAddress> {
|
||||
virt.data().checked_sub(crate::KERNEL_OFFSET).map(PhysicalAddress::new)
|
||||
}
|
||||
|
||||
|
||||
/// Page
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct Page {
|
||||
|
||||
Reference in New Issue
Block a user