[][src]Struct sunrise_kernel::i386::gdt::DescriptorTableEntry

#[repr(transparent)]pub struct DescriptorTableEntry(u64);

An entry in the GDT/LDT.

Those entries generally describe a segment. However, the DescriptorTable also contains special descriptors called "System Descriptors". Those are used for specifying different kind of memory regions used by the CPU, such as TSS, LDT, or Call Gates.

Implementations

impl DescriptorTableEntry[src]

fn null_descriptor() -> DescriptorTableEntry[src]

Returns an empty descriptor. Using this descriptor is an error and will raise a GPF. Should only be used to create a descriptor to place at index 0 of the GDT.

fn new(
    base: u32,
    limit: u32,
    is_code: bool,
    priv_level: PrivilegeLevel
) -> DescriptorTableEntry
[src]

Creates an empty GDT descriptor, but with some flags set correctly

fn new_system(
    ty: SystemDescriptorTypes,
    base: u32,
    limit: u32,
    priv_level: PrivilegeLevel
) -> DescriptorTableEntry
[src]

Creates an empty GDT system descriptor of the given type.

fn new_ldt(
    base: &'static DescriptorTable,
    priv_level: PrivilegeLevel
) -> DescriptorTableEntry
[src]

Creates a new LDT descriptor.

fn new_tss(
    base: &'static TssStruct,
    priv_level: PrivilegeLevel,
    iobp_size: usize
) -> DescriptorTableEntry
[src]

Creates a GDT descriptor pointing to a TSS segment

pub fn get_limit(self) -> u32[src]

Gets the byte length of the entry, minus 1.

pub fn set_limit(&mut self, newlimit: u32)[src]

Sets the entry's byte length to the given number plus one. Note that if the given length is higher than 65536, it should be properly page-aligned.

Panics

Panics if the given limit is higher than 65536 and not page aligned.

pub fn get_base(self) -> u32[src]

Gets the base address of the entry.

pub fn set_base(&mut self, newbase: u32)[src]

Sets the base address of the entry.

pub fn get_accessed(self) -> bool[src]

CPU sets this bit to true when the segment is accessed.

pub fn is_readwrite_allowed(self) -> bool[src]

  • Code Segments: Whether read access for this segment is allowed.
  • Data Segments: Whether write access for this segment is allowed.

pub fn is_comformant(self) -> bool[src]

  • Code Segments: if true, code in this segment can be executed from a lower privilege level (example: ring3 can far jump into ring2 code). If false, the code segment can only be executed from the right DPL.
  • Data Segments: if true, the segment grows up. If false, the segment grows down.

pub fn is_executable(self) -> bool[src]

Determines whether the segment is a code segment or a data segment. If true, this is a code segment and can be executed. If false, this is a data segment.

pub fn get_ring_level(self) -> PrivilegeLevel[src]

The privilege level associated with this segment.

pub fn get_present(self) -> bool[src]

A segment needs to be present to have an effect. Using a not-present segment will cause an exception.

pub fn is_4k_granularity(self) -> bool[src]

If true, the limit is a count of 4k pages. If false, it is a byte count.

fn set_4k_granularity(&mut self, is: bool)[src]

If true, the limit is a count of 4k pages. If false, it is a byte count.

pub fn is_32bit(self) -> bool[src]

If true, this is a 32-bit segment. If false, it is a 16-bit selector.

Trait Implementations

impl Clone for DescriptorTableEntry[src]

impl Copy for DescriptorTableEntry[src]

impl Debug for DescriptorTableEntry[src]

impl Default for DescriptorTableEntry[src]

Auto Trait Implementations

impl RefUnwindSafe for DescriptorTableEntry

impl Send for DescriptorTableEntry

impl Sync for DescriptorTableEntry

impl Unpin for DescriptorTableEntry

impl UnwindSafe for DescriptorTableEntry

Blanket Implementations

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

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

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

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

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.