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:
Oliver Anderson
2026-06-08 09:03:17 +02:00
committed by Rob Bradford
parent 838d01b0bc
commit 37aa545c2a
2 changed files with 19 additions and 0 deletions

View File

@@ -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.

View 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,
);