Skip to content

Commit 078acef

Browse files
committed
Store aarch64 link register; and fix stack align on x86_64
Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
1 parent 98b1c89 commit 078acef

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

profiling/src/wall_time.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,20 @@ mod frameless {
175175
// Calls original function, then calls interrupt function.
176176
#[cfg(target_arch = "aarch64")]
177177
dynasm!(assembler
178+
; stp x29, x30, [sp, -16]! // save link register and allow clobber of x29
179+
; mov x29, sp // store stack pointer
178180
; mov x16, *orig as u64
179181
; blr x16
182+
; ldp x29, x30, [sp], 16 // restore link register
180183
; mov x16, interrupt_addr as u64
181184
; br x16 // tail call
182185
);
183186
#[cfg(target_arch = "x86_64")]
184187
dynasm!(assembler
188+
; push rbp // align stack
185189
; mov rax, QWORD *orig as i64
186190
; call rax
191+
; pop rbp // restore stack
187192
; mov rax, QWORD interrupt_addr as i64
188193
; jmp rax // tail call
189194
);

0 commit comments

Comments
 (0)