Struct rstubs::arch::int::idt::EntryOptions

source ·
#[repr(transparent)]
pub struct EntryOptions(u16);
Expand description

Represents the options field of an IDT entry.

Tuple Fields§

§0: u16

Implementations§

source§

impl EntryOptions

source

pub const fn new() -> Self

Creates a new default initialized bitfield.

source

const STACK_IDX_BITS: usize = 3usize

source

const STACK_IDX_OFFSET: usize = 0usize

source

const fn with_stack_idx(self, value: u16) -> Self

Index of an interrupt stack

Bits: 0..3

source

const fn stack_idx(&self) -> u16

Index of an interrupt stack

Bits: 0..3

source

fn set_stack_idx(&mut self, value: u16)

Index of an interrupt stack

Bits: 0..3

source

const GATE_BITS: usize = 3usize

source

const GATE_OFFSET: usize = 8usize

source

pub const fn with_gate(self, value: Gate) -> Self

Gate type

Bits: 8..11

source

pub const fn gate(&self) -> Gate

Gate type

Bits: 8..11

source

pub fn set_gate(&mut self, value: Gate)

Gate type

Bits: 8..11

source

const GATE_32_BITS: usize = 1usize

source

const GATE_32_OFFSET: usize = 11usize

source

pub const fn with_gate_32(self, value: bool) -> Self

If this is a 32 bit entry

Bits: 11..12

source

pub const fn gate_32(&self) -> bool

If this is a 32 bit entry

Bits: 11..12

source

pub fn set_gate_32(&mut self, value: bool)

If this is a 32 bit entry

Bits: 11..12

source

const PRIVILEGE_LEVEL_BITS: usize = 2usize

source

const PRIVILEGE_LEVEL_OFFSET: usize = 13usize

source

pub const fn with_privilege_level(self, value: Ring) -> Self

Set the required privilege level (DPL) for invoking the handler. The DPL can be 0 or 3, the default is 0. If CPL < DPL, a general protection fault occurs.

Bits: 13..15

source

pub const fn privilege_level(&self) -> Ring

Set the required privilege level (DPL) for invoking the handler. The DPL can be 0 or 3, the default is 0. If CPL < DPL, a general protection fault occurs.

Bits: 13..15

source

pub fn set_privilege_level(&mut self, value: Ring)

Set the required privilege level (DPL) for invoking the handler. The DPL can be 0 or 3, the default is 0. If CPL < DPL, a general protection fault occurs.

Bits: 13..15

source

const PRESENT_BITS: usize = 1usize

source

const PRESENT_OFFSET: usize = 15usize

source

pub const fn with_present(self, value: bool) -> Self

Has to be true for valid entries.

Bits: 15..16

source

pub const fn present(&self) -> bool

Has to be true for valid entries.

Bits: 15..16

source

pub fn set_present(&mut self, value: bool)

Has to be true for valid entries.

Bits: 15..16

source§

impl EntryOptions

source

const fn minimal() -> Self

Creates a minimal options field with all the must-be-one bits set.

source

pub const unsafe fn with_stack(self, index: u16) -> Self

Assigns a Interrupt Stack Table (IST) stack to this handler. The CPU will then always switch to the specified stack before the handler is invoked. This allows kernels to recover from corrupt stack pointers (e.g., on kernel stack overflow).

An IST stack is specified by an IST index between 0 and 6 (inclusive). Using the same stack for multiple interrupts can be dangerous when nested interrupts are possible.

This function panics if the index is not in the range 0..7.

§Safety

This function is unsafe because the caller must ensure that the passed stack index is valid and not used by other interrupts. Otherwise, memory safety violations are possible.

Trait Implementations§

source§

impl Clone for EntryOptions

source§

fn clone(&self) -> EntryOptions

Returns a copy of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
source§

impl Debug for EntryOptions

source§

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

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

impl Default for EntryOptions

source§

fn default() -> Self

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

impl From<EntryOptions> for u16

source§

fn from(v: EntryOptions) -> u16

Converts to this type from the input type.
source§

impl From<u16> for EntryOptions

source§

fn from(v: u16) -> Self

Converts to this type from the input type.
source§

impl PartialEq for EntryOptions

source§

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

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

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 EntryOptions

source§

impl StructuralPartialEq for EntryOptions

Auto Trait Implementations§

§

impl RefUnwindSafe for EntryOptions

§

impl Send for EntryOptions

§

impl Sync for EntryOptions

§

impl Unpin for EntryOptions

§

impl UnwindSafe for EntryOptions

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