2016-12-27 20:13:35 +00:00
|
|
|
/* S/390-specific implementation of profiling support.
|
2022-01-01 18:54:23 +00:00
|
|
|
Copyright (C) 2000-2022 Free Software Foundation, Inc.
|
2000-08-02 15:15:00 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 04:58:11 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
2000-08-02 15:15:00 +00:00
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-07-06 04:58:11 +00:00
|
|
|
Lesser General Public License for more details.
|
2000-08-02 15:15:00 +00:00
|
|
|
|
2001-07-06 04:58:11 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
|
|
|
<https://www.gnu.org/licenses/>. */
|
2000-08-02 15:15:00 +00:00
|
|
|
|
|
|
|
#include <sysdep.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* How profiling works on S/390:
|
|
|
|
* On the start of each function _mcount is called with the address of a
|
|
|
|
* data word in %r1 (initialized to 0, used for counting). The compiler
|
|
|
|
* with the option -p generates code of the form:
|
|
|
|
*
|
|
|
|
* STM 6,15,24(15)
|
|
|
|
* BRAS 13,.LTN0_0
|
|
|
|
* .LT0_0:
|
|
|
|
* .LC12: .long _mcount
|
|
|
|
* .LC13: .long .LP0
|
|
|
|
* .data
|
|
|
|
* .align 4
|
|
|
|
* .LP0: .long 0
|
|
|
|
* .text
|
|
|
|
* # function profiler
|
|
|
|
* st 14,4(15)
|
|
|
|
* l 14,.LC12-.LT0_0(13)
|
|
|
|
* l 1,.LC13-.LT0_0(13)
|
|
|
|
* basr 14,14
|
|
|
|
* l 14,4(15)
|
|
|
|
*
|
|
|
|
* The _mcount implementation now has to call __mcount_internal with the
|
|
|
|
* address of .LP0 as first parameter and the return address as second
|
|
|
|
* parameter. &.LP0 was loaded to %r1 and the return address is in %r14.
|
|
|
|
* _mcount may not modify any register.
|
|
|
|
*/
|
|
|
|
|
2012-07-10 12:30:24 +00:00
|
|
|
.globl C_SYMBOL_NAME(_mcount)
|
2012-08-02 19:04:29 +00:00
|
|
|
.type C_SYMBOL_NAME(_mcount), @function
|
2009-12-08 01:27:45 +00:00
|
|
|
cfi_startproc
|
2000-08-02 15:15:00 +00:00
|
|
|
.align ALIGNARG(4)
|
|
|
|
C_LABEL(_mcount)
|
|
|
|
/* Save the caller-clobbered registers. */
|
|
|
|
ahi %r15,-128
|
2009-12-08 01:27:45 +00:00
|
|
|
cfi_adjust_cfa_offset (128)
|
2018-08-10 07:07:44 +00:00
|
|
|
/* binutils 2.28+: .cfi_val_offset r15, -96 */
|
|
|
|
.cfi_escape \
|
|
|
|
/* DW_CFA_val_offset */ 0x14, \
|
|
|
|
/* r15 */ 0x0f, \
|
|
|
|
/* scaled offset */ 0x18
|
2000-08-02 15:15:00 +00:00
|
|
|
stm %r14,%r5,96(%r15)
|
2018-08-10 07:07:44 +00:00
|
|
|
cfi_offset (r14, -128)
|
2000-08-02 15:15:00 +00:00
|
|
|
l %r2,132(%r15) # callers address = first parameter
|
|
|
|
la %r2,0(%r2) # clear bit 0
|
|
|
|
la %r3,0(%r14) # callees address = second parameter
|
|
|
|
|
|
|
|
#ifdef PIC
|
|
|
|
bras %r14,0f
|
|
|
|
.long _GLOBAL_OFFSET_TABLE_-.
|
|
|
|
0: al %r14,0(%r14)
|
|
|
|
l %r14,__mcount_internal@GOT(%r14)
|
|
|
|
#else
|
|
|
|
bras %r14,0f
|
|
|
|
.long __mcount_internal
|
|
|
|
0: l %r14,0(%r14)
|
|
|
|
#endif
|
|
|
|
basr %r14,%r14
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Pop the saved registers. Please note that `mcount' has no
|
|
|
|
* return value.
|
|
|
|
*/
|
|
|
|
lm %r14,%r5,96(%r15)
|
|
|
|
ahi %r15,128
|
2009-12-08 01:27:45 +00:00
|
|
|
cfi_adjust_cfa_offset (-128)
|
2000-08-02 15:15:00 +00:00
|
|
|
br %r14
|
2009-12-08 01:27:45 +00:00
|
|
|
cfi_endproc
|
2000-08-02 15:15:00 +00:00
|
|
|
ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount))
|
|
|
|
|
|
|
|
#undef mcount
|
2005-05-26 14:30:51 +00:00
|
|
|
weak_alias (_mcount, mcount)
|