Struct Star
pub struct Star;Expand description
Syscall Register: STAR
Implementations§
§impl Star
impl Star
pub fn read_raw() -> (u16, u16)
pub fn read_raw() -> (u16, u16)
Read the Ring 0 and Ring 3 segment bases. The remaining fields are ignored because they are not valid for long mode.
§Returns
- Field 1 (SYSRET): The CS selector is set to this field + 16. SS.Sel is set to this field + 8. Because SYSRET always returns to CPL 3, the RPL bits 1:0 should be initialized to 11b.
- Field 2 (SYSCALL): This field is copied directly into CS.Sel. SS.Sel is set to this field + 8. Because SYSCALL always switches to CPL 0, the RPL bits 33:32 should be initialized to 00b.
pub fn read() -> (SegmentSelector, SegmentSelector, SegmentSelector, SegmentSelector)
pub fn read() -> (SegmentSelector, SegmentSelector, SegmentSelector, SegmentSelector)
Read the Ring 0 and Ring 3 segment bases. Returns
- CS Selector SYSRET
- SS Selector SYSRET
- CS Selector SYSCALL
- SS Selector SYSCALL
pub unsafe fn write_raw(sysret: u16, syscall: u16)
pub unsafe fn write_raw(sysret: u16, syscall: u16)
Write the Ring 0 and Ring 3 segment bases. The remaining fields are ignored because they are not valid for long mode.
§Parameters
- sysret: For SYSRETQ (64-bit), the CS selector is set to this field + 16. For SYSRET (32-bit), the CS selector is set to this field. SS.Sel is set to this field + 8. Because SYSRETQ/SYSRET always returns to CPL 3, the RPL bits 1:0 should be initialized to 11b.
- syscall: This field is copied directly into CS.Sel. SS.Sel is set to this field + 8. Because SYSCALL always switches to CPL 0, the RPL bits 33:32 should be initialized to 00b.
§Safety
Unsafe because this can cause system instability if passed in the wrong values for the fields.
pub fn write(
cs_sysret: SegmentSelector,
ss_sysret: SegmentSelector,
cs_syscall: SegmentSelector,
ss_syscall: SegmentSelector,
) -> Result<(), InvalidStarSegmentSelectors>
pub fn write( cs_sysret: SegmentSelector, ss_sysret: SegmentSelector, cs_syscall: SegmentSelector, ss_syscall: SegmentSelector, ) -> Result<(), InvalidStarSegmentSelectors>
Write the Ring 0 and Ring 3 segment bases.
The remaining fields are ignored because they are not valid for long mode.
This function will fail if the segment selectors are not in the correct offset of each other or if the segment selectors do not have correct privileges.
Note that cs_sysret should contain the segment to be used for
SYSRETQ (64-bit), not SYSRET (32-bit).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Star
impl RefUnwindSafe for Star
impl Send for Star
impl Sync for Star
impl Unpin for Star
impl UnsafeUnpin for Star
impl UnwindSafe for Star
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