pub fn insert_ram_at(&self, ram: RamCap, vaddr: usize, perm: Permission) -> *mut u8 {
        // TODO: support large page
        let layout = Layout::from_size_align(4096, 4096).unwrap();
        let vaddr = if vaddr == 0 {
            self.vspace_alloc(layout).unwrap()
        } else {
            vaddr
        };
        let mut frame_entry = VSpaceEntry::new_frame(ram.into(), vaddr, perm, 0);
        loop {
            let res = self.vspace_man.install_entry(frame_entry, true);
            if let Err((e, ent)) = res {
                frame_entry = ent;
                match e {
                    // VSpaceManError::SlotOccupied{level} => {
                    //     panic!("slot occupied at level {} vaddr {:x}", level, vaddr);
                    // }
                    // VSpaceManError::SlotTypeError{level} => {
                    //     panic!("wrong slot type at level {} vaddr {:x}", level, vaddr);
                    // }
                    VSpaceManError::PageTableMiss { level } => {
                        let vtable_cap = self.alloc_object::<VTableObj>(12).unwrap();
                        self.vspace_man
                            .map_table(vtable_cap.into(), vaddr, level, true)
                            .unwrap();
                    }
                    e => {
                        panic!("unexpected error {:?}", e);
                    }
                }
            } else {
                break;
            }
        }
        vaddr as *mut u8
    }
/// Insert an RamCap to vspace to manage and handle backed page table
Insert an RamCap to vspace to manage and handle backed page table
Insert an RamCap to vspace to manage and handle backed page table
pub fn insert_ram_at(&self, ram: RamCap, vaddr: usize, perm: Permission) -> *mut u8 {
        // TODO: support large page
        let layout = Layout::from_size_align(4096, 4096).unwrap();
        let vaddr = if vaddr == 0 {
            self.vspace_alloc(layout).unwrap()
        } else {
            vaddr
        };
        let mut frame_entry = VSpaceEntry::new_frame(ram.into(), vaddr, perm, 0);
        loop {
            let res = self.vspace_man.install_entry(frame_entry, true);
            if let Err((e, ent)) = res {
                frame_entry = ent;
                match e {
                    // VSpaceManError::SlotOccupied{level} => {
                    //     panic!("slot occupied at level {} vaddr {:x}", level, vaddr);
                    // }
                    // VSpaceManError::SlotTypeError{level} => {
                    //     panic!("wrong slot type at level {} vaddr {:x}", level, vaddr);
                    // }
                    VSpaceManError::PageTableMiss { level } => {
                        let vtable_cap = self.alloc_object::<VTableObj>(12).unwrap();
                        self.vspace_man
                            .map_table(vtable_cap.into(), vaddr, level, true)
                            .unwrap();
                    }
                    e => {
                        panic!("unexpected error {:?}", e);
                    }
                }
            } else {
                break;
            }
        }
        vaddr as *mut u8
    }
pub fn insert_ram_at ( & self , ram : RamCap , vaddr : usize , perm : Permission ) -> * mut u8 { // TODO: support large page let layout = Layout :: from_size_align ( 4096 , 4096 ) . unwrap ( ) ; let vaddr = if vaddr == 0 { self . vspace_alloc ( layout ) . unwrap ( ) } else { vaddr } ; let mut frame_entry = VSpaceEntry :: new_frame ( ram . into ( ) , vaddr , perm , 0 ) ; loop { let res = self . vspace_man . install_entry ( frame_entry , true ) ; if let Err ( ( e , ent ) ) = res { frame_entry = ent ; match e { // VSpaceManError::SlotOccupied{level} => { //     panic!("slot occupied at level {} vaddr {:x}", level, vaddr); // } // VSpaceManError::SlotTypeError{level} => { //     panic!("wrong slot type at level {} vaddr {:x}", level, vaddr); // } VSpaceManError :: PageTableMiss { level } => { let vtable_cap = self . alloc_object :: < VTableObj > ( 12 ) . unwrap ( ) ; self . vspace_man . map_table ( vtable_cap . into ( ) , vaddr , level , true ) . unwrap ( ) ; } e => { panic ! ( " " e ) ; } } } else { break ; } } vaddr as * mut u8 }
Insert an RamCap to vspace to manage and handle backed page table
Insert an RamCap to vspace to manage and handle backed page table
&self
ram
RamCap
vaddr
usize
perm
Permission