profile.h revision 1.4
11.4Such/* $NetBSD: profile.h,v 1.4 2002/04/28 17:10:36 uch Exp $ */ 21.1Sitojun 31.2Stsubai/*- 41.2Stsubai * Copyright (c) 2000 Tsubai Masanari. All rights reserved. 51.1Sitojun * 61.1Sitojun * Redistribution and use in source and binary forms, with or without 71.1Sitojun * modification, are permitted provided that the following conditions 81.1Sitojun * are met: 91.1Sitojun * 1. Redistributions of source code must retain the above copyright 101.1Sitojun * notice, this list of conditions and the following disclaimer. 111.1Sitojun * 2. Redistributions in binary form must reproduce the above copyright 121.1Sitojun * notice, this list of conditions and the following disclaimer in the 131.1Sitojun * documentation and/or other materials provided with the distribution. 141.2Stsubai * 3. The name of the author may not be used to endorse or promote products 151.2Stsubai * derived from this software without specific prior written permission. 161.1Sitojun * 171.2Stsubai * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 181.2Stsubai * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 191.2Stsubai * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 201.2Stsubai * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 211.2Stsubai * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 221.2Stsubai * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 231.2Stsubai * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 241.2Stsubai * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 251.2Stsubai * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 261.2Stsubai * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 271.1Sitojun */ 281.1Sitojun 291.3Sthorpej#if defined(__ELF__) && defined(__NO_LEADING_UNDERSCORES__) 301.3Sthorpej#define _MCOUNT_DECL static void _mcount 311.3Sthorpej#else 321.4Such#define _MCOUNT_DECL static void mcount 331.3Sthorpej#endif 341.1Sitojun 351.4Such#define MCOUNT __asm (" \n\ 361.2Stsubai .text \n\ 371.2Stsubai .align 2 \n\ 381.2Stsubai .globl __mcount \n\ 391.2Stsubai__mcount: \n\ 401.2Stsubai mov.l r0,@-r15 \n\ 411.2Stsubai mov.l r4,@-r15 \n\ 421.2Stsubai mov.l r5,@-r15 \n\ 431.2Stsubai mov.l r6,@-r15 \n\ 441.2Stsubai mov.l r7,@-r15 \n\ 451.2Stsubai mov.l r14,@-r15 \n\ 461.2Stsubai sts.l pr,@-r15 \n\ 471.2Stsubai mov r15,r14 \n\ 481.2Stsubai \n\ 491.2Stsubai mov.l 1f,r1 ! _mcount \n\ 501.2Stsubai sts pr,r4 ! frompc \n\ 511.2Stsubai mov r0,r5 ! selfpc \n\ 521.2Stsubai jsr @r1 \n\ 531.2Stsubai nop \n\ 541.2Stsubai \n\ 551.2Stsubai mov r14,r15 \n\ 561.2Stsubai lds.l @r15+,pr \n\ 571.2Stsubai mov.l @r15+,r14 \n\ 581.2Stsubai mov.l @r15+,r7 \n\ 591.2Stsubai mov.l @r15+,r6 \n\ 601.2Stsubai mov.l @r15+,r5 \n\ 611.2Stsubai mov.l @r15+,r4 \n\ 621.2Stsubai mov.l @r15+,r0 \n\ 631.2Stsubai \n\ 641.2Stsubai jmp @r0 ! return \n\ 651.2Stsubai nop \n\ 661.2Stsubai \n\ 671.2Stsubai .align 2 \n\ 681.2Stsubai1: .long _mcount "); 691.1Sitojun 701.1Sitojun#ifdef _KERNEL 711.4Such#define MCOUNT_ENTER s = splhigh() 721.4Such#define MCOUNT_EXIT splx(s) 731.2Stsubai#endif 74