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