1 /* Machine-specific calling sequence for `mcount' profiling function. x86-64 version.
2 Copyright (C) 2002-2023 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 /* Assembly stub to invoke _mcount(). Compiler generated code calls
20 this stub after executing a function's prologue and without saving any
21 registers. It is therefore necessary to preserve %rcx, %rdx, %rsi, %rdi,
22 %r8, %r9 as they may contain function arguments. */
27 /* Allocate space for 7 registers. */
29 cfi_adjust_cfa_offset (56)
31 cfi_rel_offset (rax, 0)
33 cfi_rel_offset (rcx, 8)
35 cfi_rel_offset (rdx, 16)
37 cfi_rel_offset (rsi, 24)
39 cfi_rel_offset (rdi, 32)
41 cfi_rel_offset (r8, 40)
43 cfi_rel_offset (r9, 48)
45 /* Setup parameter for __mcount_internal. */
46 /* selfpc is the return address on the stack. */
48 /* Get frompc via the frame pointer. */
50 call C_SYMBOL_NAME(__mcount_internal)
51 /* Pop the saved registers. Please note that `mcount' has no
68 cfi_adjust_cfa_offset (-56)
73 weak_alias (_mcount, mcount)
75 /* __fentry__ is different from _mcount in that it is called before
76 function prolog. This means (among other things) that it has non-standard
77 stack alignment on entry: (%RSP & 0xF) == 0. */
80 /* Allocate space for 7 registers
81 (+8 bytes for proper stack alignment). */
83 cfi_adjust_cfa_offset (64)
85 cfi_rel_offset (rax, 0)
87 cfi_rel_offset (rcx, 8)
89 cfi_rel_offset (rdx, 16)
91 cfi_rel_offset (rsi, 24)
93 cfi_rel_offset (rdi, 32)
95 cfi_rel_offset (r8, 40)
97 cfi_rel_offset (r9, 48)
99 /* Setup parameter for __mcount_internal. */
100 /* selfpc is the return address on the stack. */
102 /* caller is the return address above it */
104 call C_SYMBOL_NAME(__mcount_internal)
105 /* Pop the saved registers. Please note that `__fentry__' has no
122 cfi_adjust_cfa_offset (-64)