Module memflow::mem::virt_translate
source · Expand description
Virtual address translation
This module describes virtual to physical address translation interfaces.
-
VirtualTranslate - user facing trait providing a way to translate addresses.
-
VirtualTranslate2 - internally used trait that translates pairs of buffers and virtual addresses into pairs of buffers and their corresponding physical addresses. Is used to provide virtual memory view. This trait is also a point of caching for the translations.
-
VirtualTranslate3 - a sub-scope that translates addresses of a single address space. Objects that implement VirtualTranslate3 are designed to be cheap to construct, because they use pooled resources from VirtualTranslate2 objects. This is equivalent to storing a single VirtualTranslate2 state for the OS, while constructing VirtualTranslate3 instances for each process. This is precisely what is being done in our Win32 OS (see here, and here).
Below figure shows entire pipeline of a virtual address translating object with caching.
+--------------------------+
| (Win32Process) |
| VirtualTranslate | (Contains VT2+VT3+Phys)
| MemoryView |
+--------------------------+
|
|
+-----------+--------------+
| (CachedVirtualTranslate) | (Accepts VT3+Phys)
| VirtualTranslate2 | (Point of caching)
+--------------------------+
|
|
+--------+----------+
| (DirectTranslate) | (Accepts VT3+Phys)
| VirtualTranslate2 | (Contains 64MB buffer)
+-------------------+
|
|
+----------+-------------+
| (X86 VirtualTranslate) | (Accepts 64MB buffer+Phys)
| VirtualTranslate3 | (Contains CR3+ArchMmuSpec)
+------------------------+
|
|
+------+------+
| ArchMmuSpec | (Accepts translation root (CR3), buffer, Phys)
+-------------+ (Contains architecture specification)
|
|
+-------+--------+
| PhysicalMemory | (Accepts special page flags)
+----------------+
|
|
... (Further nesting)
Re-exports
pub use direct_translate::DirectTranslate;
pub use cache::*;
Modules
Structs
- Virtual page range information with physical mappings used for callbacks
Traits
- Translates virtual addresses into physical ones.
- Translates virtual memory to physical using internal translation base (usually a process’ dtb)