]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - lib/libc/ia64/gen/_mcount.S
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / lib / libc / ia64 / gen / _mcount.S
1 /*
2  * Copyright (c) 2004 Marcel Moolenaar
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  */
26
27 #include <machine/asm.h>
28 __FBSDID("$FreeBSD$");
29
30         .text
31
32 /*
33  * Important registers:
34  *      r8      structure return address
35  *      r15     static link (nested routines)
36  *      rp      our return address
37  *      in0     caller's ar.pfs
38  *      in1     caller's gp
39  *      in2     caller's rp
40  *      in3     GOT entry
41  *      ar.pfs  our pfs
42  */
43 ENTRY_NOPROFILE(_mcount, 4)
44         alloc           loc0 = ar.pfs, 4, 4, 2, 0
45         mov             loc1 = r8
46         mov             loc2 = rp
47         mov             loc3 = r15
48         ;;
49         mov             out0 = in2
50         mov             out1 = rp
51         br.call.sptk    rp = __mcount
52         ;;
53 1:
54         mov             gp = in1
55         mov             r14 = ip
56         mov             b7 = loc2
57         ;;
58         add             r14 = 2f - 1b, r14
59         mov             ar.pfs = loc0
60         mov             rp = in2
61         ;;
62         mov             r15 = loc3
63         mov             b7 = r14
64         mov             b6 = loc2
65         mov             r8 = loc1
66         mov             r14 = in0
67         br.ret.sptk     b7
68         ;;
69 2:
70         mov             ar.pfs = r14
71         br.sptk         b6
72         ;;
73 END(_mcount)
74
75 WEAK_ALIAS(mcount, _mcount)