OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [linux/] [uClibc/] [libc/] [sysdeps/] [linux/] [sh/] [bits/] [machine-gmon.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
/* Machine-dependent definitions for profiling support.  SH version.
2
 *
3
 * Copyright (C) 2003 Stefan Allius <allius@atecom.com>
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Library General Public
7
 * License as published by the Free Software Foundation; either
8
 * version 2 of the License, or (at your option) any later version.
9
 *
10
 * This program 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
 * Library General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Library General Public
16
 * License along with this program; if not, write to the Free
17
 * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18
 * 02111-1307 USA
19
 */
20
 
21
#define mcount_internal __mcount_internal
22
 
23
#define _MCOUNT_DECL(frompc, selfpc) \
24
static void __attribute__((unused)) mcount_internal (u_long frompc, u_long selfpc)
25
 
26
/*
27
 * This mcount implementation expect the 'frompc' return address on
28
 * the stack and the 'selfpc' return address in register pr.
29
 *
30
 * Your compiler should include some stuff like this at each function
31
 * entry:
32
 *
33
 *      mov.l   1f,r1
34
 *      sts.l   pr,@-r15
35
 *      mova    2f,r0
36
 *      jmp     @r1
37
 *       lds    r0,pr
38
 *      .align  2
39
 * 1:   .long   mcount
40
 * 2:   lds.l   @r15+,pr
41
 *
42
 * or for PIC:
43
 *
44
 *      mov.l   3f,r1
45
 *      mova    3f,r0
46
 *      add     r1,r0
47
 *      mov.l   1f,r1
48
 *      mov.l   @(r0,r1),r1
49
 *      sts.l   pr,@-r15
50
 *      mova    2f,r0
51
 *      jmp     @r1
52
 *       lds    r0,pr
53
 *      .align  2
54
 * 1:   .long   mcount@GOT
55
 * 3:   .long   _GLOBAL_OFFSET_TABLE_
56
 * 2:   lds.l   @r15+,pr
57
 *
58
 *
59
 * This ABI will be supported by GCC version 3.3 or newer!
60
 */
61
#define MCOUNT asm(\
62
        ".align 4\n\t" \
63
        ".globl _mcount\n\t" \
64
        ".type _mcount,@function\n" \
65
        "_mcount:\n\t" \
66
        "mov.l r4,  @-r15\n\t" \
67
        "mov.l r5,  @-r15\n\t" \
68
        "mov.l r6,  @-r15\n\t" \
69
        "mov.l r7,  @-r15\n\t" \
70
        "sts.l pr,  @-r15\n\t" \
71
        "sts   pr, r5\n\t" \
72
        "bsr __mcount_internal\n\t" \
73
        " mov.l @(5*4,r15), r4\n\t" \
74
        "lds.l @r15+, pr\n\t" \
75
        "mov.l @r15+, r7\n\t" \
76
        "mov.l @r15+, r6\n\t" \
77
        "mov.l @r15+, r5\n\t" \
78
        "rts\n\t" \
79
        " mov.l @r15+, r4\n\t" \
80
        ".size _mcount,.-_mcount;\n\t" \
81
        ".weak mcount;\n\t" \
82
        " mcount = _mcount;");
83
 

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.