File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -139,8 +139,6 @@ pub extern "C" fn ddog_php_prof_interrupt_function(execute_data: *mut zend_execu
139139
140140#[ cfg( php_frameless) ]
141141mod frameless {
142- #[ cfg( any( target_arch = "x86_64" , target_arch = "aarch64" ) ) ]
143-
144142 #[ cfg( any( target_arch = "x86_64" , target_arch = "aarch64" ) ) ]
145143 mod trampoline {
146144 #[ cfg( target_arch = "aarch64" ) ]
@@ -175,15 +173,20 @@ mod frameless {
175173 // Calls original function, then calls interrupt function.
176174 #[ cfg( target_arch = "aarch64" ) ]
177175 dynasm ! ( assembler
176+ ; stp x29, x30, [ sp, -16 ] ! // save link register and allow clobber of x29
177+ ; mov x29, sp // store stack pointer
178178 ; mov x16, * orig as u64
179179 ; blr x16
180+ ; ldp x29, x30, [ sp] , 16 // restore link register
180181 ; mov x16, interrupt_addr as u64
181182 ; br x16 // tail call
182183 ) ;
183184 #[ cfg( target_arch = "x86_64" ) ]
184185 dynasm ! ( assembler
186+ ; push rbp // align stack
185187 ; mov rax, QWORD * orig as i64
186188 ; call rax
189+ ; pop rbp // restore stack
187190 ; mov rax, QWORD interrupt_addr as i64
188191 ; jmp rax // tail call
189192 ) ;
You can’t perform that action at this time.
0 commit comments