Skip to content

Commit

Permalink
Merge pull request #27 from humb1t/update-asm
Browse files Browse the repository at this point in the history
llvm_asm macros was changed to an asm
  • Loading branch information
cesarb committed Apr 15, 2022
2 parents 0e95e0d + c0c61b2 commit 4219eb8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/hide.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ pub use self::impls::hide_mem_impl;
// On nightly, inline assembly can be used.
#[cfg(feature = "nightly")]
mod impls {
use core::arch::asm;

trait HideMemImpl {
fn hide_mem_impl(ptr: *mut Self);
}
Expand All @@ -35,8 +37,8 @@ mod impls {
#[inline]
default fn hide_mem_impl(ptr: *mut Self) {
unsafe {
llvm_asm!("" : : "r" (ptr as *mut u8) : "memory");
// asm!("", in(reg) (ptr as *mut u8), options(nostack));
//llvm_asm!("" : : "r" (ptr as *mut u8) : "memory");
asm!("/* {0} */", in(reg) (ptr as *mut u8), options(nostack));
}
}
}
Expand All @@ -45,8 +47,8 @@ mod impls {
#[inline]
fn hide_mem_impl(ptr: *mut Self) {
unsafe {
llvm_asm!("" : "=*m" (ptr) : "*0" (ptr));
// asm!("", in(reg) ptr, options(nostack));
//llvm_asm!("" : "=*m" (ptr) : "*0" (ptr));
asm!("/* {0} */", in(reg) ptr, options(nostack));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![cfg_attr(not(test), no_std)]
#![cfg_attr(feature = "nightly", feature(llvm_asm, i128_type, specialization))]
#![cfg_attr(feature = "nightly", feature(min_specialization))]
#![deny(missing_docs)]

//! Helpers for clearing sensitive data on the stack and heap.
Expand Down

0 comments on commit 4219eb8

Please sign in to comment.