diff options
author | 2019-02-07 15:38:34 -0800 | |
---|---|---|
committer | 2019-02-07 15:38:34 -0800 | |
commit | b8907ecb0ddaa4914deefc8da75751eefeb9de2c (patch) | |
tree | 8650b9aa533845c6a3a1c3bd5e10986ae41bd4db /src | |
parent | f70c546f98a8c4d183c50814820dd7d5458e927d (diff) | |
download | rust-x86-b8907ecb0ddaa4914deefc8da75751eefeb9de2c.tar.gz rust-x86-b8907ecb0ddaa4914deefc8da75751eefeb9de2c.tar.zst rust-x86-b8907ecb0ddaa4914deefc8da75751eefeb9de2c.zip |
Only include gs/fs base function for x86-64.
Diffstat (limited to 'src')
-rw-r--r-- | src/bits64/segmentation.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/bits64/segmentation.rs b/src/bits64/segmentation.rs index 20022b8..d297efc 100644 --- a/src/bits64/segmentation.rs +++ b/src/bits64/segmentation.rs @@ -129,7 +129,7 @@ impl BuildDescriptor<Descriptor64> for DescriptorBuilder { /// to %cs. Instead we push the new segment selector /// and return value on the stack and use lretq /// to reload cs and continue at 1:. -#[cfg(target_arch = "x86_64")] +#[cfg(target_arch = "x86-64")] pub unsafe fn load_cs(sel: SegmentSelector) { asm!("pushq $0; \ leaq 1f(%rip), %rax; \ @@ -140,18 +140,21 @@ pub unsafe fn load_cs(sel: SegmentSelector) { /// Write GS Segment Base /// Needs FSGSBASE-Enable Bit (bit 16 of CR4) set. +#[cfg(target_arch = "x86-64")] pub unsafe fn wrgsbase(base: u64) { asm!("wrgsbase $0" :: "r" (base) : "memory"); } /// Write FS Segment Base /// Needs FSGSBASE-Enable Bit (bit 16 of CR4) set. +#[cfg(target_arch = "x86-64")] pub unsafe fn wrfsbase(base: u64) { asm!("wrfsbase $0" :: "r" (base) : "memory"); } /// Read GS Segment Base /// Needs FSGSBASE-Enable Bit (bit 16 of CR4) set. +#[cfg(target_arch = "x86-64")] pub unsafe fn rdgsbase() -> u64 { let gs_base: u64; asm!("rdgsbase $0" : "=r" (gs_base) ); @@ -160,6 +163,7 @@ pub unsafe fn rdgsbase() -> u64 { /// Read FS Segment Base /// Needs FSGSBASE-Enable Bit (bit 16 of CR4) set. +#[cfg(target_arch = "x86-64")] pub unsafe fn rdfsbase() -> u64 { let fs_base: u64; asm!("rdfsbase $0" : "=r" (fs_base) ); |