mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
arch: Wrapper type for (de-)serializing MSR register addresses
CPU Profiles will be serialized to JSON by the upcoming CPU Profile generation tool and we want MSRs to be serialized as hex strings. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
This commit is contained in:
committed by
Rob Bradford
parent
838d01b0bc
commit
37aa545c2a
@@ -17,6 +17,7 @@ const TILECFG_MASK: u32 = 1_u32 << AMX_TILECFG_BIT;
|
||||
const TILEDATA_MASK: u32 = 1_u32 << AMX_TILEDATA_BIT;
|
||||
|
||||
pub mod cpuid_adjustments;
|
||||
pub mod msr_adjustments;
|
||||
|
||||
// TODO: Auto generate the CpuProfile enum with a build script once we introduce user facing CPU profiles.
|
||||
|
||||
|
||||
18
arch/src/x86_64/cpu_profile/msr_adjustments.rs
Normal file
18
arch/src/x86_64/cpu_profile/msr_adjustments.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
// Copyright © 2026 Cyberus Technology GmbH
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::x86_64::helpers::{deserialize_u32_hex, serialize_u32_hex};
|
||||
|
||||
/// The register address of an MSR
|
||||
#[derive(Debug, Copy, Clone, Eq, PartialEq, Serialize, Deserialize)]
|
||||
pub struct RegisterAddress(
|
||||
#[serde(
|
||||
serialize_with = "serialize_u32_hex",
|
||||
deserialize_with = "deserialize_u32_hex"
|
||||
)]
|
||||
pub u32,
|
||||
);
|
||||
Reference in New Issue
Block a user