/// Allocate heap memory to address `brk`
Allocate heap memory to address `brk`
Allocate heap memory to address ` brk `
pub fn brk(&mut self, brk: usize) -> usize {
        let old = self.offset_page_up(self.pos()).unwrap();
        let new = match self.offset_page_up(brk) {
            Some(page) => page,
            None => return self.pos(),
        };
        if old < new {
            for page in old..new {
                if self.is_allocated(page) {
                    return self.pos();
                }
            }
            for page in old..new {
                self.allocate(page);
            }
        } else {
            for page in old..new {
                self.deallocate(page);
            }
        }
        self.brk = NonZeroUsize::new(brk);
        brk
    }
pub fn brk ( & mut self , brk : usize ) -> usize { let old = self . offset_page_up ( self . pos ( ) ) . unwrap ( ) ; let new = match self . offset_page_up ( brk ) { Some ( page ) => page , None => return self . pos ( ) , } ; if old < new { for page in old .. new { if self . is_allocated ( page ) { return self . pos ( ) ; } } for page in old .. new { self . allocate ( page ) ; } } else { for page in old .. new { self . deallocate ( page ) ; } } self . brk = NonZeroUsize :: new ( brk ) ; brk }
Allocate heap memory to address `brk`
Allocate heap memory to address ` brk `
&mut self
brk
usize