Update copyright notices with scripts/update-copyrights
[glibc.git] / sysdeps / sh / _mcount.S
blob6da92420d810c9bda2812d9fd37e8ed3a05758dc
1 /* Machine-specific calling sequence for `mcount' profiling function.  SuperH
2    Copyright (C) 2001-2014 Free Software Foundation, Inc.
3    Contributed by NIIBE Yutaka <gniibe@m17n.org>
4    This file is part of the GNU C Library.
6    The GNU C Library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
11    The GNU C Library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
16    You should have received a copy of the GNU Lesser General Public
17    License along with the GNU C Library; if not, see
18    <http://www.gnu.org/licenses/>.  */
20 #include <sysdep.h>
22         .globl C_SYMBOL_NAME(_mcount)
23         .type C_SYMBOL_NAME(_mcount),@function
24         cfi_startproc
25         .align  5
26 C_LABEL(_mcount)
27         /* Save registers.  */
28         mov.l   r4,@-r15
29         cfi_adjust_cfa_offset (4)
30         cfi_rel_offset (r4, 0)
31         mov.l   r5,@-r15
32         cfi_adjust_cfa_offset (4)
33         cfi_rel_offset (r5, 0)
34         mov.l   r6,@-r15
35         cfi_adjust_cfa_offset (4)
36         cfi_rel_offset (r6, 0)
37         mov.l   r7,@-r15
38         cfi_adjust_cfa_offset (4)
39         cfi_rel_offset (r7, 0)
40         sts.l   pr,@-r15
41         cfi_adjust_cfa_offset (4)
42         cfi_rel_offset (pr, 0)
44         mov.l   @(20,r15),r4
45         sts     pr,r5
47 #ifdef SHARED
48         mov.l   0f,r1
49         mova    0f,r0
50         add     r1,r0
51         mov.l   1f,r1
52         mov.l   @(r0,r1),r1
53 #else
54         mov.l   1f,r1
55 #endif
56         jsr     @r1
57          nop
59         /* Pop the saved registers.  */
60         lds.l   @r15+,pr
61         cfi_adjust_cfa_offset (-4)
62         cfi_restore (pr)
63         mov.l   @r15+,r7
64         cfi_adjust_cfa_offset (-4)
65         cfi_restore (r7)
66         mov.l   @r15+,r6
67         cfi_adjust_cfa_offset (-4)
68         cfi_restore (r6)
69         mov.l   @r15+,r5
70         cfi_adjust_cfa_offset (-4)
71         cfi_restore (r5)
72         rts
73          mov.l  @r15+,r4
74         /* Omit CFI for restore in delay slot.  */
76         .align 2
77 #ifdef SHARED
78 0:      .long   _GLOBAL_OFFSET_TABLE_
79 1:      .long   C_SYMBOL_NAME(__mcount_internal)@GOT
80 #else
81 1:      .long   C_SYMBOL_NAME(__mcount_internal)
82 #endif
83         cfi_endproc
84 ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount))
86 #undef mcount
87 weak_alias (_mcount, mcount)