#[cfg(target_arch = "x86_64")]
pub use libc::user_fpregs_struct as FpRegs;
pub use libc::user_regs_struct as Regs;
#[cfg(target_arch = "x86_64")]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct XState(pub(crate) Vec<u8>);
#[cfg(target_arch = "aarch64")]
#[repr(C)]
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
#[allow(missing_docs)]
pub struct FpRegs {
pub vregs: [u128; 32],
pub fpsr: u32,
pub fpcr: u32,
__reserved: [u32; 2],
}
#[cfg(target_arch = "x86_64")]
mod xstate_pkru;
#[cfg(target_arch = "x86_64")]
pub use xstate_pkru::XStatePkruError;
#[cfg(target_arch = "aarch64")]
#[repr(C)]
#[derive(Debug, Copy, Clone, Default, Eq, PartialEq)]
pub struct HwBreakpoint {
pub addr: u64,
pub ctrl: u32,
pad: u32,
}
#[cfg(target_arch = "aarch64")]
impl HwBreakpoint {
pub fn at(addr: u64) -> Self {
Self {
addr,
ctrl: (0b1111 << 5) | (0b10 << 1) | 1,
pad: 0,
}
}
pub fn enabled(&self) -> bool {
self.ctrl & 1 != 0
}
}
#[cfg(target_arch = "aarch64")]
#[repr(C)]
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub struct HwBreakpoints {
dbg_info: u32,
pad: u32,
pub regs: [HwBreakpoint; 16],
}
#[cfg(target_arch = "aarch64")]
impl HwBreakpoints {
pub fn slots(&self) -> usize {
usize::from(self.dbg_info as u8).min(self.regs.len())
}
}