aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bits64/segmentation.rs14
-rw-r--r--src/msr.rs3
-rw-r--r--src/segmentation.rs11
3 files changed, 14 insertions, 14 deletions
diff --git a/src/bits64/segmentation.rs b/src/bits64/segmentation.rs
index 978025f..d246f0f 100644
--- a/src/bits64/segmentation.rs
+++ b/src/bits64/segmentation.rs
@@ -169,3 +169,17 @@ pub unsafe fn rdfsbase() -> u64 {
asm!("rdfsbase $0" : "=r" (fs_base) );
fs_base
}
+
+/// Swap the GS register.
+///
+/// Exchanges the current GS base register value with the value contained
+/// in MSR address IA32_KERNEL_GS_BASE.
+///
+/// The SWAPGS instruction is available only in 64-bit mode.
+///
+/// # Unsafe
+/// The SWAPGS instruction is a privileged instruction intended for use by system software.
+#[cfg(target_arch = "x86_64")]
+pub unsafe fn swapgs() {
+ asm!("swapgs" ::: "gs");
+}
diff --git a/src/msr.rs b/src/msr.rs
index f2824b1..301b11f 100644
--- a/src/msr.rs
+++ b/src/msr.rs
@@ -3178,9 +3178,6 @@ pub const IA32_FS_BASE: u32 = 0xc0000100;
/// Map of BASE Address of GS (R/W) See Table 35-2.
pub const IA32_GS_BASE: u32 = 0xc0000101;
-/// If CPUID.80000001.EDX.\[bit 29\] = 1
-pub const IA32_KERNEL_GS_BASE: u32 = 0xc0000102;
-
/// Swap Target of BASE Address of GS (R/W) See Table 35-2.
pub const IA32_KERNEL_GSBASE: u32 = 0xc0000102;
diff --git a/src/segmentation.rs b/src/segmentation.rs
index 4b08b99..8757add 100644
--- a/src/segmentation.rs
+++ b/src/segmentation.rs
@@ -568,17 +568,6 @@ 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::*;