4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _SYS_ASM_LINKAGE_H
28 #define _SYS_ASM_LINKAGE_H
32 #include <sys/stack.h>
39 #ifdef _ASM /* The remainder of this file is only for assembly files */
42 * C pointers are different sizes between V8 and V9.
43 * These constants can be used to compute offsets into pointer arrays.
52 #define CPTRSIZE (1<<CPTRSHIFT)
53 #define CLONGSIZE (1<<CLONGSHIFT)
54 #define CPTRMASK (CPTRSIZE - 1)
55 #define CLONGMASK (CLONGSIZE - 1)
58 * Symbolic section definitions.
60 #define RODATA ".rodata"
63 * profiling causes defintions of the MCOUNT and RTMCOUNT
64 * particular to the type
68 #define MCOUNT_SIZE (4*4) /* 4 instructions */
70 save %sp, -SA(MINFRAME), %sp; \
79 #if defined(__sparcv9)
81 #define MCOUNT_SIZE (9*4) /* 9 instructions */
83 save %sp, -SA(MINFRAME), %sp; \
85 sethi %hh(.L_/**/x/**/1), %o0; \
87 sethi %lm(.L_/**/x/**/1), %o1; \
89 or %o0, %hm(.L_/**/x/**/1), %o0; \
91 or %o1, %lo(.L_/**/x/**/1), %o1; \
97 .common .L_/**/x/**/1, 8, 8
101 #define MCOUNT_SIZE (5*4) /* 5 instructions */
103 save %sp, -SA(MINFRAME), %sp; \
105 sethi %hi(.L_/**/x/**/1), %o0; \
108 or %o0, %lo(.L_/**/x/**/1), %o0; \
111 .common .L_/**/x/**/1, 4, 4
113 #endif /* __sparcv9 */
118 * if we are not profiling, MCOUNT should be defined to nothing
120 #if !defined(PROF) && !defined(GPROF)
121 #define MCOUNT_SIZE 0 /* no instructions inserted */
123 #endif /* !defined(PROF) && !defined(GPROF) */
125 #define RTMCOUNT(x) MCOUNT(x)
128 * Macro to define weak symbol aliases. These are similar to the ANSI-C
129 * #pragma weak name = _name
130 * except a compiler can determine type. The assembler must be told. Hence,
131 * the second parameter must be the type of the symbol (i.e.: function,...)
133 #define ANSI_PRAGMA_WEAK(sym, stype) \
140 * Like ANSI_PRAGMA_WEAK(), but for unrelated names, as in:
141 * #pragma weak sym1 = sym2
143 #define ANSI_PRAGMA_WEAK2(sym1, sym2, stype) \
145 .type sym1, #stype; \
149 * ENTRY provides the standard procedure entry code and an easy way to
150 * insert the calls to mcount for profiling. ENTRY_NP is identical, but
151 * never calls mcount.
157 .type x, #function; \
160 #define ENTRY_SIZE MCOUNT_SIZE
162 #define ENTRY_NP(x) \
166 .type x, #function; \
173 .type x, #function; \
177 * ENTRY2 is identical to ENTRY but provides two labels for the entry point.
179 #define ENTRY2(x, y) \
183 .type x, #function; \
184 .type y, #function; \
189 #define ENTRY_NP2(x, y) \
193 .type x, #function; \
194 .type y, #function; \
201 * ALTENTRY provides for additional entry points.
203 #define ALTENTRY(x) \
205 .type x, #function; \
209 * DGDEF and DGDEF2 provide global data declarations.
211 * DGDEF provides a word aligned word of storage.
213 * DGDEF2 allocates "sz" bytes of storage with **NO** alignment. This
214 * implies this macro is best used for byte arrays.
216 * DGDEF3 allocates "sz" bytes of storage with "algn" alignment.
218 #define DGDEF2(name, sz) \
221 .type name, #object; \
225 #define DGDEF3(name, sz, algn) \
229 .type name, #object; \
233 #define DGDEF(name) DGDEF3(name, 4, 4)
236 * SET_SIZE trails a function and set the size for the ELF symbol table.
238 #define SET_SIZE(x) \
247 #endif /* _SYS_ASM_LINKAGE_H */