Struct rstubs::arch::regs::Flags

source ·
#[repr(transparent)]
pub struct Flags(u32);
Expand description

The RFLAGS register.

Tuple Fields§

§0: u32

Implementations§

source§

impl Flags

source

pub const fn new() -> Self

Creates a new default initialized bitfield.

source

pub const fn from_bits(bits: u32) -> Self

Convert from bits.

source

pub const fn into_bits(self) -> u32

Convert into bits.

source

const CARRY_BITS: usize = 1usize

source

const CARRY_OFFSET: usize = 0usize

source

pub const fn carry(&self) -> bool

Set by hardware if last arithmetic operation generated a carry out of the most-significant bit of the result.

Bits: 0..1

source

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

Set by hardware if last arithmetic operation generated a carry out of the most-significant bit of the result.

Bits: 0..1

source

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

Set by hardware if last arithmetic operation generated a carry out of the most-significant bit of the result.

Bits: 0..1

source

const PARITY_BITS: usize = 1usize

source

const PARITY_OFFSET: usize = 2usize

source

pub const fn parity(&self) -> bool

Set by hardware if last result has an even number of 1 bits (only for some operations).

Bits: 2..3

source

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

Set by hardware if last result has an even number of 1 bits (only for some operations).

Bits: 2..3

source

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

Set by hardware if last result has an even number of 1 bits (only for some operations).

Bits: 2..3

source

const AUXILIARY_CARRY_BITS: usize = 1usize

source

const AUXILIARY_CARRY_OFFSET: usize = 4usize

source

pub const fn auxiliary_carry(&self) -> bool

Set by hardware if last arithmetic operation generated a carry ouf of bit 3 of the result.

Bits: 4..5

source

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

Set by hardware if last arithmetic operation generated a carry ouf of bit 3 of the result.

Bits: 4..5

source

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

Set by hardware if last arithmetic operation generated a carry ouf of bit 3 of the result.

Bits: 4..5

source

const ZERO_BITS: usize = 1usize

source

const ZERO_OFFSET: usize = 6usize

source

pub const fn zero(&self) -> bool

Set by hardware if last arithmetic operation resulted in a zero value.

Bits: 6..7

source

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

Set by hardware if last arithmetic operation resulted in a zero value.

Bits: 6..7

source

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

Set by hardware if last arithmetic operation resulted in a zero value.

Bits: 6..7

source

const SIGN_BITS: usize = 1usize

source

const SIGN_OFFSET: usize = 7usize

source

pub const fn sign(&self) -> bool

Set by hardware if last arithmetic operation resulted in a negative value.

Bits: 7..8

source

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

Set by hardware if last arithmetic operation resulted in a negative value.

Bits: 7..8

source

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

Set by hardware if last arithmetic operation resulted in a negative value.

Bits: 7..8

source

const TRAP_BITS: usize = 1usize

source

const TRAP_OFFSET: usize = 8usize

source

pub const fn trap(&self) -> bool

Enable single-step mode for debugging.

Bits: 8..9

source

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

Enable single-step mode for debugging.

Bits: 8..9

source

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

Enable single-step mode for debugging.

Bits: 8..9

source

const INTERRUPT_BITS: usize = 1usize

source

const INTERRUPT_OFFSET: usize = 9usize

source

pub const fn interrupt(&self) -> bool

Enable interrupts.

Bits: 9..10

source

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

Enable interrupts.

Bits: 9..10

source

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

Enable interrupts.

Bits: 9..10

source

const DIRECTION_BITS: usize = 1usize

source

const DIRECTION_OFFSET: usize = 10usize

source

pub const fn direction(&self) -> bool

Determines the order in which strings are processed.

Bits: 10..11

source

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

Determines the order in which strings are processed.

Bits: 10..11

source

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

Determines the order in which strings are processed.

Bits: 10..11

source

const OVERFLOW_BITS: usize = 1usize

source

const OVERFLOW_OFFSET: usize = 11usize

source

pub const fn overflow(&self) -> bool

Set by hardware to indicate that the sign bit of the result of the last signed integer operation differs from the source operands.

Bits: 11..12

source

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

Set by hardware to indicate that the sign bit of the result of the last signed integer operation differs from the source operands.

Bits: 11..12

source

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

Set by hardware to indicate that the sign bit of the result of the last signed integer operation differs from the source operands.

Bits: 11..12

source

const IOPL_LOW_BITS: usize = 1usize

source

const IOPL_LOW_OFFSET: usize = 12usize

source

pub const fn iopl_low(&self) -> bool

Specifies the privilege level required for executing I/O address-space instructions.

Bits: 12..13

source

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

Specifies the privilege level required for executing I/O address-space instructions.

Bits: 12..13

source

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

Specifies the privilege level required for executing I/O address-space instructions.

Bits: 12..13

source

const IOPL_HIGH_BITS: usize = 1usize

source

const IOPL_HIGH_OFFSET: usize = 13usize

source

pub const fn iopl_high(&self) -> bool

Specifies the privilege level required for executing I/O address-space instructions.

Bits: 13..14

source

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

Specifies the privilege level required for executing I/O address-space instructions.

Bits: 13..14

source

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

Specifies the privilege level required for executing I/O address-space instructions.

Bits: 13..14

source

const NESTED_TASK_BITS: usize = 1usize

source

const NESTED_TASK_OFFSET: usize = 14usize

source

pub const fn nested_task(&self) -> bool

Used by iret in hardware task switch mode to determine if current task is nested.

Bits: 14..15

source

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

Used by iret in hardware task switch mode to determine if current task is nested.

Bits: 14..15

source

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

Used by iret in hardware task switch mode to determine if current task is nested.

Bits: 14..15

source

const RESUME_BITS: usize = 1usize

source

const RESUME_OFFSET: usize = 16usize

source

pub const fn resume(&self) -> bool

Temporarily disables debug exceptions so that an instruction can be restarted after a debug exception without immediately causing another debug exception.

Bits: 16..17

source

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

Temporarily disables debug exceptions so that an instruction can be restarted after a debug exception without immediately causing another debug exception.

Bits: 16..17

source

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

Temporarily disables debug exceptions so that an instruction can be restarted after a debug exception without immediately causing another debug exception.

Bits: 16..17

source

const VIRTUAL_8086_MODE_BITS: usize = 1usize

source

const VIRTUAL_8086_MODE_OFFSET: usize = 17usize

source

pub const fn virtual_8086_mode(&self) -> bool

Enable the virtual-8086 mode.

Bits: 17..18

source

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

Enable the virtual-8086 mode.

Bits: 17..18

source

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

Enable the virtual-8086 mode.

Bits: 17..18

source

const ALIGNMENT_CHECK_BITS: usize = 1usize

source

const ALIGNMENT_CHECK_OFFSET: usize = 18usize

source

pub const fn alignment_check(&self) -> bool

Enable automatic alignment checking if Cr0::alignment_mask is set. Only works if CPL is 3.

Bits: 18..19

source

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

Enable automatic alignment checking if Cr0::alignment_mask is set. Only works if CPL is 3.

Bits: 18..19

source

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

Enable automatic alignment checking if Cr0::alignment_mask is set. Only works if CPL is 3.

Bits: 18..19

source

const VIRTUAL_INTERRUPT_BITS: usize = 1usize

source

const VIRTUAL_INTERRUPT_OFFSET: usize = 19usize

source

pub const fn virtual_interrupt(&self) -> bool

Virtual interrupt flag.

Bits: 19..20

source

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

Virtual interrupt flag.

Bits: 19..20

source

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

Virtual interrupt flag.

Bits: 19..20

source

const VIRTUAL_INTERRUPT_PENDING_BITS: usize = 1usize

source

const VIRTUAL_INTERRUPT_PENDING_OFFSET: usize = 20usize

source

pub const fn virtual_interrupt_pending(&self) -> bool

Virtual interrupt pending.

Bits: 20..21

source

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

Virtual interrupt pending.

Bits: 20..21

source

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

Virtual interrupt pending.

Bits: 20..21

source

const ID_BITS: usize = 1usize

source

const ID_OFFSET: usize = 21usize

source

pub const fn id(&self) -> bool

Able to use CPUID instruction.

Bits: 21..22

source

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

Able to use CPUID instruction.

Bits: 21..22

source

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

Able to use CPUID instruction.

Bits: 21..22

source§

impl Flags

source

pub fn read() -> Self

Trait Implementations§

source§

impl Clone for Flags

source§

fn clone(&self) -> Flags

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 Flags

source§

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

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

impl Default for Flags

source§

fn default() -> Self

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

impl From<Flags> for u32

source§

fn from(v: Flags) -> u32

Converts to this type from the input type.
source§

impl From<u32> for Flags

source§

fn from(v: u32) -> Self

Converts to this type from the input type.
source§

impl Copy for Flags

Auto Trait Implementations§

§

impl Freeze for Flags

§

impl RefUnwindSafe for Flags

§

impl Send for Flags

§

impl Sync for Flags

§

impl Unpin for Flags

§

impl UnwindSafe for Flags

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Az for T

source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
§

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

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
§

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.

source§

impl<T> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
§

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

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.