mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-21 16:33:24 +00:00
Add uninit option for VmAllocOption
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
7304e06c88
commit
7803d9037e
@ -112,7 +112,8 @@ struct Page {
|
||||
impl Page {
|
||||
pub fn alloc() -> Result<Self> {
|
||||
let frame = {
|
||||
let vm_alloc_option = VmAllocOptions::new(1);
|
||||
let mut vm_alloc_option = VmAllocOptions::new(1);
|
||||
vm_alloc_option.uninit(true);
|
||||
let mut frames = VmFrameVec::allocate(&vm_alloc_option)?;
|
||||
frames.pop().unwrap()
|
||||
};
|
||||
@ -126,7 +127,6 @@ impl Page {
|
||||
let frame = {
|
||||
let vm_alloc_option = VmAllocOptions::new(1);
|
||||
let mut frames = VmFrameVec::allocate(&vm_alloc_option)?;
|
||||
frames.zero();
|
||||
frames.pop().unwrap()
|
||||
};
|
||||
Ok(Self {
|
||||
|
@ -204,9 +204,7 @@ impl Vmo_ {
|
||||
let frames = match &inner.pager {
|
||||
None => {
|
||||
let vm_alloc_option = VmAllocOptions::new(1);
|
||||
let frames = VmFrameVec::allocate(&vm_alloc_option)?;
|
||||
frames.iter().for_each(|frame| frame.zero());
|
||||
frames
|
||||
VmFrameVec::allocate(&vm_alloc_option)?
|
||||
}
|
||||
Some(pager) => {
|
||||
let frame = pager.commit_page(offset)?;
|
||||
|
Reference in New Issue
Block a user