#detect #x86-64 #vm #hypervisor #inspect #virtual #running

vm-detect

Detect if your rust code is running under a virtual machine (only for x86_64 and x86)

1 unstable release

0.1.0 Sep 1, 2023

#215 in Emulators

MIT license

6KB
106 lines

Basic VM detection for x86 and x86_64

Usage:

use vm_detect::{vm_detect, Detection};

fn main() {
    // Run detection
    let detection = vm_detect();

    // Inspect detections
    if detection.contains(Detection::HYPERVISOR_BIT) {
        println!("Hypervisor bit set!");
    }
}

Dependencies

~110KB