Struct InterruptStackFrame
#[repr(transparent)]pub struct InterruptStackFrame(InterruptStackFrameValue);Expand description
Wrapper type for the interrupt stack frame pushed by the CPU.
This type derefs to an InterruptStackFrameValue, which allows reading the actual values.
This wrapper type ensures that no accidental modification of the interrupt stack frame
occurs, which can cause undefined behavior (see the as_mut
method for more information).
Tuple Fields§
§0: InterruptStackFrameValueImplementations§
§impl InterruptStackFrame
impl InterruptStackFrame
pub fn new(
instruction_pointer: VirtAddr,
code_segment: SegmentSelector,
cpu_flags: RFlags,
stack_pointer: VirtAddr,
stack_segment: SegmentSelector,
) -> InterruptStackFrame
pub fn new( instruction_pointer: VirtAddr, code_segment: SegmentSelector, cpu_flags: RFlags, stack_pointer: VirtAddr, stack_segment: SegmentSelector, ) -> InterruptStackFrame
Creates a new interrupt stack frame with the given values.
pub unsafe fn as_mut(&mut self) -> Volatile<&mut InterruptStackFrameValue>
pub unsafe fn as_mut(&mut self) -> Volatile<&mut InterruptStackFrameValue>
Gives mutable access to the contents of the interrupt stack frame.
The Volatile wrapper is used because LLVM optimizations remove non-volatile
modifications of the interrupt stack frame.
§Safety
This function is unsafe since modifying the content of the interrupt stack frame can easily lead to undefined behavior. For example, by writing an invalid value to the instruction pointer field, the CPU can jump to arbitrary code at the end of the interrupt.
Also, it is not fully clear yet whether modifications of the interrupt stack frame are officially supported by LLVM’s x86 interrupt calling convention.
Methods from Deref<Target = InterruptStackFrameValue>§
pub unsafe fn iretq(&self) -> !
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§
§impl Debug for InterruptStackFrame
impl Debug for InterruptStackFrame
§impl Deref for InterruptStackFrame
impl Deref for InterruptStackFrame
§type Target = InterruptStackFrameValue
type Target = InterruptStackFrameValue
§fn deref(&self) -> &<InterruptStackFrame as Deref>::Target
fn deref(&self) -> &<InterruptStackFrame as Deref>::Target
Auto Trait Implementations§
impl Freeze for InterruptStackFrame
impl RefUnwindSafe for InterruptStackFrame
impl Send for InterruptStackFrame
impl Sync for InterruptStackFrame
impl Unpin for InterruptStackFrame
impl UnsafeUnpin for InterruptStackFrame
impl UnwindSafe for InterruptStackFrame
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more