Home | History | Annotate | Line # | Download | only in gmon
      1  1.2  christos /* $NetBSD: _mcount.S,v 1.2 2005/12/21 18:11:11 christos Exp $ */
      2  1.1  christos 
      3  1.1  christos /*
      4  1.1  christos  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
      5  1.1  christos  * All rights reserved.
      6  1.1  christos  *
      7  1.1  christos  * Author: Chris G. Demetriou
      8  1.1  christos  *
      9  1.1  christos  * Permission to use, copy, modify and distribute this software and
     10  1.1  christos  * its documentation is hereby granted, provided that both the copyright
     11  1.1  christos  * notice and this permission notice appear in all copies of the
     12  1.1  christos  * software, derivative works or modified versions, and any portions
     13  1.1  christos  * thereof, and that both notices appear in supporting documentation.
     14  1.1  christos  *
     15  1.1  christos  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     16  1.1  christos  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     17  1.1  christos  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     18  1.1  christos  *
     19  1.1  christos  * Carnegie Mellon requests users of this software to return to
     20  1.1  christos  *
     21  1.1  christos  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     22  1.1  christos  *  School of Computer Science
     23  1.1  christos  *  Carnegie Mellon University
     24  1.1  christos  *  Pittsburgh PA 15213-3890
     25  1.1  christos  *
     26  1.1  christos  * any improvements or extensions that they make and grant Carnegie the
     27  1.1  christos  * rights to redistribute these changes.
     28  1.1  christos  */
     29  1.1  christos 
     30  1.2  christos #if defined(GPROF) && !defined(_STANDALONE)
     31  1.2  christos 
     32  1.1  christos #include <machine/asm.h>
     33  1.1  christos #include <machine/profile.h>
     34  1.1  christos 
     35  1.1  christos #define	OFFSET_AT	(0 * 8)
     36  1.1  christos #define OFFSET_V0	(1 * 8)
     37  1.1  christos #define OFFSET_T0	(2 * 8)
     38  1.1  christos #define OFFSET_T1	(3 * 8)
     39  1.1  christos #define OFFSET_T2	(4 * 8)
     40  1.1  christos #define OFFSET_T3	(5 * 8)
     41  1.1  christos #define OFFSET_T4	(6 * 8)
     42  1.1  christos #define OFFSET_T5	(7 * 8)
     43  1.1  christos #define OFFSET_T6	(8 * 8)
     44  1.1  christos #define OFFSET_T7	(9 * 8)
     45  1.1  christos #define OFFSET_S6	(10 * 8)
     46  1.1  christos #define OFFSET_A0	(11 * 8)
     47  1.1  christos #define OFFSET_A1	(12 * 8)
     48  1.1  christos #define OFFSET_A2	(13 * 8)
     49  1.1  christos #define OFFSET_A3	(14 * 8)
     50  1.1  christos #define OFFSET_A4	(15 * 8)
     51  1.1  christos #define OFFSET_A5	(16 * 8)
     52  1.1  christos #define OFFSET_T8	(17 * 8)
     53  1.1  christos #define OFFSET_T9	(18 * 8)
     54  1.1  christos #define OFFSET_T10	(19 * 8)
     55  1.1  christos #define OFFSET_T11	(20 * 8)
     56  1.1  christos #define OFFSET_RA	(21 * 8)
     57  1.1  christos #define OFFSET_T12	(22 * 8)
     58  1.1  christos #define OFFSET_GP	(23 * 8)
     59  1.1  christos #define	FRAME_SIZE	(24 * 8)
     60  1.1  christos 
     61  1.1  christos LEAF_NOPROFILE(_mcount,0)		/* XXX */
     62  1.1  christos 	.set noat
     63  1.1  christos 	.set noreorder
     64  1.1  christos 
     65  1.1  christos 	lda	sp, -FRAME_SIZE(sp)
     66  1.1  christos 
     67  1.1  christos 	stq	at_reg, OFFSET_AT(sp)
     68  1.1  christos 	stq	v0, OFFSET_V0(sp)
     69  1.1  christos 	stq	t0, OFFSET_T0(sp)
     70  1.1  christos 	stq	t1, OFFSET_T1(sp)
     71  1.1  christos 	stq	t2, OFFSET_T2(sp)
     72  1.1  christos 	stq	t3, OFFSET_T3(sp)
     73  1.1  christos 	stq	t4, OFFSET_T4(sp)
     74  1.1  christos 	stq	t5, OFFSET_T5(sp)
     75  1.1  christos 	stq	t6, OFFSET_T6(sp)
     76  1.1  christos 	stq	t7, OFFSET_T7(sp)
     77  1.1  christos 	stq	s6, OFFSET_S6(sp)	/* XXX because run _after_ prologue. */
     78  1.1  christos 	stq	a0, OFFSET_A0(sp)
     79  1.1  christos 	stq	a1, OFFSET_A1(sp)
     80  1.1  christos 	stq	a2, OFFSET_A2(sp)
     81  1.1  christos 	stq	a3, OFFSET_A3(sp)
     82  1.1  christos 	stq	a4, OFFSET_A4(sp)
     83  1.1  christos 	stq	a5, OFFSET_A5(sp)
     84  1.1  christos 	stq	t8, OFFSET_T8(sp)
     85  1.1  christos 	stq	t9, OFFSET_T9(sp)
     86  1.1  christos 	stq	t10, OFFSET_T10(sp)
     87  1.1  christos 	stq	t11, OFFSET_T11(sp)
     88  1.1  christos 	stq	ra, OFFSET_RA(sp)
     89  1.1  christos 	stq	t12, OFFSET_T12(sp)
     90  1.1  christos 	stq	gp, OFFSET_GP(sp)
     91  1.1  christos 
     92  1.1  christos 	br	pv, 1f
     93  1.1  christos 1:	LDGP(pv)
     94  1.1  christos 	mov	ra, a0
     95  1.1  christos 	mov	at_reg, a1
     96  1.1  christos 	CALL(_MCOUNT_FUNC)
     97  1.1  christos 
     98  1.1  christos 	ldq	v0, OFFSET_V0(sp)
     99  1.1  christos 	ldq	t0, OFFSET_T0(sp)
    100  1.1  christos 	ldq	t1, OFFSET_T1(sp)
    101  1.1  christos 	ldq	t2, OFFSET_T2(sp)
    102  1.1  christos 	ldq	t3, OFFSET_T3(sp)
    103  1.1  christos 	ldq	t4, OFFSET_T4(sp)
    104  1.1  christos 	ldq	t5, OFFSET_T5(sp)
    105  1.1  christos 	ldq	t6, OFFSET_T6(sp)
    106  1.1  christos 	ldq	t7, OFFSET_T7(sp)
    107  1.1  christos 	ldq	s6, OFFSET_S6(sp)	/* XXX because run _after_ prologue. */
    108  1.1  christos 	ldq	a0, OFFSET_A0(sp)
    109  1.1  christos 	ldq	a1, OFFSET_A1(sp)
    110  1.1  christos 	ldq	a2, OFFSET_A2(sp)
    111  1.1  christos 	ldq	a3, OFFSET_A3(sp)
    112  1.1  christos 	ldq	a4, OFFSET_A4(sp)
    113  1.1  christos 	ldq	a5, OFFSET_A5(sp)
    114  1.1  christos 	ldq	t8, OFFSET_T8(sp)
    115  1.1  christos 	ldq	t9, OFFSET_T9(sp)
    116  1.1  christos 	ldq	t10, OFFSET_T10(sp)
    117  1.1  christos 	ldq	t11, OFFSET_T11(sp)
    118  1.1  christos 	ldq	ra, OFFSET_RA(sp)
    119  1.1  christos 	ldq	t12, OFFSET_T12(sp)
    120  1.1  christos 	ldq	gp, OFFSET_GP(sp)
    121  1.1  christos 
    122  1.1  christos 	ldq	at_reg, OFFSET_AT(sp)
    123  1.1  christos 
    124  1.1  christos 	lda	sp, FRAME_SIZE(sp)
    125  1.1  christos 	ret	zero, (at_reg), 1
    126  1.1  christos 
    127  1.1  christos 	END(_mcount)
    128  1.2  christos #endif
    129