Skip to content

Commit

Permalink
fix(backend): migrate to naked_asm!
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Kröning <[email protected]>
  • Loading branch information
mkroening committed Oct 11, 2024
1 parent 9dee139 commit 0c62390
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions rftrace/src/backend.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::arch::asm;
use core::arch::naked_asm;
use core::arch::x86_64::_rdtsc;
use core::slice;
use core::sync::atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering};
Expand Down Expand Up @@ -87,7 +87,7 @@ pub unsafe extern "C" fn mcount() {
// mcounts ret addr is directly at rsp

// based on https://github.com/namhyung/uftrace/blob/master/arch/x86_64/mcount.S
asm!(
naked_asm!(
// if ENABLED.load(Ordering::Relaxed) {
// return;
// }
Expand Down Expand Up @@ -132,7 +132,6 @@ pub unsafe extern "C" fn mcount() {
"pop rax",
"ret",
// TODO: ENABLED = sym ENABLED,
options(noreturn),
);
}

Expand Down Expand Up @@ -395,7 +394,7 @@ pub unsafe extern "C" fn mcount_return_trampoline() {
RSP +0 rax
*/

asm!(
naked_asm!(
prologue!(),
// always backup return registers
"mov [rsp + 8], rdx",
Expand All @@ -416,7 +415,6 @@ pub unsafe extern "C" fn mcount_return_trampoline() {
restore_sse2!(),
epilogue!(),
"ret",
options(noreturn),
);
}

Expand Down

0 comments on commit 0c62390

Please sign in to comment.