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