pub struct CONTEXT_ARM64 {
    pub context_flags: u32,
    pub cpsr: u32,
    pub iregs: [u64; 31],
    pub sp: u64,
    pub pc: u64,
    pub float_regs: [u128; 32],
    pub fpcr: u32,
    pub fpsr: u32,
    pub bcr: [u32; 8],
    pub bvr: [u64; 8],
    pub wcr: [u32; 2],
    pub wvr: [u64; 2],
}
Expand description

A (microsoft-style) aarch64 (arm64) CPU context

This matches the layout of how Windows defines this type. Breakpad defines it in an equivalent but more-quirky way that relies more on packing.

For general purpose registers:

  • microsoft: make iregs have 31 values and have sp and pc as explicit fields.
  • breakpad make iregs have 33 values, no explicit fields.

For float registers:

  • microsoft: inline the fields for float_regs, fpcr, fpsr.
  • breakpad: wrap them in a struct.

Why we went with these definitions:

  • ARM64 actually defines x0..x30 register names, but sp and pc aren’t “x31” and “x32”. Breakpad is effectively punning them as such, and that’s kinda weird?

  • Microsft’s inlining of the float registers eliminates any need for padding on all platforms (note how there’s always an even number of u32’s before a u64, and an even number of u64’s before a u128!)

NOTE: if you ever decide to try to make this repr(C) and get really clever, note that microsoft aligns this to 16 (and as of this writing, rust does not consistently aling u128 as such).

Fields

context_flags: u32cpsr: u32iregs: [u64; 31]

[x0, x1, ..., x28, fp, lr]. See Arm64RegisterNumbers.

sp: u64pc: u64float_regs: [u128; 32]

float/NEON registers [d0, d1, ..., d31]

fpcr: u32

FPU control register.

fpsr: u32

FPU status register.

bcr: [u32; 8]bvr: [u64; 8]wcr: [u32; 2]wvr: [u64; 2]

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

The word size of general-purpose registers in the context.

General purpose registers in this context type.

Gets a static version of the given register name, if possible. Read more

Gets whether the given register is valid Read more

Get a register value regardless of whether it is valid.

Set a register value, if that register name it exists. Read more

Gets the name of the stack pointer register (for use with get_register/set_register).

Gets the name of the instruction pointer register (for use with get_register/set_register).

Get a register value if it is valid. Read more

Return a String containing the value of reg formatted to its natural width.

An iterator over all registers in this context. Read more

An iterator over valid registers in this context. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.