Enum goblin::pe::exception::UnwindOperation

source ·
pub enum UnwindOperation {
    PushNonVolatile(Register),
    Alloc(u32),
    SetFPRegister,
    SaveNonVolatile(Register, StackFrameOffset),
    SaveXMM(Register, StackFrameOffset),
    Epilog,
    SaveXMM128(Register, StackFrameOffset),
    PushMachineFrame(bool),
    Noop,
}
Expand description

An unwind operation corresponding to code in the function prolog.

Unwind operations can be used to reverse the effects of the function prolog and restore register values of parent stack frames that have been saved to the stack.

Variants§

§

PushNonVolatile(Register)

Push a nonvolatile integer register, decrementing RSP by 8.

§

Alloc(u32)

Allocate a fixed-size area on the stack.

§

SetFPRegister

Establish the frame pointer register by setting the register to some offset of the current RSP. The use of an offset permits establishing a frame pointer that points to the middle of the fixed stack allocation, helping code density by allowing more accesses to use short instruction forms.

§

SaveNonVolatile(Register, StackFrameOffset)

Save a nonvolatile integer register on the stack using a MOV instead of a PUSH. This code is primarily used for shrink-wrapping, where a nonvolatile register is saved to the stack in a position that was previously allocated.

§

SaveXMM(Register, StackFrameOffset)

Save the lower 64 bits of a nonvolatile XMM register on the stack.

§

Epilog

Describes the function epilog.

This operation has been introduced with unwind info version 2 and is not implemented yet.

§

SaveXMM128(Register, StackFrameOffset)

Save all 128 bits of a nonvolatile XMM register on the stack.

§

PushMachineFrame(bool)

Push a machine frame. This is used to record the effect of a hardware interrupt or exception. Depending on the error flag, this frame has two different layouts.

This unwind code always appears in a dummy prolog, which is never actually executed but instead appears before the real entry point of an interrupt routine, and exists only to provide a place to simulate the push of a machine frame. This operation records that simulation, which indicates the machine has conceptually done this:

  1. Pop RIP return address from top of stack into temp
  2. $ss, Push old $rsp, $rflags, $cs, temp
  3. If error flag is true, push the error code

Without an error code, RSP was incremented by 40 and the following was frame pushed:

OffsetValue
RSP + 32$ss
RSP + 24old $rsp
RSP + 16$rflags
RSP + 8$cs
RSP + 0$rip

With an error code, RSP was incremented by 48 and the following was frame pushed:

OffsetValue
RSP + 40$ss
RSP + 32old $rsp
RSP + 24$rflags
RSP + 16$cs
RSP + 8$rip
RSP + 0error code
§

Noop

A reserved operation without effect.

Trait Implementations§

source§

impl Clone for UnwindOperation

source§

fn clone(&self) -> UnwindOperation

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for UnwindOperation

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for UnwindOperation

source§

fn eq(&self, other: &UnwindOperation) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for UnwindOperation

source§

impl Eq for UnwindOperation

source§

impl StructuralPartialEq for UnwindOperation

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> 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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.