aboutsummaryrefslogtreecommitdiff
path: root/src/bits64/tobba.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bits64/tobba.rs')
-rw-r--r--src/bits64/tobba.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/bits64/tobba.rs b/src/bits64/tobba.rs
new file mode 100644
index 0000000..2243098
--- /dev/null
+++ b/src/bits64/tobba.rs
@@ -0,0 +1,17 @@
+#![allow(non_upper_case_globals)]
+
+pub use shared::*;
+
+#[inline(always)]
+pub fn get_flags() -> Flags {
+ unsafe {
+ let r: usize;
+ asm!("pushfq; pop $0" : "=r"(r) ::: "intel");
+ Flags::from_bits_truncate(r)
+ }
+}
+
+#[inline(always)]
+pub unsafe fn set_flags(val: Flags) {
+ asm!("push $0; popfq" :: "r"(val.bits()) : "flags" : "volatile", "intel");
+}