You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
volatile_memory: Add on-demand mapping support for Xen
For Xen grant memory mapping model, the memory can't always be mapped in
advance and it may be required to map it on the fly.
This commit adds support for the same by introducing a new field for the
various volatile memory structures: `mmap: Option<&'a MmapInfo>`. The
type `MmapInfo` is set to `PhantomData<()>` for all the existing users,
and is set to `MmapXen` for Xen. All the existing users set the new
field to `None` and so the behavior remains unchanged for them.
With Xen grant memory mappings, the address returned by as_ptr() will
simply be an offset into the region, as the real mapping happens at a
later point.
In order not to break existing users of the API, lets keep the existing
API around for non-xen implementations.
Add new implementations, ptr_guard() and ptr_guard_mut(), for both xen
and non-xen platforms, which can be used to map memory and then get a
pointer to it, work on it, and unmap the memory automatically.
Signed-off-by: Viresh Kumar <[email protected]>
0 commit comments