Skip to main content

UserXstate

Struct UserXstate 

Source
pub struct UserXstate { /* private fields */ }
Expand description

A 64-byte-aligned memory region for the XSAVE/XRSTOR instructions, which save and restore the full XCR0-enabled extended state (x87, SSE/XMM, and the upper 128 bits of the AVX YMM registers that FXSAVE/FXRSTOR drop).

The first 512 bytes share the legacy FxsaveArea layout, so the FXSAVE fallback path (CPUs/VMs without XSAVE, e.g. the default qemu64 model) reads and writes the same region.

See https://www.felixcloutier.com/x86/xsave for more details.

Implementations§

Source§

impl UserXstate

Source

pub const fn initial() -> Self

Available on crate feature fp-simd only.

Returns the architecture’s initial user FPU state image.

Source

pub fn user_size() -> Option<usize>

Available on crate feature fp-simd only.

Returns the standard, non-compacted x86 user xstate size enabled by XCR0.

None means this CPU uses the FXSAVE fallback and therefore does not provide Linux’s NT_X86_XSTATE regset.

Source

pub fn user_feature_mask() -> u64

Available on crate feature fp-simd only.

Returns the user xfeatures enabled by the boot-time XCR0 policy.

Source

pub const fn fxsave_area(&self) -> &FxsaveArea

Available on crate feature fp-simd only.

Returns the legacy 512-byte FXSAVE region.

Source

pub fn fxsave_bytes(&self) -> &[u8]

Available on crate feature fp-simd only.

Returns the legacy 512-byte FXSAVE region as bytes.

Source

pub fn user_bytes(&self) -> Option<&[u8]>

Available on crate feature fp-simd only.

Returns the enabled standard-format user xstate bytes.

Source

pub fn replace_fxsave_area(&mut self, area: FxsaveArea) -> bool

Available on crate feature fp-simd only.

Replaces the Linux FXSAVE-compatible portion while retaining all other xfeatures, as PTRACE_SETFPREGS/NT_PRFPREG require.

Source

pub fn replace_fxsave_bytes(&mut self, bytes: &[u8]) -> bool

Available on crate feature fp-simd only.

Replaces the Linux FXSAVE-compatible portion from its byte UABI.

Source

pub fn replace_user_bytes(&mut self, bytes: &[u8]) -> bool

Available on crate feature fp-simd only.

Replaces the complete standard-format user xstate after validating the Linux UABI header, enabled feature mask, and MXCSR reserved bits.

Source

pub fn replace_user_bytes_prefix(&mut self, bytes: &[u8]) -> bool

Available on crate feature fp-simd only.

Replaces a standard-format user xstate prefix from an older signal ABI.

Components absent from the supplied prefix enter their architectural initial state. Every feature named in XSTATE_BV must fit completely in the supplied prefix.

Trait Implementations§

Source§

impl Clone for UserXstate

Source§

fn clone(&self) -> UserXstate

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for UserXstate

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.