profile.h revision 88088
1/* $FreeBSD: head/sys/ia64/include/profile.h 88088 2001-12-18 00:27:18Z jhb $ */ 2/* From: NetBSD: profile.h,v 1.9 1997/04/06 08:47:37 cgd Exp */ 3 4/* 5 * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. 6 * All rights reserved. 7 * 8 * Author: Chris G. Demetriou 9 * 10 * Permission to use, copy, modify and distribute this software and 11 * its documentation is hereby granted, provided that both the copyright 12 * notice and this permission notice appear in all copies of the 13 * software, derivative works or modified versions, and any portions 14 * thereof, and that both notices appear in supporting documentation. 15 * 16 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 17 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 18 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 19 * 20 * Carnegie Mellon requests users of this software to return to 21 * 22 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 23 * School of Computer Science 24 * Carnegie Mellon University 25 * Pittsburgh PA 15213-3890 26 * 27 * any improvements or extensions that they make and grant Carnegie the 28 * rights to redistribute these changes. 29 */ 30 31#define _MCOUNT_DECL void mcount 32 33#define FUNCTION_ALIGNMENT 32 34 35typedef u_long fptrdiff_t; 36 37#define MCOUNT __asm (" \n\ 38 .globl _mcount \n\ 39 .proc _mcount \n\ 40_mcount: \n\ 41 alloc loc0=ar.pfs,8,7,2,0 // space to save r8-r11,rp,b7 \n\ 42 add sp=-8*16,sp // space to save f8-f15 \n\ 43 mov loc1=rp // caller's return address \n\ 44 mov loc2=b7 // our return back to caller \n\ 45 ;; \n\ 46 add r17=16,sp // leave 16 bytes for mcount \n\ 47 add r18=32,sp \n\ 48 ;; \n\ 49 mov loc3=r8 // structure return address \n\ 50 mov loc4=r9 // language specific \n\ 51 mov loc5=r10 // language specific \n\ 52 mov loc6=r11 // language specific \n\ 53 ;; \n\ 54 stf.spill [r17]=f8,32 // save float arguments \n\ 55 stf.spill [r18]=f9,32 \n\ 56 mov out0=rp // frompc \n\ 57 ;; \n\ 58 stf.spill [r17]=f10,32 \n\ 59 stf.spill [r18]=f11,32 \n\ 60 mov out1=b7 // selfpc \n\ 61 ;; \n\ 62 stf.spill [r17]=f12,32 \n\ 63 stf.spill [r18]=f13,32 \n\ 64 ;; \n\ 65 stf.spill [r17]=f14,32 \n\ 66 stf.spill [r18]=f15,32 \n\ 67 ;; \n\ 68 br.call.sptk.many rp=mcount \n\ 69 ;; \n\ 70 add r17=16,sp \n\ 71 add r18=32,sp \n\ 72 ;; \n\ 73 ldf.fill f8=[r17],32 \n\ 74 ldf.fill f9=[r18],32 \n\ 75 mov r8=loc3 // restore structure pointer \n\ 76 ;; \n\ 77 ldf.fill f10=[r17],32 // restore float arguments \n\ 78 ldf.fill f11=[r18],32 \n\ 79 mov r9=loc4 \n\ 80 ;; \n\ 81 ldf.fill f12=[r17],32 // etc. \n\ 82 ldf.fill f13=[r18],32 \n\ 83 mov r10=loc5 \n\ 84 ;; \n\ 85 ldf.fill f14=[r17],32 \n\ 86 ldf.fill f15=[r18],32 \n\ 87 mov r11=loc6 \n\ 88 ;; \n\ 89 mov b7=loc2 // clean up \n\ 90 mov rp=loc1 \n\ 91 mov ar.pfs=loc0 \n\ 92 ;; \n\ 93 alloc r14=ar.pfs,0,0,8,0 // drop our register frame \n\ 94 br.sptk.many b7 // back to caller \n\ 95 \n\ 96 .end _mcount"); 97 98#ifdef _KERNEL 99/* 100 * The following two macros do splhigh and splx respectively. 101 */ 102#define MCOUNT_ENTER(s) \n\ 103 _c = cpu_critical_enter() 104#define MCOUNT_EXIT(s) \n\ 105 cpu_critical_exit(_c) 106#define MCOUNT_DECL(s) critical_t c; 107#ifdef GUPROF 108struct gmonparam; 109 110void nullfunc_loop_profiled __P((void)); 111void nullfunc_profiled __P((void)); 112void startguprof __P((struct gmonparam *p)); 113void stopguprof __P((struct gmonparam *p)); 114#else 115#define startguprof(p) 116#define stopguprof(p) 117#endif /* GUPROF */ 118 119#else /* !_KERNEL */ 120typedef u_long uintfptr_t; 121#endif 122