mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-01 09:25:21 +00:00
hypervisor: Implement fmt::Display for CpuIdEntry
Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
This commit is contained in:
parent
8f98fabd0b
commit
293cf90e3d
@ -11,6 +11,8 @@
|
|||||||
// Copyright © 2020, Microsoft Corporation
|
// Copyright © 2020, Microsoft Corporation
|
||||||
//
|
//
|
||||||
|
|
||||||
|
use core::fmt;
|
||||||
|
|
||||||
#[cfg(all(feature = "mshv_emulator", target_arch = "x86_64"))]
|
#[cfg(all(feature = "mshv_emulator", target_arch = "x86_64"))]
|
||||||
pub mod emulator;
|
pub mod emulator;
|
||||||
pub mod gdt;
|
pub mod gdt;
|
||||||
@ -211,6 +213,22 @@ pub struct CpuIdEntry {
|
|||||||
pub edx: u32,
|
pub edx: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for CpuIdEntry {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
write!(
|
||||||
|
f,
|
||||||
|
"function = 0x{:08x} \
|
||||||
|
index = 0x{:08x} \
|
||||||
|
eax = 0x{:08x} \
|
||||||
|
ebx = 0x{:08x} \
|
||||||
|
ecx = 0x{:08x} \
|
||||||
|
edx = 0x{:08x} \
|
||||||
|
flags = 0x{:08x}",
|
||||||
|
self.function, self.index, self.eax, self.ebx, self.ecx, self.edx, self.flags
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub const CPUID_FLAG_VALID_INDEX: u32 = 1;
|
pub const CPUID_FLAG_VALID_INDEX: u32 = 1;
|
||||||
|
|
||||||
#[derive(Default, Debug, Clone, serde::Deserialize, serde::Serialize)]
|
#[derive(Default, Debug, Clone, serde::Deserialize, serde::Serialize)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user