1 /* $OpenBSD: asm.h,v 1.7 2002/09/15 09:01:59 deraadt Exp $ */ 2 /* $NetBSD: asm.h,v 1.1 1996/09/30 16:34:20 ws Exp $ */ 3 4 /* 5 * Copyright (C) 1995, 1996 Wolfgang Solfrank. 6 * Copyright (C) 1995, 1996 TooLs GmbH. 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 3. All advertising materials mentioning features or use of this software 18 * must display the following acknowledgement: 19 * This product includes software developed by TooLs GmbH. 20 * 4. The name of TooLs GmbH may not be used to endorse or promote products 21 * derived from this software without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR 24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 29 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 31 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 32 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 */ 34 35 #ifndef _POWERPC_ASM_H_ 36 #define _POWERPC_ASM_H_ 37 38 /* XXX */ 39 #define TARGET_ELF 40 41 #ifdef PIC 42 #define PIC_PROLOGUE XXX 43 #define PIC_EPILOGUE XXX 44 #ifdef __STDC__ 45 #define PIC_PLT(x) x ## @plt 46 #define PIC_GOT(x) XXX 47 #define PIC_GOTOFF(x) XXX 48 #else /* not __STDC__ */ 49 #define PIC_PLT(x) x/**/@plt 50 #define PIC_GOT(x) XXX 51 #define PIC_GOTOFF(x) XXX 52 #endif /* __STDC__ */ 53 #else 54 #define PIC_PROLOGUE 55 #define PIC_EPILOGUE 56 #define PIC_PLT(x) x 57 #define PIC_GOT(x) x 58 #define PIC_GOTOFF(x) x 59 #endif 60 61 #ifdef TARGET_AOUT 62 #ifdef __STDC__ 63 # define _C_LABEL(x) _ ## x 64 #else 65 # define _C_LABEL(x) _/**/x 66 #endif 67 #endif 68 69 #ifdef TARGET_ELF 70 # define _C_LABEL(x) x 71 #endif 72 #define _ASM_LABEL(x) x 73 74 #ifdef __STDC__ 75 # define _TMP_LABEL(x) .L_ ## x 76 #else 77 # define _TMP_LABEL(x) .L_/**/x 78 #endif 79 80 #define _ENTRY(x) \ 81 .text; .align 2; .globl x; .type x,@function; x: 82 83 #ifdef PROF 84 # define _PROF_PROLOGUE(y) \ 85 .section ".data"; \ 86 .align 2; \ 87 _TMP_LABEL(y):; \ 88 .long 0; \ 89 .section ".text"; \ 90 mflr 0; \ 91 addis 11, 11, _TMP_LABEL(y)@ha; \ 92 stw 0, 4(1); \ 93 addi 0, 11,_TMP_LABEL(y)@l; \ 94 bl _mcount; 95 #else 96 # define _PROF_PROLOGUE(y) 97 #endif 98 99 #define ENTRY(y) _ENTRY(_C_LABEL(y)); _PROF_PROLOGUE(y) 100 #define ASENTRY(y) _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE(y) 101 102 #define ASMSTR .asciz 103 104 #define RCSID(x) .text; .asciz x 105 106 #endif /* !_POWERPC_ASM_H_ */ 107