Struct abyss::x86_64::Rflags

source ·
#[repr(transparent)]
pub struct Rflags { /* private fields */ }
Expand description

rflags.

Implementations§

source§

impl Rflags

source

pub const CF: Self = _

Carry Flag

source

pub const _1: Self = _

Must be 1.

source

pub const PF: Self = _

Parity Flag

source

pub const AF: Self = _

Adjust Flag

source

pub const ZF: Self = _

Zero Flag

source

pub const SF: Self = _

Sign Flag

source

pub const TF: Self = _

Trap Flag

source

pub const IF: Self = _

Interrupt enable.

Controls the response of the processor to maskable hardware interrupt requests (see also: Section 6.3.2, “Maskable Hardware Interrupts”). The flag is set to respond to maskable hardware interrupts; cleared to inhibit maskable hardware interrupts. The IF flag does not affect the generation of exceptions or nonmaskable interrupts (NMI interrupts). The CPL, IOPL, and the state of the VME flag in control register CR4 determine whether the IF flag can be modified by the CLI, STI, POPF, POPFD, and IRET.

source

pub const DF: Self = _

Direction Flag

source

pub const OF: Self = _

Overflow Flag

source

pub const IOPL0: Self = _

I/O privilege level field - bit 0

Indicates the I/O privilege level (IOPL) of the currently running program or task. The CPL of the currently running program or task must be less than or equal to the IOPL to access the I/O address space. The POPF and IRET instructions can modify this field only when operating at a CPL of 0.

The IOPL is also one of the mechanisms that controls the modification of the IF flag and the handling of interrupts in virtual-8086 mode when virtual mode extensions are in effect (when CR4.VME = 1).

See also: Chapter 18, “Input/Output,” in the Intel® 64 and IA-32 Architectures Software Developer’s Manual, Volume 1.

source

pub const IOPL1: Self = _

I/O privilege level field - bit 1

Indicates the I/O privilege level (IOPL) of the currently running program or task. The CPL of the currently running program or task must be less than or equal to the IOPL to access the I/O address space. The POPF and IRET instructions can modify this field only when operating at a CPL of 0. The IOPL is also one of the mechanisms that controls the modification of the IF flag and the handling of interrupts in virtual-8086 mode when virtual mode extensions are in effect (when CR4.VME = 1).

See also: Chapter 18, “Input/Output,” in the Intel® 64 and IA-32 Architectures Software Developer’s Manual, Volume 1.

source

pub const NT: Self = _

Nested task

Controls the chaining of interrupted and called tasks. The processor sets this flag on calls to a task initiated with a CALL instruction, an interrupt, or an exception. It examines and modifies this flag on returns from a task initiated with the IRET instruction. The flag can be explicitly set or cleared with the POPF/POPFD instructions; however, changing to the state of this flag can generate unexpected exceptions in application programs.

See also: Section 7.4, “Task Linking.”

source

pub const RF: Self = _

Resume

Controls the processor’s response to instruction-breakpoint conditions. When set, this flag temporarily disables debug exceptions (#DB) from being generated for instruction breakpoints (although other exception conditions can cause an exception to be generated). When clear, instruction breakpoints will generate debug exceptions.

The primary function of the RF flag is to allow the restarting of an instruction following a debug exception that was caused by an instruction breakpoint condition. Here, debug software must set this flag in the EFLAGS image on the stack just prior to returning to the interrupted program with IRETD (to prevent the instruction breakpoint from causing another debug exception). The processor then automatically clears this flag after the instruction returned to has been successfully executed, enabling instruction breakpoint faults again.

See also: Section 17.3.1.1, “Instruction-Breakpoint Exception Condition.”

source

pub const VM: Self = _

Virtual-8086 mode

Set to enable virtual-8086 mode; clear to return to protected mode.

See also: Section 20.2.1, “Enabling Virtual-8086 Mode.”

source

pub const AC: Self = _

Alignment check or access control

If the AM bit is set in the CR0 register, alignment checking of user-mode data accesses is enabled if and only if this flag is 1. An alignment-check exception is generated when reference is made to an unaligned operand, such as a word at an odd byte address or a doubleword at an address which is not an integral multiple of four. Alignment-check exceptions are generated only in user mode (privilege level 3). Memory references that default to privilege level 0, such as segment descriptor loads, do not generate this exception even when caused by instructions executed in user-mode.

The alignment-check exception can be used to check alignment of data. This is useful when exchanging data with processors which require all data to be aligned. The alignment-check exception can also be used by interpreters to flag some pointers as special by misaligning the pointer. This eliminates overhead of checking each pointer and only handles the special pointer when used.

If the SMAP bit is set in the CR4 register, explicit supervisor-mode data accesses to user-mode pages are allowed if and only if this bit is 1. See Section 4.6, “Access Rights.”

source

pub const VIF: Self = _

Virtual Interrupt

Contains a virtual image of the IF flag. This flag is used in conjunction with the VIP flag. The processor only recognizes the VIF flag when either the VME flag or the PVI flag in control register CR4 is set and the IOPL is less than 3. (The VME flag enables the virtual-8086 mode extensions; the PVI flag enables the protected-mode virtual interrupts.)

See also: Section 20.3.3.5, “Method 6: Software Interrupt Handling,” and Section 20.4, “Protected-Mode Virtual Interrupts.”

source

pub const VIP: Self = _

Virtual interrupt pending

Set by software to indicate that an interrupt is pending; cleared to indicate that no interrupt is pending. This flag is used in conjunction with the VIF flag. The processor reads this flag but never modifies it. The processor only recognizes the VIP flag when either the VME flag or the PVI flag in control register CR4 is set and the IOPL is less than 3. The VME flag enables the virtual-8086 mode extensions; the PVI flag enables the protected-mode virtual interrupts.

See Section 20.3.3.5, “Method 6: Software Interrupt Handling,” and Section 20.4, “Protected-Mode Virtual Interrupts.”

source

pub const ID: Self = _

Identification.

The ability of a program or procedure to set or clear this flag indicates support for the CPUID instruction.

source

pub const fn empty() -> Self

Returns an empty set of flags.

source

pub const fn all() -> Self

Returns the set containing all flags.

source

pub const fn bits(&self) -> u64

Returns the raw value of the flags currently stored.

source

pub const fn from_bits(bits: u64) -> Option<Self>

Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.

source

pub const fn from_bits_truncate(bits: u64) -> Self

Convert from underlying bit representation, dropping any bits that do not correspond to flags.

source

pub const unsafe fn from_bits_unchecked(bits: u64) -> Self

Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).

Safety

The caller of the bitflags! macro can chose to allow or disallow extra bits for their bitflags type.

The caller of from_bits_unchecked() has to ensure that all bits correspond to a defined flag or that extra bits are valid for this bitflags type.

source

pub const fn is_empty(&self) -> bool

Returns true if no flags are currently stored.

source

pub const fn is_all(&self) -> bool

Returns true if all flags are currently set.

source

pub const fn intersects(&self, other: Self) -> bool

Returns true if there are flags common to both self and other.

source

pub const fn contains(&self, other: Self) -> bool

Returns true if all of the flags in other are contained within self.

source

pub fn insert(&mut self, other: Self)

Inserts the specified flags in-place.

source

pub fn remove(&mut self, other: Self)

Removes the specified flags in-place.

source

pub fn toggle(&mut self, other: Self)

Toggles the specified flags in-place.

source

pub fn set(&mut self, other: Self, value: bool)

Inserts or removes the specified flags depending on the passed value.

source

pub const fn intersection(self, other: Self) -> Self

Returns the intersection between the flags in self and other.

Specifically, the returned set contains only the flags which are present in both self and other.

This is equivalent to using the & operator (e.g. ops::BitAnd), as in flags & other.

source

pub const fn union(self, other: Self) -> Self

Returns the union of between the flags in self and other.

Specifically, the returned set contains all flags which are present in either self or other, including any which are present in both (see Self::symmetric_difference if that is undesirable).

This is equivalent to using the | operator (e.g. ops::BitOr), as in flags | other.

source

pub const fn difference(self, other: Self) -> Self

Returns the difference between the flags in self and other.

Specifically, the returned set contains all flags present in self, except for the ones present in other.

It is also conceptually equivalent to the “bit-clear” operation: flags & !other (and this syntax is also supported).

This is equivalent to using the - operator (e.g. ops::Sub), as in flags - other.

source

pub const fn symmetric_difference(self, other: Self) -> Self

Returns the symmetric difference between the flags in self and other.

Specifically, the returned set contains the flags present which are present in self or other, but that are not present in both. Equivalently, it contains the flags present in exactly one of the sets self and other.

This is equivalent to using the ^ operator (e.g. ops::BitXor), as in flags ^ other.

source

pub const fn complement(self) -> Self

Returns the complement of this set of flags.

Specifically, the returned set contains all the flags which are not set in self, but which are allowed for this type.

Alternatively, it can be thought of as the set difference between Self::all() and self (e.g. Self::all() - self)

This is equivalent to using the ! operator (e.g. ops::Not), as in !flags.

source§

impl Rflags

source

pub fn read() -> Self

Read the current value.

Trait Implementations§

source§

impl Binary for Rflags

source§

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

Formats the value using the given formatter.
source§

impl BitAnd<Rflags> for Rflags

source§

fn bitand(self, other: Self) -> Self

Returns the intersection between the two sets of flags.

§

type Output = Rflags

The resulting type after applying the & operator.
source§

impl BitAndAssign<Rflags> for Rflags

source§

fn bitand_assign(&mut self, other: Self)

Disables all flags disabled in the set.

source§

impl BitOr<Rflags> for Rflags

source§

fn bitor(self, other: Rflags) -> Self

Returns the union of the two sets of flags.

§

type Output = Rflags

The resulting type after applying the | operator.
source§

impl BitOrAssign<Rflags> for Rflags

source§

fn bitor_assign(&mut self, other: Self)

Adds the set of flags.

source§

impl BitXor<Rflags> for Rflags

source§

fn bitxor(self, other: Self) -> Self

Returns the left flags, but with all the right flags toggled.

§

type Output = Rflags

The resulting type after applying the ^ operator.
source§

impl BitXorAssign<Rflags> for Rflags

source§

fn bitxor_assign(&mut self, other: Self)

Toggles the set of flags.

source§

impl Clone for Rflags

source§

fn clone(&self) -> Rflags

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 Rflags

source§

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

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

impl Extend<Rflags> for Rflags

source§

fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)

Extends a collection with the contents of an iterator. Read more
§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl FromIterator<Rflags> for Rflags

source§

fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self

Creates a value from an iterator. Read more
source§

impl Hash for Rflags

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given [Hasher]. Read more
1.3.0§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given [Hasher]. Read more
source§

impl LowerHex for Rflags

source§

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

Formats the value using the given formatter.
source§

impl Not for Rflags

source§

fn not(self) -> Self

Returns the complement of this set of flags.

§

type Output = Rflags

The resulting type after applying the ! operator.
source§

impl Octal for Rflags

source§

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

Formats the value using the given formatter.
source§

impl Ord for Rflags

source§

fn cmp(&self, other: &Rflags) -> Ordering

This method returns an [Ordering] between self and other. Read more
1.21.0§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<Rflags> for Rflags

source§

fn eq(&self, other: &Rflags) -> 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 PartialOrd<Rflags> for Rflags

source§

fn partial_cmp(&self, other: &Rflags) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Sub<Rflags> for Rflags

source§

fn sub(self, other: Self) -> Self

Returns the set difference of the two sets of flags.

§

type Output = Rflags

The resulting type after applying the - operator.
source§

impl SubAssign<Rflags> for Rflags

source§

fn sub_assign(&mut self, other: Self)

Disables all flags enabled in the set.

source§

impl UpperHex for Rflags

source§

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

Formats the value using the given formatter.
source§

impl Copy for Rflags

source§

impl Eq for Rflags

source§

impl StructuralEq for Rflags

source§

impl StructuralPartialEq for Rflags

Auto Trait Implementations§

§

impl RefUnwindSafe for Rflags

§

impl Send for Rflags

§

impl Sync for Rflags

§

impl Unpin for Rflags

§

impl UnwindSafe for Rflags

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

const: unstable§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

const: unstable§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

const: unstable§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

const: unstable§

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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

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

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

Performs the conversion.