1 // Copyright 2021 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Push all callee-saved registers to get them on the stack for conservative 6 // stack scanning. 7 // 8 // See asm/x64/push_registers_clang.cc for why the function is not generated 9 // using clang. 10 // 11 // We maintain 8-byte alignment at calls by pushing an additional 12 // non-callee-saved register (r3). 13 // 14 // Calling convention source: 15 // https://en.wikipedia.org/wiki/Calling_convention#ARM_(A32) 16 // http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka4127.html 17 asm(".globl PAPushAllRegistersAndIterateStack \n" 18 ".type PAPushAllRegistersAndIterateStack, %function \n" 19 ".hidden PAPushAllRegistersAndIterateStack \n" 20 "PAPushAllRegistersAndIterateStack: \n" 21 // Push all callee-saved registers and save return address. 22 // Only {r4-r11} are callee-saved registers. Push r3 in addition to align 23 // the stack back to 8 bytes. 24 " push {r3-r11, lr} \n" 25 // Pass 1st parameter (r0) unchanged (Stack*). 26 // Pass 2nd parameter (r1) unchanged (StackVisitor*). 27 // Save 3rd parameter (r2; IterateStackCallback). 28 " mov r3, r2 \n" 29 // Pass 3rd parameter as sp (stack pointer). 30 " mov r2, sp \n" 31 // Call the callback. 32 " blx r3 \n" 33 // Discard all the registers. 34 " add sp, sp, #36 \n" 35 // Pop lr into pc which returns and switches mode if needed. 36 " pop {pc} \n"); 37