1*9906ead4Smatt /* $NetBSD: profile.h,v 1.12 2008/08/29 18:25:02 matt Exp $ */ 24fb1817eSragge /* 3a412d480Sragge * Copyright (c) 1992 The Regents of the University of California. 44fb1817eSragge * All rights reserved. 54fb1817eSragge * 64fb1817eSragge * Redistribution and use in source and binary forms, with or without 74fb1817eSragge * modification, are permitted provided that the following conditions 84fb1817eSragge * are met: 94fb1817eSragge * 1. Redistributions of source code must retain the above copyright 104fb1817eSragge * notice, this list of conditions and the following disclaimer. 114fb1817eSragge * 2. Redistributions in binary form must reproduce the above copyright 124fb1817eSragge * notice, this list of conditions and the following disclaimer in the 134fb1817eSragge * documentation and/or other materials provided with the distribution. 14aad01611Sagc * 3. Neither the name of the University nor the names of its contributors 15a412d480Sragge * may be used to endorse or promote products derived from this software 16a412d480Sragge * without specific prior written permission. 174fb1817eSragge * 18a412d480Sragge * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19a412d480Sragge * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20a412d480Sragge * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21a412d480Sragge * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22a412d480Sragge * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23a412d480Sragge * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24a412d480Sragge * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25a412d480Sragge * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26a412d480Sragge * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27a412d480Sragge * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28a412d480Sragge * SUCH DAMAGE. 29a412d480Sragge * 30a412d480Sragge * @(#)profile.h 7.1 (Berkeley) 7/16/92 314fb1817eSragge */ 324fb1817eSragge 33d9c6db08Sragge /* 34d9c6db08Sragge * _mcount can't be declared static, gcc will optimize it away then. 35d9c6db08Sragge */ 36d9c6db08Sragge #define _MCOUNT_DECL void _mcount 37c3624951Sragge 38d9c6db08Sragge /* 39d9c6db08Sragge * Note here: the second argument to __mcount() is pc when mcount 40d9c6db08Sragge * was called. Because it's already on the stack we only have to 41d9c6db08Sragge * push previous pc _and_ tell calls that it is only one argument 42d9c6db08Sragge * to __mcount, so that our return address won't get popped from stack. 43d9c6db08Sragge */ 445ccb0f3eSmatt #define MCOUNT \ 4550a256a3Sperry __asm(".text; .globl __mcount; __mcount: pushl 16(%fp); calls $1,_mcount; rsb"); 46c3624951Sragge 478aa6c376Sjtc #ifdef _KERNEL 48c3624951Sragge /* 49c3624951Sragge * Note that we assume splhigh() and splx() cannot call mcount() 50c3624951Sragge * recursively. 51c3624951Sragge */ 52c3624951Sragge #define MCOUNT_ENTER s = splhigh() 53c3624951Sragge #define MCOUNT_EXIT splx(s) 548aa6c376Sjtc #endif /* _KERNEL */ 55