Skip to content

Commit 5f683b1

Browse files
authored
Merge pull request #42 from hermit-os/nightly
fix(backend): migrate to `naked_asm!`
2 parents 9dee139 + 5b5b1ee commit 5f683b1

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
- name: Replay
4444
run: uftrace replay --data=tracedir --output-fields=tid | tee ci.snap
4545
- name: Compare to snapshot
46-
run: diff ci.snap out.snap
46+
run: diff -u out.snap ci.snap
4747

4848
rust:
4949
name: Rust
@@ -70,4 +70,4 @@ jobs:
7070
- name: Replay
7171
run: uftrace replay --data=tracedir --output-fields=tid | tee ci.snap
7272
- name: Compare to snapshot
73-
run: diff ci.snap out.snap
73+
run: diff -u out.snap ci.snap

examples/rust/out.snap

+10
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,13 @@
99
[ 1] | } /* rftrace_rs_test::test3 */
1010
[ 1] | } /* rftrace_rs_test::test2 */
1111
[ 1] | } /* rftrace_rs_test::test1 */
12+
[ 1] | rftrace_frontend::frontend::dump_full_uftrace() {
13+
[ 1] | rftrace_frontend::frontend::dump_traces() {
14+
[ 1] | rftrace_frontend::frontend::disable();
15+
16+
uftrace stopped tracing with remaining functions
17+
================================================
18+
task: 1
19+
[1] rftrace_frontend::frontend::dump_traces
20+
[0] rftrace_frontend::frontend::dump_full_uftrace
21+

rftrace/src/backend.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use core::arch::asm;
1+
use core::arch::naked_asm;
22
use core::arch::x86_64::_rdtsc;
33
use core::slice;
44
use core::sync::atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering};
@@ -87,7 +87,7 @@ pub unsafe extern "C" fn mcount() {
8787
// mcounts ret addr is directly at rsp
8888

8989
// based on https://github.com/namhyung/uftrace/blob/master/arch/x86_64/mcount.S
90-
asm!(
90+
naked_asm!(
9191
// if ENABLED.load(Ordering::Relaxed) {
9292
// return;
9393
// }
@@ -132,7 +132,6 @@ pub unsafe extern "C" fn mcount() {
132132
"pop rax",
133133
"ret",
134134
// TODO: ENABLED = sym ENABLED,
135-
options(noreturn),
136135
);
137136
}
138137

@@ -395,7 +394,7 @@ pub unsafe extern "C" fn mcount_return_trampoline() {
395394
RSP +0 rax
396395
*/
397396

398-
asm!(
397+
naked_asm!(
399398
prologue!(),
400399
// always backup return registers
401400
"mov [rsp + 8], rdx",
@@ -416,7 +415,6 @@ pub unsafe extern "C" fn mcount_return_trampoline() {
416415
restore_sse2!(),
417416
epilogue!(),
418417
"ret",
419-
options(noreturn),
420418
);
421419
}
422420

0 commit comments

Comments
 (0)