profile.h revision 92843
1231437Sluigi/* $FreeBSD: head/sys/ia64/include/profile.h 92843 2002-03-20 23:30:31Z alfred $ */ 2252869Sdelphij/* From: NetBSD: profile.h,v 1.9 1997/04/06 08:47:37 cgd Exp */ 3231437Sluigi 4231437Sluigi/* 5231437Sluigi * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. 6231437Sluigi * All rights reserved. 7231437Sluigi * 8231437Sluigi * Author: Chris G. Demetriou 9231437Sluigi * 10231437Sluigi * Permission to use, copy, modify and distribute this software and 11231437Sluigi * its documentation is hereby granted, provided that both the copyright 12231437Sluigi * notice and this permission notice appear in all copies of the 13231437Sluigi * software, derivative works or modified versions, and any portions 14231437Sluigi * thereof, and that both notices appear in supporting documentation. 15231437Sluigi * 16231437Sluigi * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 17231437Sluigi * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 18231437Sluigi * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 19231437Sluigi * 20231437Sluigi * Carnegie Mellon requests users of this software to return to 21231437Sluigi * 22231437Sluigi * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 23231437Sluigi * School of Computer Science 24231437Sluigi * Carnegie Mellon University 25231437Sluigi * Pittsburgh PA 15213-3890 26231437Sluigi * 27231437Sluigi * any improvements or extensions that they make and grant Carnegie the 28231437Sluigi * rights to redistribute these changes. 29231437Sluigi */ 30231437Sluigi 31231437Sluigi#define _MCOUNT_DECL void mcount 32231437Sluigi 33231437Sluigi#define FUNCTION_ALIGNMENT 32 34231437Sluigi 35231437Sluigitypedef u_long fptrdiff_t; 36231437Sluigi 37231437Sluigi#define MCOUNT __asm (" \n\ 38231437Sluigi .globl _mcount \n\ 39231437Sluigi .proc _mcount \n\ 40231437Sluigi_mcount: \n\ 41231437Sluigi alloc loc0=ar.pfs,8,7,2,0 // space to save r8-r11,rp,b7 \n\ 42247880Sdelphij add sp=-8*16,sp // space to save f8-f15 \n\ 43231437Sluigi mov loc1=rp // caller's return address \n\ 44231437Sluigi mov loc2=b7 // our return back to caller \n\ 45231437Sluigi ;; \n\ 46231437Sluigi add r17=16,sp // leave 16 bytes for mcount \n\ 47231437Sluigi add r18=32,sp \n\ 48231437Sluigi ;; \n\ 49231437Sluigi mov loc3=r8 // structure return address \n\ 50231437Sluigi mov loc4=r9 // language specific \n\ 51231437Sluigi mov loc5=r10 // language specific \n\ 52231437Sluigi mov loc6=r11 // language specific \n\ 53231437Sluigi ;; \n\ 54231437Sluigi stf.spill [r17]=f8,32 // save float arguments \n\ 55231437Sluigi stf.spill [r18]=f9,32 \n\ 56231437Sluigi mov out0=rp // frompc \n\ 57231437Sluigi ;; \n\ 58231437Sluigi stf.spill [r17]=f10,32 \n\ 59231437Sluigi stf.spill [r18]=f11,32 \n\ 60231437Sluigi mov out1=b7 // selfpc \n\ 61231437Sluigi ;; \n\ 62231437Sluigi stf.spill [r17]=f12,32 \n\ 63231437Sluigi stf.spill [r18]=f13,32 \n\ 64231437Sluigi ;; \n\ 65231437Sluigi stf.spill [r17]=f14,32 \n\ 66231437Sluigi stf.spill [r18]=f15,32 \n\ 67231437Sluigi ;; \n\ 68231437Sluigi br.call.sptk.many rp=mcount \n\ 69231437Sluigi ;; \n\ 70231437Sluigi add r17=16,sp \n\ 71231437Sluigi add r18=32,sp \n\ 72231437Sluigi ;; \n\ 73231437Sluigi ldf.fill f8=[r17],32 \n\ 74231437Sluigi ldf.fill f9=[r18],32 \n\ 75231437Sluigi mov r8=loc3 // restore structure pointer \n\ 76231437Sluigi ;; \n\ 77231437Sluigi ldf.fill f10=[r17],32 // restore float arguments \n\ 78231437Sluigi ldf.fill f11=[r18],32 \n\ 79231437Sluigi mov r9=loc4 \n\ 80231437Sluigi ;; \n\ 81231437Sluigi ldf.fill f12=[r17],32 // etc. \n\ 82231437Sluigi ldf.fill f13=[r18],32 \n\ 83231437Sluigi mov r10=loc5 \n\ 84231437Sluigi ;; \n\ 85231437Sluigi ldf.fill f14=[r17],32 \n\ 86231437Sluigi ldf.fill f15=[r18],32 \n\ 87231437Sluigi mov r11=loc6 \n\ 88231437Sluigi ;; \n\ 89231437Sluigi mov b7=loc2 // clean up \n\ 90231437Sluigi mov rp=loc1 \n\ 91231437Sluigi mov ar.pfs=loc0 \n\ 92231437Sluigi ;; \n\ 93231437Sluigi alloc r14=ar.pfs,0,0,8,0 // drop our register frame \n\ 94231437Sluigi br.sptk.many b7 // back to caller \n\ 95231437Sluigi \n\ 96231437Sluigi .end _mcount"); 97231437Sluigi 98231437Sluigi#ifdef _KERNEL 99231437Sluigi/* 100231437Sluigi * The following two macros do splhigh and splx respectively. 101231437Sluigi */ 102231437Sluigi#define MCOUNT_ENTER(s) \n\ 103231437Sluigi _c = cpu_critical_enter() 104231437Sluigi#define MCOUNT_EXIT(s) \n\ 105231437Sluigi cpu_critical_exit(_c) 106231437Sluigi#define MCOUNT_DECL(s) critical_t c; 107231437Sluigi#ifdef GUPROF 108231437Sluigistruct gmonparam; 109231437Sluigi 110231437Sluigivoid nullfunc_loop_profiled(void); 111231437Sluigivoid nullfunc_profiled(void); 112231437Sluigivoid startguprof(struct gmonparam *p); 113231437Sluigivoid stopguprof(struct gmonparam *p); 114231437Sluigi#else 115231437Sluigi#define startguprof(p) 116231437Sluigi#define stopguprof(p) 117231437Sluigi#endif /* GUPROF */ 118231437Sluigi 119231437Sluigi#else /* !_KERNEL */ 120231437Sluigitypedef u_long uintfptr_t; 121231437Sluigi#endif 122231437Sluigi