cpuid brand string

This commit is contained in:
Masato Imai
2025-06-25 05:05:34 +00:00
parent 84f619206c
commit bd96723361
2 changed files with 4 additions and 2 deletions

View File

@ -5,10 +5,9 @@ use super::{vcpu::VCpu, vmcs::VmxLeaf};
pub fn handle_cpuid_exit(vcpu: &mut VCpu) { pub fn handle_cpuid_exit(vcpu: &mut VCpu) {
let regs = &mut vcpu.guest_registers; let regs = &mut vcpu.guest_registers;
info!("CPUID called with EAX={:#x}, ECX={:#x}", regs.rax, regs.rcx);
let vendor: &[u8; 12] = b"miHypervisor"; let vendor: &[u8; 12] = b"miHypervisor";
let brand_string: &[u8; 48] = b"Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz \0"; let brand_string: &[u8; 48] = b"mii Hypervisor CPU on Intel VT-x \0";
let vendor = unsafe { core::mem::transmute::<&[u8; 12], &[u32; 3]>(vendor) }; let vendor = unsafe { core::mem::transmute::<&[u8; 12], &[u32; 3]>(vendor) };
let brand_string = unsafe { core::mem::transmute::<&[u8; 48], &[u32; 12]>(brand_string) }; let brand_string = unsafe { core::mem::transmute::<&[u8; 48], &[u32; 12]>(brand_string) };

View File

@ -656,6 +656,9 @@ impl VmxLeaf {
0xD => VmxLeaf::EXTENDED_ENUMERATION, 0xD => VmxLeaf::EXTENDED_ENUMERATION,
0x80000000 => VmxLeaf::EXTENDED_FUNCTION, 0x80000000 => VmxLeaf::EXTENDED_FUNCTION,
0x80000001 => VmxLeaf::EXTENDED_PROCESSOR_SIGNATURE, 0x80000001 => VmxLeaf::EXTENDED_PROCESSOR_SIGNATURE,
0x80000002 => VmxLeaf::EXTENDED_FEATURE_2,
0x80000003 => VmxLeaf::EXTENDED_FEATURE_3,
0x80000004 => VmxLeaf::EXTENDED_FEATURE_4,
_ => VmxLeaf::UNKNOWN, _ => VmxLeaf::UNKNOWN,
} }
} }