[BACK]Return to profile.h CVS log [TXT][DIR] Up to [local] / sys / arch / powerpc / include

Annotation of sys/arch/powerpc/include/profile.h, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: profile.h,v 1.6 2003/06/03 01:35:30 drahn Exp $ */
        !             2:
        !             3: /*
        !             4:  * Copyright (c) 1998 Dale Rahn.
        !             5:  * All rights reserved.
        !             6:  *
        !             7:  *
        !             8:  * Redistribution and use in source and binary forms, with or without
        !             9:  * modification, are permitted provided that the following conditions
        !            10:  * are met:
        !            11:  * 1. Redistributions of source code must retain the above copyright
        !            12:  *    notice, this list of conditions and the following disclaimer.
        !            13:  * 2. Redistributions in binary form must reproduce the above copyright
        !            14:  *    notice, this list of conditions and the following disclaimer in the
        !            15:  *    documentation and/or other materials provided with the distribution.
        !            16:  *
        !            17:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
        !            18:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
        !            19:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
        !            20:  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
        !            21:  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
        !            22:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
        !            23:  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
        !            24:  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
        !            25:  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
        !            26:  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        !            27:  */
        !            28: #define        MCOUNT \
        !            29:        __asm__(" \
        !            30:                .section \".text\" \n\
        !            31:                .align 2 \n\
        !            32:                .globl _mcount \n\
        !            33:                .type   _mcount,@function \n\
        !            34:        _mcount: \n\
        !            35:                lwz     11, 4(1) \n\
        !            36:                mflr    0 \n\
        !            37:                stw     0, 4(1) \n\
        !            38:                stwu    1, -48(1) \n\
        !            39:                stw     3, 8(1) \n\
        !            40:                stw     4, 12(1) \n\
        !            41:                stw     5, 16(1) \n\
        !            42:                stw     6, 20(1) \n\
        !            43:                stw     7, 24(1) \n\
        !            44:                stw     8, 28(1) \n\
        !            45:                stw     9, 32(1) \n\
        !            46:                stw     10,36(1) \n\
        !            47:                stw     11,40(1) \n\
        !            48:                mr      4, 0 \n\
        !            49:                mr      3, 11 \n\
        !            50:                bl __mcount \n\
        !            51:                lwz     3, 8(1) \n\
        !            52:                lwz     4, 12(1) \n\
        !            53:                lwz     5, 16(1) \n\
        !            54:                lwz     6, 20(1) \n\
        !            55:                lwz     7, 24(1) \n\
        !            56:                lwz     8, 28(1) \n\
        !            57:                lwz     9, 32(1) \n\
        !            58:                lwz     10,36(1) \n\
        !            59:                lwz     11,40(1) \n\
        !            60:                addi    1, 1, 48 \n\
        !            61:                lwz     0, 4(1) \n\
        !            62:                mtlr    11 \n\
        !            63:                stw     11, 4(1) \n\
        !            64:                mtctr   0 \n\
        !            65:                bctr \n\
        !            66:        .Lfe2: \n\
        !            67:                .size _mcount, .Lfe2-_mcount \n\
        !            68:        ");
        !            69: #define _MCOUNT_DECL static void __mcount
        !            70: #ifdef _KERNEL
        !            71: #define MCOUNT_ENTER                                           \
        !            72:        __asm volatile("mfmsr %0" : "=r"(s));                   \
        !            73:        if ((s & (PSL_IR | PSL_DR)) != (PSL_IR | PSL_DR))       \
        !            74:                return; /* prof not possible in real mode */    \
        !            75:        s &= ~PSL_POW;                                          \
        !            76:        __asm volatile("mtmsr %0" :: "r"(s & ~PSL_EE))
        !            77:
        !            78: #define        MCOUNT_EXIT                                             \
        !            79:        __asm volatile("mtmsr %0" :: "r"(s))
        !            80: #endif /* _KERNEL */

CVSweb