-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
我抄过来了第四章第三节的代码,但是在我试图运行的时候发现,在加载userboot时,使用allocate从root VMAR中分配了一块子VMAR,但是其立即把这一块区域放进了子VMAR的inner中,导致在map时通不过test_map检查
// vmar.rs
pub fn allocate(
self: &Arc<Self>,
offset: Option<usize>,
len: usize,
flags: VmarFlags,
align: usize,
) -> RcResult<Arc<Self>> {
let mut guard = self.inner.lock();
let inner = guard.as_mut().ok_or(RcError::BAD_STATE)?;
let offset = self.determine_offset(inner, offset, len, align)?;
let child = Arc::new(VmAddressRegion {
flags,
base: KObjectBase::default(),
addr: self.addr + offset,
size: len,
parent: Some(self.clone()),
page_table: self.page_table.clone(),
inner: Mutex::new(Some(VmarInner::default())),
});
inner.children.push(child.clone());
Ok(child)
}Metadata
Metadata
Assignees
Labels
No labels