pub unsafe fn generate_identity_maps(
        &self,
        out: &mut Vec<(VirtualAddress, PageCount, Page<PhysicalAddress>)>,
    ) {
        let initial_len = out.len();

        // First, identity map low 1 MB of memory.
        out.push((KERNEL_OFFSET, 0x100000/PAGE_SIZE,
            Some((0x0, PageType::default().writable()))));

        // Load kernel section symbols
        extern {
            static _bootstrap_begin: u8;
            static _bootstrap_data_begin: u8;
            static _bootstrap_end: u8;
            static _kernel_text_begin: u8;
            static _kernel_text_end: u8;
            static _kernel_rodata_begin: u8;
            static _kernel_rodata_end: u8;
            static _kernel_data_begin: u8;
            static _kernel_data_end: u8;
            static _kernel_bss_begin: u8;
            static _kernel_bss_end: u8;
            static _kernel_got_begin: u8;
            static _kernel_got_end: u8;
            static _kernel_got_plt_begin: u8;
            static _kernel_got_plt_end: u8;
        }

        // These symbols are low memory addressed, so we have to add the offset
        let bootstrap_begin =
            (&_bootstrap_begin as *const u8).wrapping_add(KERNEL_OFFSET);
        let bootstrap_data_begin =
            (&_bootstrap_begin as *const u8).wrapping_add(KERNEL_OFFSET);
        let bootstrap_end =
            (&_bootstrap_end as *const u8).wrapping_add(KERNEL_OFFSET);

        let sections: [(*const u8, *const u8, PageType); 8] = [
            (bootstrap_begin, bootstrap_data_begin,
             PageType::default()),
            (bootstrap_data_begin, bootstrap_end,
             PageType::default().writable()),
            // The rest are high memory addressed, just map them accordingly
            (&_kernel_text_begin, &_kernel_text_end,
             PageType::default().executable()),
            (&_kernel_rodata_begin, &_kernel_rodata_end,
             PageType::default()),
            (&_kernel_data_begin, &_kernel_data_end,
             PageType::default().writable()),
            (&_kernel_bss_begin, &_kernel_bss_end,
             PageType::default().writable()),
            (&_kernel_got_begin, &_kernel_got_end,
             PageType::default().writable()),
            (&_kernel_got_plt_begin, &_kernel_got_plt_end,
             PageType::default().writable()),
        ];

        for &(begin, end, page_type) in &sections[..] {
            let bytes = end as usize - begin as usize;
            let pages = align_up(bytes, PAGE_SIZE) / PAGE_SIZE;

            out.push((
                begin as usize,
                pages,
                Some((begin as usize - KERNEL_OFFSET, page_type))
            ));
        }

        // Add modules, identity mapped, read-only
        if let Some(modules) = self.modules() {
            for module in modules {
                let bytes =
                    module.mod_end as usize - module.mod_start as usize;
                let pages = align_up(bytes, PAGE_SIZE) / PAGE_SIZE;

                out.push((
                    KERNEL_OFFSET + module.mod_start as usize,
                    pages,
                    Some((module.mod_start as usize, PageType::default()))
                ));
            }
        }

        debug!("Multiboot identity map: {:08X?}", &out[initial_len..]);
    }
/// Generate required identity maps to preserve kernel, modules, and
/// multiboot info.
Generate required identity maps to preserve kernel, modules, and
multiboot info.
Generate required identity maps to preserve kernel modules and multiboot info .
pub unsafe fn generate_identity_maps(
        &self,
        out: &mut Vec<(VirtualAddress, PageCount, Page<PhysicalAddress>)>,
    ) {
        let initial_len = out.len();
        // First, identity map low 1 MB of memory.
        out.push((KERNEL_OFFSET, 0x100000/PAGE_SIZE,
            Some((0x0, PageType::default().writable()))));
        // Load kernel section symbols
        extern {
            static _bootstrap_begin: u8;
            static _bootstrap_data_begin: u8;
            static _bootstrap_end: u8;
            static _kernel_text_begin: u8;
            static _kernel_text_end: u8;
            static _kernel_rodata_begin: u8;
            static _kernel_rodata_end: u8;
            static _kernel_data_begin: u8;
            static _kernel_data_end: u8;
            static _kernel_bss_begin: u8;
            static _kernel_bss_end: u8;
            static _kernel_got_begin: u8;
            static _kernel_got_end: u8;
            static _kernel_got_plt_begin: u8;
            static _kernel_got_plt_end: u8;
        }
        // These symbols are low memory addressed, so we have to add the offset
        let bootstrap_begin =
            (&_bootstrap_begin as *const u8).wrapping_add(KERNEL_OFFSET);
        let bootstrap_data_begin =
            (&_bootstrap_begin as *const u8).wrapping_add(KERNEL_OFFSET);
        let bootstrap_end =
            (&_bootstrap_end as *const u8).wrapping_add(KERNEL_OFFSET);
        let sections: [(*const u8, *const u8, PageType); 8] = [
            (bootstrap_begin, bootstrap_data_begin,
             PageType::default()),
            (bootstrap_data_begin, bootstrap_end,
             PageType::default().writable()),
            // The rest are high memory addressed, just map them accordingly
            (&_kernel_text_begin, &_kernel_text_end,
             PageType::default().executable()),
            (&_kernel_rodata_begin, &_kernel_rodata_end,
             PageType::default()),
            (&_kernel_data_begin, &_kernel_data_end,
             PageType::default().writable()),
            (&_kernel_bss_begin, &_kernel_bss_end,
             PageType::default().writable()),
            (&_kernel_got_begin, &_kernel_got_end,
             PageType::default().writable()),
            (&_kernel_got_plt_begin, &_kernel_got_plt_end,
             PageType::default().writable()),
        ];
        for &(begin, end, page_type) in &sections[..] {
            let bytes = end as usize - begin as usize;
            let pages = align_up(bytes, PAGE_SIZE) / PAGE_SIZE;
            out.push((
                begin as usize,
                pages,
                Some((begin as usize - KERNEL_OFFSET, page_type))
            ));
        }
        // Add modules, identity mapped, read-only
        if let Some(modules) = self.modules() {
            for module in modules {
                let bytes =
                    module.mod_end as usize - module.mod_start as usize;
                let pages = align_up(bytes, PAGE_SIZE) / PAGE_SIZE;
                out.push((
                    KERNEL_OFFSET + module.mod_start as usize,
                    pages,
                    Some((module.mod_start as usize, PageType::default()))
                ));
            }
        }
        debug!("Multiboot identity map: {:08X?}", &out[initial_len..]);
    }
pub unsafe fn generate_identity_maps ( & self , out : & mut Vec < ( VirtualAddress , PageCount , Page < PhysicalAddress > ) > , ) { let initial_len = out . len ( ) ; // First, identity map low 1 MB of memory. out . push ( ( KERNEL_OFFSET , 0x100000 / PAGE_SIZE , Some ( ( 0x0 , PageType :: default ( ) . writable ( ) ) ) ) ) ; // Load kernel section symbols extern { static _bootstrap_begin : u8 ; static _bootstrap_data_begin : u8 ; static _bootstrap_end : u8 ; static _kernel_text_begin : u8 ; static _kernel_text_end : u8 ; static _kernel_rodata_begin : u8 ; static _kernel_rodata_end : u8 ; static _kernel_data_begin : u8 ; static _kernel_data_end : u8 ; static _kernel_bss_begin : u8 ; static _kernel_bss_end : u8 ; static _kernel_got_begin : u8 ; static _kernel_got_end : u8 ; static _kernel_got_plt_begin : u8 ; static _kernel_got_plt_end : u8 ; } // These symbols are low memory addressed, so we have to add the offset let bootstrap_begin = ( & _bootstrap_begin as * const u8 ) . wrapping_add ( KERNEL_OFFSET ) ; let bootstrap_data_begin = ( & _bootstrap_begin as * const u8 ) . wrapping_add ( KERNEL_OFFSET ) ; let bootstrap_end = ( & _bootstrap_end as * const u8 ) . wrapping_add ( KERNEL_OFFSET ) ; let sections : [ ( * const u8 , * const u8 , PageType ) ; 8 ] = [ ( bootstrap_begin , bootstrap_data_begin , PageType :: default ( ) ) , ( bootstrap_data_begin , bootstrap_end , PageType :: default ( ) . writable ( ) ) , // The rest are high memory addressed, just map them accordingly ( & _kernel_text_begin , & _kernel_text_end , PageType :: default ( ) . executable ( ) ) , ( & _kernel_rodata_begin , & _kernel_rodata_end , PageType :: default ( ) ) , ( & _kernel_data_begin , & _kernel_data_end , PageType :: default ( ) . writable ( ) ) , ( & _kernel_bss_begin , & _kernel_bss_end , PageType :: default ( ) . writable ( ) ) , ( & _kernel_got_begin , & _kernel_got_end , PageType :: default ( ) . writable ( ) ) , ( & _kernel_got_plt_begin , & _kernel_got_plt_end , PageType :: default ( ) . writable ( ) ) , ] ; for & ( begin , end , page_type ) in & sections [ .. ] { let bytes = end as usize - begin as usize ; let pages = align_up ( bytes , PAGE_SIZE ) / PAGE_SIZE ; out . push ( ( begin as usize , pages , Some ( ( begin as usize - KERNEL_OFFSET , page_type ) ) ) ) ; } // Add modules, identity mapped, read-only if let Some ( modules ) = self . modules ( ) { for module in modules { let bytes = module . mod_end as usize - module . mod_start as usize ; let pages = align_up ( bytes , PAGE_SIZE ) / PAGE_SIZE ; out . push ( ( KERNEL_OFFSET + module . mod_start as usize , pages , Some ( ( module . mod_start as usize , PageType :: default ( ) ) ) ) ) ; } } debug ! ( " " out [ initial_len ] ) ; }
Generate required identity maps to preserve kernel, modules, and
multiboot info.
Generate required identity maps to preserve kernel modules and multiboot info .
&self
out
&mut Vec<(VirtualAddress, PageCount, Page<PhysicalAddress>)>