#[repr(C)]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
impl InterruptStackFrameValue
Sourcepub fn new(
instruction_pointer: VirtAddr,
code_segment: SegmentSelector,
cpu_flags: RFlags,
stack_pointer: VirtAddr,
stack_segment: SegmentSelector,
) -> Self
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.
Sourcepub 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§
Source§impl Clone for InterruptStackFrameValue
impl Clone for InterruptStackFrameValue
Source§fn clone(&self) -> InterruptStackFrameValue
fn clone(&self) -> InterruptStackFrameValue
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more