Struct x86_64::structures::gdt::DescriptorFlags[][src]

pub struct DescriptorFlags { /* fields omitted */ }
Expand description

Flags for a GDT descriptor. Not all flags are valid for all descriptor types.

Implementations

impl DescriptorFlags[src]

pub const ACCESSED: DescriptorFlags[src]

Set by the processor if this segment has been accessed. Only cleared by software. Setting this bit in software prevents GDT writes on first use.

pub const WRITABLE: DescriptorFlags[src]

For 32-bit data segments, sets the segment as writable. For 32-bit code segments, sets the segment as readable. In 64-bit mode, ignored for all segments.

pub const CONFORMING: DescriptorFlags[src]

For code segments, sets the segment as “conforming”, influencing the privilege checks that occur on control transfers. For 32-bit data segments, sets the segment as “expand down”. In 64-bit mode, ignored for data segments.

pub const EXECUTABLE: DescriptorFlags[src]

This flag must be set for code segments and unset for data segments.

pub const USER_SEGMENT: DescriptorFlags[src]

This flag must be set for user segments (in contrast to system segments).

pub const DPL_RING_3: DescriptorFlags[src]

The DPL for this descriptor is Ring 3. In 64-bit mode, ignored for data segments.

pub const PRESENT: DescriptorFlags[src]

Must be set for any segment, causes a segment not present exception if not set.

pub const AVAILABLE: DescriptorFlags[src]

Available for use by the Operating System

pub const LONG_MODE: DescriptorFlags[src]

Must be set for 64-bit code segments, unset otherwise.

pub const DEFAULT_SIZE: DescriptorFlags[src]

Use 32-bit (as opposed to 16-bit) operands. If LONG_MODE is set, this must be unset. In 64-bit mode, ignored for data segments.

pub const GRANULARITY: DescriptorFlags[src]

Limit field is scaled by 4096 bytes. In 64-bit mode, ignored for all segments.

pub const LIMIT_0_15: DescriptorFlags[src]

Bits 0..=15 of the limit field (ignored in 64-bit mode)

pub const LIMIT_16_19: DescriptorFlags[src]

Bits 16..=19 of the limit field (ignored in 64-bit mode)

pub const BASE_0_23: DescriptorFlags[src]

Bits 0..=23 of the base field (ignored in 64-bit mode, except for fs and gs)

pub const BASE_24_31: DescriptorFlags[src]

Bits 24..=31 of the base field (ignored in 64-bit mode, except for fs and gs)

pub const fn empty() -> DescriptorFlags[src]

Returns an empty set of flags

pub const fn all() -> DescriptorFlags[src]

Returns the set containing all flags.

pub const fn bits(&self) -> u64[src]

Returns the raw value of the flags currently stored.

pub fn from_bits(bits: u64) -> Option<DescriptorFlags>[src]

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

pub const fn from_bits_truncate(bits: u64) -> DescriptorFlags[src]

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

pub const unsafe fn from_bits_unchecked(bits: u64) -> DescriptorFlags[src]

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

pub const fn is_empty(&self) -> bool[src]

Returns true if no flags are currently stored.

pub const fn is_all(&self) -> bool[src]

Returns true if all flags are currently set.

pub const fn intersects(&self, other: DescriptorFlags) -> bool[src]

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

pub const fn contains(&self, other: DescriptorFlags) -> bool[src]

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

pub fn insert(&mut self, other: DescriptorFlags)[src]

Inserts the specified flags in-place.

pub fn remove(&mut self, other: DescriptorFlags)[src]

Removes the specified flags in-place.

pub fn toggle(&mut self, other: DescriptorFlags)[src]

Toggles the specified flags in-place.

pub fn set(&mut self, other: DescriptorFlags, value: bool)[src]

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

impl DescriptorFlags[src]

The following constants define default values for common GDT entries. They are all “flat” segments, meaning they can access the entire address space. These values all set WRITABLE and ACCESSED. They also match the values loaded by the syscall/sysret and sysenter/sysexit instructions.

In short, these values disable segmentation, permission checks, and access tracking at the GDT level. Kernels using these values should use paging to implement this functionality.

pub const KERNEL_DATA: Self[src]

A kernel data segment (64-bit or flat 32-bit)

pub const KERNEL_CODE32: Self[src]

A flat 32-bit kernel code segment

pub const KERNEL_CODE64: Self[src]

A 64-bit kernel code segment

pub const USER_DATA: Self[src]

A user data segment (64-bit or flat 32-bit)

pub const USER_CODE32: Self[src]

A flat 32-bit user code segment

pub const USER_CODE64: Self[src]

A 64-bit user code segment

Trait Implementations

impl Binary for DescriptorFlags[src]

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

Formats the value using the given formatter.

impl BitAnd<DescriptorFlags> for DescriptorFlags[src]

fn bitand(self, other: DescriptorFlags) -> DescriptorFlags[src]

Returns the intersection between the two sets of flags.

type Output = DescriptorFlags

The resulting type after applying the & operator.

impl BitAndAssign<DescriptorFlags> for DescriptorFlags[src]

fn bitand_assign(&mut self, other: DescriptorFlags)[src]

Disables all flags disabled in the set.

impl BitOr<DescriptorFlags> for DescriptorFlags[src]

fn bitor(self, other: DescriptorFlags) -> DescriptorFlags[src]

Returns the union of the two sets of flags.

type Output = DescriptorFlags

The resulting type after applying the | operator.

impl BitOrAssign<DescriptorFlags> for DescriptorFlags[src]

fn bitor_assign(&mut self, other: DescriptorFlags)[src]

Adds the set of flags.

impl BitXor<DescriptorFlags> for DescriptorFlags[src]

fn bitxor(self, other: DescriptorFlags) -> DescriptorFlags[src]

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

type Output = DescriptorFlags

The resulting type after applying the ^ operator.

impl BitXorAssign<DescriptorFlags> for DescriptorFlags[src]

fn bitxor_assign(&mut self, other: DescriptorFlags)[src]

Toggles the set of flags.

impl Clone for DescriptorFlags[src]

fn clone(&self) -> DescriptorFlags[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for DescriptorFlags[src]

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

Formats the value using the given formatter. Read more

impl Extend<DescriptorFlags> for DescriptorFlags[src]

fn extend<T: IntoIterator<Item = DescriptorFlags>>(&mut self, iterator: T)[src]

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

fn extend_one(&mut self, item: A)[src]

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

fn extend_reserve(&mut self, additional: usize)[src]

🔬 This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

impl FromIterator<DescriptorFlags> for DescriptorFlags[src]

fn from_iter<T: IntoIterator<Item = DescriptorFlags>>(
    iterator: T
) -> DescriptorFlags
[src]

Creates a value from an iterator. Read more

impl Hash for DescriptorFlags[src]

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

Feeds this value into the given Hasher. Read more

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

Feeds a slice of this type into the given Hasher. Read more

impl LowerHex for DescriptorFlags[src]

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

Formats the value using the given formatter.

impl Not for DescriptorFlags[src]

fn not(self) -> DescriptorFlags[src]

Returns the complement of this set of flags.

type Output = DescriptorFlags

The resulting type after applying the ! operator.

impl Octal for DescriptorFlags[src]

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

Formats the value using the given formatter.

impl Ord for DescriptorFlags[src]

fn cmp(&self, other: &DescriptorFlags) -> Ordering[src]

This method returns an Ordering between self and other. Read more

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

impl PartialEq<DescriptorFlags> for DescriptorFlags[src]

fn eq(&self, other: &DescriptorFlags) -> bool[src]

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

fn ne(&self, other: &DescriptorFlags) -> bool[src]

This method tests for !=.

impl PartialOrd<DescriptorFlags> for DescriptorFlags[src]

fn partial_cmp(&self, other: &DescriptorFlags) -> Option<Ordering>[src]

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

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

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

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

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

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

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

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

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

impl Sub<DescriptorFlags> for DescriptorFlags[src]

fn sub(self, other: DescriptorFlags) -> DescriptorFlags[src]

Returns the set difference of the two sets of flags.

type Output = DescriptorFlags

The resulting type after applying the - operator.

impl SubAssign<DescriptorFlags> for DescriptorFlags[src]

fn sub_assign(&mut self, other: DescriptorFlags)[src]

Disables all flags enabled in the set.

impl UpperHex for DescriptorFlags[src]

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

Formats the value using the given formatter.

impl Copy for DescriptorFlags[src]

impl Eq for DescriptorFlags[src]

impl StructuralEq for DescriptorFlags[src]

impl StructuralPartialEq for DescriptorFlags[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.