pub const fn new_page(
        writable: bool,
        // if false, user mode cannot access this pag
        user_access: bool,
        // memory cache type
        mem_ty: PATMemoryType,
        // if cr4.PGE = 1, determine the translation is global, otherwise must be 0
        global: bool,
        page_phys: PhysAddr,
        xd: bool
    ) -> Self {
        let mut entry = page_phys | ENTRY_PRESENT;
        entry = mask_assign(entry, writable as u64, 1, 0, 1);
        entry = mask_assign(entry, user_access as u64, 2, 0, 1);
        entry = mask_assign(entry, mem_ty.pwt as u64, 3, 0, 1);
        entry = mask_assign(entry, mem_ty.pcd as u64, 4, 0, 1);
        entry = mask_assign(entry, 1, 7, 0, 1);
        entry = mask_assign(entry, global as u64, 8, 0, 1);
        entry = mask_assign(entry, mem_ty.pat as u64, 12, 0, 1);
        entry = mask_assign(entry, xd as u64, 63, 0, 1);
        Self(entry)
    }
/// Create a PDT entry representing a 2MiB page.
/// Make sure that page_phys is 2MiB aligned (1 << 21)
Create a PDT entry representing a 2MiB page.
Make sure that page_phys is 2MiB aligned (1 << 21)
Create a PDT entry representing a 2MiB page . Make sure that page_phys is 2MiB aligned ( 1 << 21 )
pub const fn new_page(
        writable: bool,
        // if false, user mode cannot access this pag
        user_access: bool,
        // memory cache type
        mem_ty: PATMemoryType,
        // if cr4.PGE = 1, determine the translation is global, otherwise must be 0
        global: bool,
        page_phys: PhysAddr,
        xd: bool
    ) -> Self {
        let mut entry = page_phys | ENTRY_PRESENT;
        entry = mask_assign(entry, writable as u64, 1, 0, 1);
        entry = mask_assign(entry, user_access as u64, 2, 0, 1);
        entry = mask_assign(entry, mem_ty.pwt as u64, 3, 0, 1);
        entry = mask_assign(entry, mem_ty.pcd as u64, 4, 0, 1);
        entry = mask_assign(entry, 1, 7, 0, 1);
        entry = mask_assign(entry, global as u64, 8, 0, 1);
        entry = mask_assign(entry, mem_ty.pat as u64, 12, 0, 1);
        entry = mask_assign(entry, xd as u64, 63, 0, 1);
        Self(entry)
    }
pub const fn new_page ( writable : bool , // if false, user mode cannot access this pag user_access : bool , // memory cache type mem_ty : PATMemoryType , // if cr4.PGE = 1, determine the translation is global, otherwise must be 0 global : bool , page_phys : PhysAddr , xd : bool ) -> Self { let mut entry = page_phys | ENTRY_PRESENT ; entry = mask_assign ( entry , writable as u64 , 1 , 0 , 1 ) ; entry = mask_assign ( entry , user_access as u64 , 2 , 0 , 1 ) ; entry = mask_assign ( entry , mem_ty . pwt as u64 , 3 , 0 , 1 ) ; entry = mask_assign ( entry , mem_ty . pcd as u64 , 4 , 0 , 1 ) ; entry = mask_assign ( entry , 1 , 7 , 0 , 1 ) ; entry = mask_assign ( entry , global as u64 , 8 , 0 , 1 ) ; entry = mask_assign ( entry , mem_ty . pat as u64 , 12 , 0 , 1 ) ; entry = mask_assign ( entry , xd as u64 , 63 , 0 , 1 ) ; Self ( entry ) }
Create a PDT entry representing a 2MiB page.
Create a PDT entry representing a 2MiB page .
writable
bool
user_access
bool
mem_ty
PATMemoryType
global
bool
page_phys
PhysAddr
xd
bool