xref: /freebsd/sys/powerpc/include/asm.h (revision 0b381bf1fd8fbb2df974c318d58643ecfeec44b0)
1 /* $FreeBSD$ */
2 
3 /*
4  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
5  * Copyright (C) 1995, 1996 TooLs GmbH.
6  * All rights reserved.
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  * 3. All advertising materials mentioning features or use of this software
17  *    must display the following acknowledgement:
18  *	This product includes software developed by TooLs GmbH.
19  * 4. The name of TooLs GmbH may not be used to endorse or promote products
20  *    derived from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25  * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  *
33  *	$NetBSD: asm.h,v 1.6.18.1 2000/07/25 08:37:14 kleink Exp $
34  */
35 
36 #ifndef _MACHINE_ASM_H_
37 #define	_MACHINE_ASM_H_
38 
39 #ifdef PIC
40 #define	PIC_PROLOGUE	XXX
41 #define	PIC_EPILOGUE	XXX
42 #define	PIC_PLT(x)	x@plt
43 #ifdef	__STDC__
44 #define	PIC_GOT(x)	XXX
45 #define	PIC_GOTOFF(x)	XXX
46 #else	/* not __STDC__ */
47 #define	PIC_GOT(x)	XXX
48 #define	PIC_GOTOFF(x)	XXX
49 #endif	/* __STDC__ */
50 #else
51 #define	PIC_PROLOGUE
52 #define	PIC_EPILOGUE
53 #define	PIC_PLT(x)	x
54 #define PIC_GOT(x)	x
55 #define	PIC_GOTOFF(x)	x
56 #endif
57 
58 #define	_C_LABEL(x)	x
59 #define	_ASM_LABEL(x)	x
60 
61 #define	_GLOBAL(x) \
62 	.data; .align 2; .globl x; x:
63 
64 #define	_ENTRY(x) \
65 	.text; .align 2; .globl x; .type x,@function; x:
66 
67 #ifdef GPROF
68 # define	_PROF_PROLOGUE	mflr 0; stw 0,4(1); bl _mcount
69 #else
70 # define	_PROF_PROLOGUE
71 #endif
72 
73 #define	ENTRY(y)	_ENTRY(_C_LABEL(y)); _PROF_PROLOGUE
74 #define	ASENTRY(y)	_ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
75 #define	GLOBAL(y)	_GLOBAL(_C_LABEL(y))
76 
77 #define	ASMSTR		.asciz
78 
79 #define	RCSID(x)	.text; .asciz x
80 
81 #ifdef __ELF__
82 #define	WEAK_ALIAS(alias,sym)						\
83 	.weak alias;							\
84 	alias = sym
85 #endif
86 
87 #ifdef __STDC__
88 #define	WARN_REFERENCES(_sym,_msg)				\
89 	.section .gnu.warning. ## _sym ; .ascii _msg ; .text
90 #else
91 #define	WARN_REFERENCES(_sym,_msg)				\
92 	.section .gnu.warning./**/_sym ; .ascii _msg ; .text
93 #endif /* __STDC__ */
94 
95 #endif /* !_MACHINE_ASM_H_ */
96