Skip to main content

InterruptStackFrameValue

Struct InterruptStackFrameValue 

Source
pub struct InterruptStackFrameValue {
    pub instruction_pointer: VirtAddr,
    pub code_segment: SegmentSelector,
    pub cpu_flags: RFlags,
    pub stack_pointer: VirtAddr,
    pub stack_segment: SegmentSelector,
    /* private fields */
}
Expand description

Represents the interrupt stack frame pushed by the CPU on interrupt or exception entry.

Fields§

§instruction_pointer: VirtAddr

This value points to the instruction that should be executed when the interrupt handler returns. For most interrupts, this value points to the instruction immediately following the last executed instruction. However, for some exceptions (e.g., page faults), this value points to the faulting instruction, so that the instruction is restarted on return. See the documentation of the InterruptDescriptorTable fields for more details.

§code_segment: SegmentSelector

The code segment selector at the time of the interrupt.

§cpu_flags: RFlags

The flags register before the interrupt handler was invoked.

§stack_pointer: VirtAddr

The stack pointer at the time of the interrupt.

§stack_segment: SegmentSelector

The stack segment descriptor at the time of the interrupt (often zero in 64-bit mode).

Implementations§

Source§

impl InterruptStackFrameValue

Source

pub fn new( instruction_pointer: VirtAddr, code_segment: SegmentSelector, cpu_flags: RFlags, stack_pointer: VirtAddr, stack_segment: SegmentSelector, ) -> Self

Creates a new interrupt stack frame with the given values.

Source

pub unsafe fn iretq(&self) -> !

Call the iretq (interrupt return) instruction.

This function doesn’t have to be called in an interrupt handler. By manually construction a new InterruptStackFrameValue it’s possible to transition from a higher privilege level to a lower one.

§Safety

Calling iretq is unsafe because setting the instruction pointer, stack pointer, RFlags, CS and SS register can all cause undefined behaviour when done incorrectly.

Trait Implementations§

Source§

impl Clone for InterruptStackFrameValue

Source§

fn clone(&self) -> InterruptStackFrameValue

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

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

Performs copy-assignment from source. Read more
Source§

impl Copy for InterruptStackFrameValue

Source§

impl Debug for InterruptStackFrameValue

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for InterruptStackFrameValue

§

impl RefUnwindSafe for InterruptStackFrameValue

§

impl Send for InterruptStackFrameValue

§

impl Sync for InterruptStackFrameValue

§

impl Unpin for InterruptStackFrameValue

§

impl UnsafeUnpin for InterruptStackFrameValue

§

impl UnwindSafe for InterruptStackFrameValue

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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.
§

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

Performs the conversion.