Skip to content

Commit

Permalink
fix: replace deprecated 'asm!'
Browse files Browse the repository at this point in the history
  • Loading branch information
darfink committed May 28, 2020
1 parent 23c7fb4 commit eb49d95
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
18 changes: 12 additions & 6 deletions src/arch/x86/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ mod tests {
fn detour_relative_branch() -> Result<()> {
#[naked]
unsafe extern "C" fn branch_ret5() -> i32 {
asm!("xor eax, eax
llvm_asm!("
xor eax, eax
je ret5
mov eax, 2
jmp done
Expand All @@ -59,7 +60,8 @@ mod tests {
fn detour_hotpatch() -> Result<()> {
#[naked]
unsafe extern "C" fn hotpatch_ret0() -> i32 {
asm!("nop
llvm_asm!("
nop
nop
nop
nop
Expand All @@ -78,7 +80,8 @@ mod tests {
fn detour_padding_after() -> Result<()> {
#[naked]
unsafe extern "C" fn padding_after_ret0() -> i32 {
asm!("mov edi, edi
llvm_asm!("
mov edi, edi
xor eax, eax
ret
nop
Expand All @@ -94,7 +97,8 @@ mod tests {
fn detour_external_loop() {
#[naked]
unsafe extern "C" fn external_loop() -> i32 {
asm!("loop dest
llvm_asm!("
loop dest
nop
nop
nop
Expand All @@ -112,7 +116,8 @@ mod tests {
fn detour_rip_relative_pos() -> Result<()> {
#[naked]
unsafe extern "C" fn rip_relative_ret195() -> i32 {
asm!("xor eax, eax
llvm_asm!("
xor eax, eax
mov al, [rip+0x3]
nop
nop
Expand All @@ -130,7 +135,8 @@ mod tests {
fn detour_rip_relative_neg() -> Result<()> {
#[naked]
unsafe extern "C" fn rip_relative_prolog_ret49() -> i32 {
asm!("xor eax, eax
llvm_asm!("
xor eax, eax
mov al, [rip-0x8]
ret"
:::: "intel");
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#![cfg_attr(feature = "nightly", feature(const_fn, unboxed_closures, abi_thiscall))]
#![cfg_attr(
all(feature = "nightly", test),
feature(naked_functions, core_intrinsics, asm)
feature(naked_functions, core_intrinsics, llvm_asm)
)]

//! A cross-platform detour library written in Rust.
Expand Down

0 comments on commit eb49d95

Please sign in to comment.