[BACK]Return to asm.h CVS log [TXT][DIR] Up to [local] / funnyos / libkern

Annotation of funnyos/libkern/asm.h, Revision 1.1

1.1     ! init        1: /*  $Id: asm.h,v 1.1.1.1 2007/10/12 08:40:43 init Exp $ */
        !             2: /*     $OpenBSD: asm.h,v 1.1 2004/02/01 05:09:49 drahn Exp $   */
        !             3: /*     $NetBSD: asm.h,v 1.4 2001/07/16 05:43:32 matt Exp $     */
        !             4:
        !             5: /*
        !             6:  * Copyright (c) 1990 The Regents of the University of California.
        !             7:  * All rights reserved.
        !             8:  *
        !             9:  * This code is derived from software contributed to Berkeley by
        !            10:  * William Jolitz.
        !            11:  *
        !            12:  * Redistribution and use in source and binary forms, with or without
        !            13:  * modification, are permitted provided that the following conditions
        !            14:  * are met:
        !            15:  * 1. Redistributions of source code must retain the above copyright
        !            16:  *    notice, this list of conditions and the following disclaimer.
        !            17:  * 2. Redistributions in binary form must reproduce the above copyright
        !            18:  *    notice, this list of conditions and the following disclaimer in the
        !            19:  *    documentation and/or other materials provided with the distribution.
        !            20:  * 3. Neither the name of the University nor the names of its contributors
        !            21:  *    may be used to endorse or promote products derived from this software
        !            22:  *    without specific prior written permission.
        !            23:  *
        !            24:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
        !            25:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        !            26:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        !            27:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
        !            28:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        !            29:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
        !            30:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            31:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        !            32:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
        !            33:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
        !            34:  * SUCH DAMAGE.
        !            35:  *
        !            36:  *     from: @(#)asm.h 5.5 (Berkeley) 5/7/91
        !            37:  */
        !            38:
        !            39: #ifndef _ARM32_ASM_H_
        !            40: #define _ARM32_ASM_H_
        !            41:
        !            42: #ifdef __ELF__
        !            43: # define _C_LABEL(x)   x
        !            44: #else
        !            45: # ifdef __STDC__
        !            46: #  define _C_LABEL(x)  _ ## x
        !            47: # else
        !            48: #  define _C_LABEL(x)  _/**/x
        !            49: # endif
        !            50: #endif
        !            51: #define        _ASM_LABEL(x)   x
        !            52:
        !            53: #ifdef __STDC__
        !            54: # define __CONCAT(x,y) x ## y
        !            55: # define __STRING(x)   #x
        !            56: #else
        !            57: # define __CONCAT(x,y) x/**/y
        !            58: # define __STRING(x)   "x"
        !            59: #endif
        !            60:
        !            61: #ifndef _ALIGN_TEXT
        !            62: # define _ALIGN_TEXT .align 0
        !            63: #endif
        !            64:
        !            65: /*
        !            66:  * gas/arm uses @ as a single comment character and thus cannot be used here
        !            67:  * Instead it recognised the # instead of an @ symbols in .type directives
        !            68:  * We define a couple of macros so that assembly code will not be dependant
        !            69:  * on one or the other.
        !            70:  */
        !            71: #define _ASM_TYPE_FUNCTION     #function
        !            72: #define _ASM_TYPE_OBJECT       #object
        !            73: #define _ENTRY(x) \
        !            74:        .text; _ALIGN_TEXT; .globl x; .type x,_ASM_TYPE_FUNCTION; x:
        !            75:
        !            76: #ifdef GPROF
        !            77: # ifdef __ELF__
        !            78: #  define _PROF_PROLOGUE       \
        !            79:        mov ip, lr; bl __mcount
        !            80: # else
        !            81: #  define _PROF_PROLOGUE       \
        !            82:        mov ip,lr; bl mcount
        !            83: # endif
        !            84: #else
        !            85: # define _PROF_PROLOGUE
        !            86: #endif
        !            87:
        !            88: #define        ENTRY(y)        _ENTRY(_C_LABEL(y)); _PROF_PROLOGUE
        !            89: #define        ENTRY_NP(y)     _ENTRY(_C_LABEL(y))
        !            90: #define        ASENTRY(y)      _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
        !            91: #define        ASENTRY_NP(y)   _ENTRY(_ASM_LABEL(y))
        !            92:
        !            93: #define        ASMSTR          .asciz
        !            94:
        !            95: #if defined(__ELF__) && defined(PIC)
        !            96: #ifdef __STDC__
        !            97: #define        PIC_SYM(x,y)    x ## ( ## y ## )
        !            98: #else
        !            99: #define        PIC_SYM(x,y)    x/**/(/**/y/**/)
        !           100: #endif
        !           101: #else
        !           102: #define        PIC_SYM(x,y)    x
        !           103: #endif
        !           104:
        !           105: #ifdef __ELF__
        !           106: #define RCSID(x)       .section ".ident"; .asciz x
        !           107: #else
        !           108: #define RCSID(x)       .text; .asciz x
        !           109: #endif
        !           110:
        !           111: #ifdef __ELF__
        !           112: #define        WEAK_ALIAS(alias,sym)                                           \
        !           113:        .weak alias;                                                    \
        !           114:        alias = sym
        !           115: #endif
        !           116:
        !           117: #ifdef __STDC__
        !           118: #define        WARN_REFERENCES(sym,msg)                                        \
        !           119:        .stabs msg ## ,30,0,0,0 ;                                       \
        !           120:        .stabs __STRING(_C_LABEL(sym)) ## ,1,0,0,0
        !           121: #elif defined(__ELF__)
        !           122: #define        WARN_REFERENCES(sym,msg)                                        \
        !           123:        .stabs msg,30,0,0,0 ;                                           \
        !           124:        .stabs __STRING(sym),1,0,0,0
        !           125: #else
        !           126: #define        WARN_REFERENCES(sym,msg)                                        \
        !           127:        .stabs msg,30,0,0,0 ;                                           \
        !           128:        .stabs __STRING(_/**/sym),1,0,0,0
        !           129: #endif /* __STDC__ */
        !           130:
        !           131: #endif /* !_ARM_ASM_H_ */

CVSweb