deprecate read/write eflags (#494)

This commit is contained in:
gnzlbg 2018-06-27 20:32:11 +02:00 committed by Alex Crichton
parent 0402aba4be
commit f55d7be7c9

View file

@ -6,6 +6,8 @@
#[cfg(target_arch = "x86")]
#[inline(always)]
#[stable(feature = "simd_x86", since = "1.27.0")]
#[rustc_deprecated(since = "1.29.0", reason = "See issue #51810 - use inline assembly instead")]
#[doc(hidden)]
pub unsafe fn __readeflags() -> u32 {
let eflags: u32;
asm!("pushfd; popl $0" : "=r"(eflags) : : : "volatile");
@ -18,6 +20,8 @@ pub unsafe fn __readeflags() -> u32 {
#[cfg(target_arch = "x86_64")]
#[inline(always)]
#[stable(feature = "simd_x86", since = "1.27.0")]
#[rustc_deprecated(since = "1.29.0", reason = "See issue #51810 - use inline assembly instead")]
#[doc(hidden)]
pub unsafe fn __readeflags() -> u64 {
let eflags: u64;
asm!("pushfq; popq $0" : "=r"(eflags) : : : "volatile");
@ -30,6 +34,8 @@ pub unsafe fn __readeflags() -> u64 {
#[cfg(target_arch = "x86")]
#[inline(always)]
#[stable(feature = "simd_x86", since = "1.27.0")]
#[rustc_deprecated(since = "1.29.0", reason = "See issue #51810 - use inline assembly instead")]
#[doc(hidden)]
pub unsafe fn __writeeflags(eflags: u32) {
asm!("pushl $0; popfd" : : "r"(eflags) : "cc", "flags" : "volatile");
}
@ -40,6 +46,8 @@ pub unsafe fn __writeeflags(eflags: u32) {
#[cfg(target_arch = "x86_64")]
#[inline(always)]
#[stable(feature = "simd_x86", since = "1.27.0")]
#[rustc_deprecated(since = "1.29.0", reason = "See issue #51810 - use inline assembly instead")]
#[doc(hidden)]
pub unsafe fn __writeeflags(eflags: u64) {
asm!("pushq $0; popfq" : : "r"(eflags) : "cc", "flags" : "volatile");
}
@ -49,6 +57,7 @@ mod tests {
use coresimd::x86::*;
#[test]
#[allow(deprecated)]
fn test_eflags() {
unsafe {
// reads eflags, writes them back, reads them again,