Skip to content

Commit

Permalink
Switch to rust-lang/rust#72016 asm! syntax
Browse files Browse the repository at this point in the history
Per the bug report referenced in the above, `asm!` is back ― but it has a [brand-new syntax](https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html) associated with it that includes, among other things, `intel` and `volatile` by default. As if that's not enough, they're now deprecating `llvm_asm!` upstream in favor of this.
  • Loading branch information
kennystrawnmusic authored Jul 16, 2020
1 parent f1afba8 commit 41c25af
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#![doc(html_root_url = "https://docs.rs/tinypci")]

#![feature(llvm_asm)]
#![feature(asm)]

#![cfg_attr(not(feature="std"), no_std)]

Expand All @@ -30,14 +30,14 @@ pub use enums::*;
#[inline]
unsafe fn read_from_port(port: u16) -> u32 {
let value: u32;
llvm_asm!("inl %dx, %eax" : "={eax}"(value) : "{dx}"(port) :: "volatile");
asm!("inl eax, dx", out("eax") value, in("dx") port);
value
}

// extracted from the `x86_64` crate.
#[inline]
unsafe fn write_to_port(port: u16, value: u32) {
llvm_asm!("outl %eax, %dx" :: "{dx}"(port), "{eax}"(value) :: "volatile");
asm!("outl eax, dx", out("dx") port, in("eax") value);
}


Expand Down

0 comments on commit 41c25af

Please sign in to comment.