1 /* $NetBSD: asm.h,v 1.8 2007/11/12 12:58:11 skrll Exp $ */ 2 3 /* $OpenBSD: asm.h,v 1.12 2001/03/29 02:15:57 mickey Exp $ */ 4 5 /* 6 * Copyright (c) 1990,1991,1994 The University of Utah and 7 * the Computer Systems Laboratory (CSL). All rights reserved. 8 * 9 * Permission to use, copy, modify and distribute this software is hereby 10 * granted provided that (1) source code retains these copyright, permission, 11 * and disclaimer notices, and (2) redistributions including binaries 12 * reproduce the notices in supporting documentation, and (3) all advertising 13 * materials mentioning features or use of this software display the following 14 * acknowledgement: ``This product includes software developed by the 15 * Computer Systems Laboratory at the University of Utah.'' 16 * 17 * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS 18 * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF 19 * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 20 * 21 * CSL requests users of this software to return to csl-dist@cs.utah.edu any 22 * improvements that they make and grant CSL redistribution rights. 23 * 24 * Utah $Hdr: asm.h 1.8 94/12/14$ 25 */ 26 27 #ifndef _HPPA_ASM_H_ 28 #define _HPPA_ASM_H_ 29 30 #include <machine/frame.h> 31 /* 32 * hppa assembler definitions 33 */ 34 35 #ifdef __STDC__ 36 #define __CONCAT(a,b) a ## b 37 #else 38 #define __CONCAT(a,b) a/**/b 39 #endif 40 41 #define LEAF_ENTRY_NOPROFILE(x) !\ 42 ! .text ! .align 4 !\ 43 .export x, entry ! .label x ! .proc !\ 44 .callinfo frame=0, no_calls, save_rp !\ 45 .entry 46 47 #define ENTRY_NOPROFILE(x,n) !\ 48 ! .text ! .align 4 !\ 49 .export x, entry ! .label x ! .proc !\ 50 .callinfo frame=n, calls, save_rp, save_sp !\ 51 .entry 52 53 #ifdef GPROF 54 55 #define _PROF_PROLOGUE !\ 56 1: !\ 57 stw %rp, HPPA_FRAME_CRP(%sp) !\ 58 stw %arg0, HPPA_FRAME_ARG(0)(%sp) !\ 59 stw %arg1, HPPA_FRAME_ARG(1)(%sp) !\ 60 stw %arg2, HPPA_FRAME_ARG(2)(%sp) !\ 61 stw %arg3, HPPA_FRAME_ARG(3)(%sp) !\ 62 ldo HPPA_FRAME_SIZE(%sp), %sp !\ 63 copy %rp, %arg0 !\ 64 bl 2f, %arg1 !\ 65 depi 0, 31, 2, %arg1 !\ 66 2: !\ 67 bl _mcount, %rp !\ 68 ldo 1b - 2b(%arg1), %arg1 !\ 69 ldo -HPPA_FRAME_SIZE(%sp), %sp !\ 70 ldw HPPA_FRAME_ARG(3)(%sp), %arg3 !\ 71 ldw HPPA_FRAME_ARG(2)(%sp), %arg2 !\ 72 ldw HPPA_FRAME_ARG(1)(%sp), %arg1 !\ 73 ldw HPPA_FRAME_ARG(0)(%sp), %arg0 !\ 74 ldw HPPA_FRAME_CRP(%sp), %rp !\ 75 76 #define LEAF_ENTRY(x) !\ 77 ENTRY_NOPROFILE(x,HPPA_FRAME_SIZE) !\ 78 _PROF_PROLOGUE 79 80 #else /* GPROF */ 81 82 #define _PROF_PROLOGUE 83 84 #define LEAF_ENTRY(x) !\ 85 LEAF_ENTRY_NOPROFILE(x) 86 87 #endif /* GPROF */ 88 89 #define ENTRY(x,n) !\ 90 ENTRY_NOPROFILE(x,n) !\ 91 _PROF_PROLOGUE 92 93 #define ALTENTRY(x) ! .export x, entry ! .label x 94 #define EXIT(x) ! .exit ! .procend ! .size x, .-x 95 96 #define RCSID(x) .text !\ 97 .asciz x !\ 98 .align 4 99 100 #define WEAK_ALIAS(alias,sym) \ 101 .weak alias ! \ 102 alias = sym 103 104 /* 105 * STRONG_ALIAS: create a strong alias. 106 */ 107 #define STRONG_ALIAS(alias,sym) \ 108 .globl alias ! \ 109 alias = sym 110 111 #define CALL(func,tmp) !\ 112 ldil L%func, tmp !\ 113 ldo R%func(tmp), tmp !\ 114 .call !\ 115 blr %r0, %rp !\ 116 bv,n %r0(tmp) !\ 117 nop 118 119 #ifdef PIC 120 #define PIC_CALL(func) !\ 121 addil LT%func, %r19 !\ 122 ldw RT%func(%r1), %r1 !\ 123 .call !\ 124 blr %r0, %rp !\ 125 bv,n %r0(%r1) !\ 126 nop 127 #else 128 #define PIC_CALL(func) !\ 129 CALL(func,%r1) 130 #endif 131 132 #ifdef __STDC__ 133 #define WARN_REFERENCES(sym,msg) \ 134 .stabs msg ## ,30,0,0,0 ; \ 135 .stabs __STRING(sym) ## ,1,0,0,0 136 #else 137 #define WARN_REFERENCES(sym,msg) \ 138 .stabs msg,30,0,0,0 ; \ 139 .stabs __STRING(sym),1,0,0,0 140 #endif 141 142 #define BSS(n,s) ! .data ! .label n ! .comm s 143 #define SZREG 4 144 145 #endif /* _HPPA_ASM_H_ */ 146