Open not-matthias opened 8 months ago
Hm sorry about that, the cr4 function uses from_bits_truncate
from bitflags https://github.com/gz/rust-x86/blob/ae3306a372c82a92b2e0f7ca81c6664455625c7f/src/controlregs.rs#L152 to make sure the value only sets the bits that are known to the Cr4 bitflag struct.
This is probably not the best way (when hardware supports new flags that the library doesn't know about yet the bits are dropped).
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.
How to reproduce: