Struct CS
pub struct CS;Expand description
Code Segment
While most fields in the Code-Segment [Descriptor] are unused in 64-bit
long mode, some of them must be set to a specific value. The
EXECUTABLE,
USER_SEGMENT, and
LONG_MODE bits must be set, while the
DEFAULT_SIZE bit must be unset.
The DPL_RING_3 field can be used to change
privilege level. The PRESENT bit can be used
to make a segment present or not present.
All other fields (like the segment base and limit) are ignored by the processor and setting them has no effect.
Trait Implementations§
§impl Segment for CS
impl Segment for CS
§unsafe fn set_reg(sel: SegmentSelector)
unsafe fn set_reg(sel: SegmentSelector)
Note this is special since we cannot directly move to CS; x86 requires the instruction
pointer and CS to be set at the same time. To do this, we push the new segment selector
and return value onto the stack and use a “far return” (retfq) to reload CS and
continue at the end of our function.
Note we cannot use a “far call” (lcall) or “far jmp” (ljmp) to do this because then we
would only be able to jump to 32-bit instruction pointers. Only Intel implements support
for 64-bit far calls/jumps in long-mode, AMD does not.
§fn get_reg() -> SegmentSelector
fn get_reg() -> SegmentSelector
Auto Trait Implementations§
impl Freeze for CS
impl RefUnwindSafe for CS
impl Send for CS
impl Sync for CS
impl Unpin for CS
impl UnsafeUnpin for CS
impl UnwindSafe for CS
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more