[−][src]Struct sunrise_kernel::i386::gdt::GdtManager
Safety wrapper that manages the lifetime of GDT tables.
Although Intel's guide doesn't really say much about it, modifying a GDT "live" is probably a terrible idea. To work around this, the GdtManager keeps two copies of the DescriptorTable, one being the currently active one (loaded in the GDTR), and the other being where the changes to the GDT go to until they are committed.
When commit
is called, the internal GDT and current GDTR are swapped.
This struct's implementation of Deref
and DerefMut
will always give a reference to the table
currently not in use, so you can make modifications to it, and call commit
afterwards.
Fields
table_a: DescriptorTable
One of the two tables.
table_b: DescriptorTable
One of the two tables.
table_selector: bool
The table currently pointed to by GDTR. 0
is table_a
, 1
is table_b
.
Implementations
impl GdtManager
[src]
pub fn commit(
&mut self,
new_cs: Option<SegmentSelector>,
new_ds: Option<SegmentSelector>,
new_es: Option<SegmentSelector>,
new_fs: Option<SegmentSelector>,
new_gs: Option<SegmentSelector>,
new_ss: Option<SegmentSelector>
)
[src]
&mut self,
new_cs: Option<SegmentSelector>,
new_ds: Option<SegmentSelector>,
new_es: Option<SegmentSelector>,
new_fs: Option<SegmentSelector>,
new_gs: Option<SegmentSelector>,
new_ss: Option<SegmentSelector>
)
Commit the changes in the currently unloaded table, and update segment registers.
Selectors
To make a segment register point to a new descriptor, pass Some(selector)
to this function.
If None
is passed, the register will be reloaded from its current value.
This is what you want if you only updated the content of the descriptor.
We always perform a reload of all registers to make sure they reflect the state of the GDT,
in case the user modified it.
Methods from Deref<Target = DescriptorTable>
fn load_global(
&mut self,
new_cs: Option<SegmentSelector>,
new_ds: Option<SegmentSelector>,
new_es: Option<SegmentSelector>,
new_fs: Option<SegmentSelector>,
new_gs: Option<SegmentSelector>,
new_ss: Option<SegmentSelector>
)
[src]
&mut self,
new_cs: Option<SegmentSelector>,
new_ds: Option<SegmentSelector>,
new_es: Option<SegmentSelector>,
new_fs: Option<SegmentSelector>,
new_gs: Option<SegmentSelector>,
new_ss: Option<SegmentSelector>
)
Load this descriptor table into the GDTR, and reload the segment registers.
Trait Implementations
impl Debug for GdtManager
[src]
impl Default for GdtManager
[src]
fn default() -> GdtManager
[src]
impl Deref for GdtManager
[src]
type Target = DescriptorTable
The resulting type after dereferencing.
fn deref(&self) -> &DescriptorTable
[src]
Deref always returns a reference to the table not in use, so it can be modified, before being committed.
impl DerefMut for GdtManager
[src]
fn deref_mut(&mut self) -> &mut DescriptorTable
[src]
DerefMut always returns a reference to the table not in use, so it can be modified, before being committed.
Auto Trait Implementations
impl RefUnwindSafe for GdtManager
impl Send for GdtManager
impl Sync for GdtManager
impl Unpin for GdtManager
impl UnwindSafe for GdtManager
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
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>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,