Fix O_APPEND for Linux 3.15 and older kernels
[zfs.git] / module / icp / include / sys / ia32 / asm_linkage.h
blob71588cb5ce5f0d0b5afc1405e4db5ba4060ed10b
1 /*
2 * CDDL HEADER START
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]
19 * CDDL HEADER END
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>
31 #include <sys/trap.h>
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
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
51 #define D16 data16;
52 #define A16 addr16;
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)
61 #else
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)
74 #endif
77 * C pointers are different sizes between i386 and amd64.
78 * These constants can be used to compute offsets into pointer arrays.
80 #if defined(__amd64)
81 #define CLONGSHIFT 3
82 #define CLONGSIZE 8
83 #define CLONGMASK 7
84 #elif defined(__i386)
85 #define CLONGSHIFT 2
86 #define CLONGSIZE 4
87 #define CLONGMASK 3
88 #endif
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"
99 #endif
101 #if CPTRMASK != (CPTRSIZE - 1) || CLONGMASK != (CLONGSIZE - 1)
102 #error "inconsistent mask constants"
103 #endif
105 #define ASM_ENTRY_ALIGN 16
108 * SSE register alignment and save areas
111 #define XMM_SIZE 16
112 #define XMM_ALIGN 16
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.
119 #define ENTRY(x) \
120 .text; \
121 .align ASM_ENTRY_ALIGN; \
122 .globl x; \
123 .type x, @function; \
124 x: MCOUNT(x)
126 #define ENTRY_NP(x) \
127 .text; \
128 .align ASM_ENTRY_ALIGN; \
129 .globl x; \
130 .type x, @function; \
134 * ENTRY2 is identical to ENTRY but provides two labels for the entry point.
136 #define ENTRY2(x, y) \
137 .text; \
138 .align ASM_ENTRY_ALIGN; \
139 .globl x, y; \
140 .type x, @function; \
141 .type y, @function; \
142 x:; \
143 y: MCOUNT(x)
145 #define ENTRY_NP2(x, y) \
146 .text; \
147 .align ASM_ENTRY_ALIGN; \
148 .globl x, y; \
149 .type x, @function; \
150 .type y, @function; \
151 x:; \
156 * SET_SIZE trails a function and set the size for the ELF symbol table.
158 #define SET_SIZE(x) \
159 .size x, [.-x]
161 #endif /* _ASM */
163 #ifdef __cplusplus
165 #endif
167 #endif /* _IA32_SYS_ASM_LINKAGE_H */