mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-27 19:33:23 +00:00
implement map vmo to vmar
This commit is contained in:
@ -15,6 +15,7 @@ use crate::mm::PhysFrame;
|
||||
/// type to represent a series of page frames is convenient because,
|
||||
/// more often than not, one needs to operate on a batch of frames rather
|
||||
/// a single frame.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct VmFrameVec(Vec<VmFrame>);
|
||||
|
||||
impl VmFrameVec {
|
||||
@ -44,6 +45,11 @@ impl VmFrameVec {
|
||||
Ok(Self(frame_list))
|
||||
}
|
||||
|
||||
/// returns an empty vmframe vec
|
||||
pub fn empty() -> Self {
|
||||
Self(Vec::new())
|
||||
}
|
||||
|
||||
/// Pushs a new frame to the collection.
|
||||
pub fn push(&mut self, new_frame: VmFrame) {
|
||||
self.0.push(new_frame);
|
||||
@ -74,6 +80,11 @@ impl VmFrameVec {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// zero all internal vm frames
|
||||
pub fn zero(&self) {
|
||||
self.0.iter().for_each(|vm_frame| vm_frame.zero())
|
||||
}
|
||||
|
||||
/// Truncate some frames.
|
||||
///
|
||||
/// If `new_len >= self.len()`, then this method has no effect.
|
||||
|
@ -129,6 +129,7 @@ impl VmIo for VmSpace {
|
||||
|
||||
/// Options for mapping physical memory pages into a VM address space.
|
||||
/// See `VmSpace::map`.
|
||||
#[derive(Clone)]
|
||||
pub struct VmMapOptions {
|
||||
/// start virtual address
|
||||
addr: Option<Vaddr>,
|
||||
|
Reference in New Issue
Block a user