/// Enable 'No-Execute' bit in page entry
Enable 'No-Execute' bit in page entry
Enable ' No - Execute ' bit in page entry
pub fn enable_nxe_bit() {
    use x86_64::registers::msr::{IA32_EFER, rdmsr, wrmsr};
    let nxe_bit = 1 << 11;
    // The EFER register is only allowed in kernel mode
    // But we are in kernel mode. So it's safe.
    unsafe {
        let efer = rdmsr(IA32_EFER);
        wrmsr(IA32_EFER, efer | nxe_bit);
    }
}
pub fn enable_nxe_bit ( ) { use x86_64 :: registers :: msr :: { IA32_EFER , rdmsr , wrmsr } ; let nxe_bit = 1 << 11 ; // The EFER register is only allowed in kernel mode // But we are in kernel mode. So it's safe. unsafe { let efer = rdmsr ( IA32_EFER ) ; wrmsr ( IA32_EFER , efer | nxe_bit ) ; } }
Enable 'No-Execute' bit in page entry
Enable ' No - Execute ' bit in page entry