1 /* $NetBSD: _mcount.S,v 1.2 2005/12/21 18:11:11 christos Exp $ */
4 * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
7 * Author: Chris G. Demetriou
9 * Permission to use, copy, modify and distribute this software and
10 * its documentation is hereby granted, provided that both the copyright
11 * notice and this permission notice appear in all copies of the
12 * software, derivative works or modified versions, and any portions
13 * thereof, and that both notices appear in supporting documentation.
15 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19 * Carnegie Mellon requests users of this software to return to
21 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
22 * School of Computer Science
23 * Carnegie Mellon University
24 * Pittsburgh PA 15213-3890
26 * any improvements or extensions that they make and grant Carnegie the
27 * rights to redistribute these changes.
30 #if defined(GPROF) && !defined(_STANDALONE)
32 #include <machine/asm.h>
33 #include <machine/profile.h>
35 #define OFFSET_AT (0 * 8)
36 #define OFFSET_V0 (1 * 8)
37 #define OFFSET_T0 (2 * 8)
38 #define OFFSET_T1 (3 * 8)
39 #define OFFSET_T2 (4 * 8)
40 #define OFFSET_T3 (5 * 8)
41 #define OFFSET_T4 (6 * 8)
42 #define OFFSET_T5 (7 * 8)
43 #define OFFSET_T6 (8 * 8)
44 #define OFFSET_T7 (9 * 8)
45 #define OFFSET_S6 (10 * 8)
46 #define OFFSET_A0 (11 * 8)
47 #define OFFSET_A1 (12 * 8)
48 #define OFFSET_A2 (13 * 8)
49 #define OFFSET_A3 (14 * 8)
50 #define OFFSET_A4 (15 * 8)
51 #define OFFSET_A5 (16 * 8)
52 #define OFFSET_T8 (17 * 8)
53 #define OFFSET_T9 (18 * 8)
54 #define OFFSET_T10 (19 * 8)
55 #define OFFSET_T11 (20 * 8)
56 #define OFFSET_RA (21 * 8)
57 #define OFFSET_T12 (22 * 8)
58 #define OFFSET_GP (23 * 8)
59 #define FRAME_SIZE (24 * 8)
61 LEAF_NOPROFILE(_mcount,0) /* XXX */
65 lda sp, -FRAME_SIZE(sp)
67 stq at_reg, OFFSET_AT(sp)
77 stq s6, OFFSET_S6(sp) /* XXX because run _after_ prologue. */
86 stq t10, OFFSET_T10(sp)
87 stq t11, OFFSET_T11(sp)
89 stq t12, OFFSET_T12(sp)
100 ldq t1, OFFSET_T1(sp)
101 ldq t2, OFFSET_T2(sp)
102 ldq t3, OFFSET_T3(sp)
103 ldq t4, OFFSET_T4(sp)
104 ldq t5, OFFSET_T5(sp)
105 ldq t6, OFFSET_T6(sp)
106 ldq t7, OFFSET_T7(sp)
107 ldq s6, OFFSET_S6(sp) /* XXX because run _after_ prologue. */
108 ldq a0, OFFSET_A0(sp)
109 ldq a1, OFFSET_A1(sp)
110 ldq a2, OFFSET_A2(sp)
111 ldq a3, OFFSET_A3(sp)
112 ldq a4, OFFSET_A4(sp)
113 ldq a5, OFFSET_A5(sp)
114 ldq t8, OFFSET_T8(sp)
115 ldq t9, OFFSET_T9(sp)
116 ldq t10, OFFSET_T10(sp)
117 ldq t11, OFFSET_T11(sp)
118 ldq ra, OFFSET_RA(sp)
119 ldq t12, OFFSET_T12(sp)
120 ldq gp, OFFSET_GP(sp)
122 ldq at_reg, OFFSET_AT(sp)
124 lda sp, FRAME_SIZE(sp)
125 ret zero, (at_reg), 1