Skip to main content

mshv_bindings/arm64/
regs.rs

1// Copyright © 2025, Microsoft Corporation
2//
3// SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause
4//
5
6#[cfg(feature = "with-serde")]
7use serde_derive::{Deserialize, Serialize};
8use zerocopy::{FromBytes, IntoBytes};
9
10use super::hv_register_name;
11
12/*
13* Note: Only add fields to the end of this struct otherwise it will
14* break the get/set_reg function in the Vcpu trait.
15*/
16#[repr(C, packed)]
17#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, IntoBytes, FromBytes)]
18#[cfg_attr(feature = "with-serde", derive(Deserialize, Serialize))]
19pub struct StandardRegisters {
20    pub regs: [u64; 31usize], // 31 General Purpose registers
21    pub sp: u64,              // Stack Pointer
22    pub pc: u64,              // Program Counter
23    pub pstate: u64,          // Program Status register
24    pub sp_el1: u64,          // Stack Pointer for EL1
25    pub elr_el1: u64,         // Exception Link register for EL1
26    pub fpsr: u64,            // Floating point status register
27    pub fpcr: u64,            // Floating point control register
28}
29
30#[derive(Debug, Default, Clone, PartialEq, Eq)]
31#[cfg_attr(feature = "with-serde", derive(Deserialize, Serialize))]
32pub struct MshvRegList {
33    pub reg_list: Vec<hv_register_name>,
34}
35
36#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, IntoBytes, FromBytes)]
37#[cfg_attr(feature = "with-serde", derive(Deserialize, Serialize))]
38pub struct MshvVcpuInit;