4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _IA32_SYS_ASM_LINKAGE_H
28 #define _IA32_SYS_ASM_LINKAGE_H
30 #include <sys/stack.h>
37 #ifdef _ASM /* The remainder of this file is only for assembly files */
40 * make annoying differences in assembler syntax go away
44 * D16 and A16 are used to insert instructions prefixes; the
45 * macros help the assembler code be slightly more portable.
47 #if !defined(__GNUC_AS__)
49 * /usr/ccs/bin/as prefixes are parsed as separate instructions
55 * (There are some weird constructs in constant expressions)
57 #define _CONST(const) [const]
58 #define _BITNOT(const) -1!_CONST(const)
59 #define _MUL(a, b) _CONST(a \* b)
63 * Why not use the 'data16' and 'addr16' prefixes .. well, the
64 * assembler doesn't quite believe in real mode, and thus argues with
65 * us about what we're trying to do.
67 #define D16 .byte 0x66;
68 #define A16 .byte 0x67;
70 #define _CONST(const) (const)
71 #define _BITNOT(const) ~_CONST(const)
72 #define _MUL(a, b) _CONST(a * b)
77 * C pointers are different sizes between i386 and amd64.
78 * These constants can be used to compute offsets into pointer arrays.
91 * Since we know we're either ILP32 or LP64 ..
93 #define CPTRSHIFT CLONGSHIFT
94 #define CPTRSIZE CLONGSIZE
95 #define CPTRMASK CLONGMASK
97 #if CPTRSIZE != (1 << CPTRSHIFT) || CLONGSIZE != (1 << CLONGSHIFT)
98 #error "inconsistent shift constants"
101 #if CPTRMASK != (CPTRSIZE - 1) || CLONGMASK != (CLONGSIZE - 1)
102 #error "inconsistent mask constants"
105 #define ASM_ENTRY_ALIGN 16
108 * SSE register alignment and save areas
115 * ENTRY provides the standard procedure entry code and an easy way to
116 * insert the calls to mcount for profiling. ENTRY_NP is identical, but
117 * never calls mcount.
121 .align ASM_ENTRY_ALIGN; \
123 .type x, @function; \
126 #define ENTRY_NP(x) \
128 .align ASM_ENTRY_ALIGN; \
130 .type x, @function; \
134 * ENTRY2 is identical to ENTRY but provides two labels for the entry point.
136 #define ENTRY2(x, y) \
138 .align ASM_ENTRY_ALIGN; \
140 .type x, @function; \
141 .type y, @function; \
145 #define ENTRY_NP2(x, y) \
147 .align ASM_ENTRY_ALIGN; \
149 .type x, @function; \
150 .type y, @function; \
156 * SET_SIZE trails a function and set the size for the ELF symbol table.
158 #define SET_SIZE(x) \
167 #endif /* _IA32_SYS_ASM_LINKAGE_H */