Skip to content

Invalid value for CR4 #156

Open
Open
@not-matthias

Description

While writing my hypervisor, I noticed crashes after 10 seconds. After a week debugging this issue, I realized that reading CR4 using this crate is the issue.

INFO: CR4 (manual): b52ef8
INFO: CR4 (x86_64): b52ef8
INFO: CR4 (x86): 	352ef8

How to reproduce:

let mut value= 0;
unsafe { core::arch::asm!("mov {}, cr4", out(reg) value) };
log::info!("CR4 (manual): {:x}", value);

let value = x86_64::registers::control::Cr4::read_raw();
log::info!("CR4 (x86_64): {:x}",  value);

let value = unsafe { x86::controlregs::cr4() };
log::info!("CR4 (x86): {:x}", value);

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions