diff options
author | 2019-06-07 12:04:16 -0700 | |
---|---|---|
committer | 2019-06-07 12:04:16 -0700 | |
commit | 29dc869cb6c35d35beca1207b92c601b606740b0 (patch) | |
tree | e215d560587898ee5f077db98b7624bb888ee9be | |
parent | 48492a77a4f034ed88b56f88c7db4c6062978649 (diff) | |
download | rust-x86-29dc869cb6c35d35beca1207b92c601b606740b0.tar.gz rust-x86-29dc869cb6c35d35beca1207b92c601b606740b0.tar.zst rust-x86-29dc869cb6c35d35beca1207b92c601b606740b0.zip |
Add swapgs instruction.
-rw-r--r-- | src/segmentation.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/segmentation.rs b/src/segmentation.rs index 8757add..4b08b99 100644 --- a/src/segmentation.rs +++ b/src/segmentation.rs @@ -568,6 +568,17 @@ pub fn cs() -> SegmentSelector { SegmentSelector::from_raw(segment) } +/// Swap the GS register. +/// +/// Exchanges the current GS base register value with the value contained +/// in MSR address IA32_KERNEL_GS_BASE. +/// +/// # Unsafe +/// The SWAPGS instruction is a privileged instruction intended for use by system software. +pub unsafe fn swapgs() { + asm!("swapgs" ::: "gs"); +} + #[cfg(test)] mod test { use super::*; |