9815 Want basic AHCI enclosure services
[unleashed.git] / usr / src / uts / common / sys / elf_SPARC.h
blob976242e961d4c346972cfe42fe77128fe4400ff8
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 (c) 1984, 1986, 1987, 1988, 1989 AT&T
24 * All Rights Reserved
26 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
30 #ifndef _SYS_ELF_SPARC_H
31 #define _SYS_ELF_SPARC_H
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
37 #define EF_SPARC_32PLUS_MASK 0xffff00 /* bits indicating V8+ type */
38 #define EF_SPARC_32PLUS 0x000100 /* generic V8+ features */
39 #define EF_SPARC_EXT_MASK 0xffff00 /* bits for vendor extensions */
40 #define EF_SPARC_SUN_US1 0x000200 /* Sun UltraSPARC1 extensions */
41 #define EF_SPARC_HAL_R1 0x000400 /* HAL R1 extensions */
42 #define EF_SPARC_SUN_US3 0x000800 /* Sun UltraSPARC3 extensions */
44 #define EF_SPARCV9_MM 0x3 /* mask for memory model */
45 #define EF_SPARCV9_TSO 0x0 /* total store ordering */
46 #define EF_SPARCV9_PSO 0x1 /* partial store ordering */
47 #define EF_SPARCV9_RMO 0x2 /* relaxed memory ordering */
49 #define R_SPARC_NONE 0 /* relocation type */
50 #define R_SPARC_8 1
51 #define R_SPARC_16 2
52 #define R_SPARC_32 3
53 #define R_SPARC_DISP8 4
54 #define R_SPARC_DISP16 5
55 #define R_SPARC_DISP32 6
56 #define R_SPARC_WDISP30 7
57 #define R_SPARC_WDISP22 8
58 #define R_SPARC_HI22 9
59 #define R_SPARC_22 10
60 #define R_SPARC_13 11
61 #define R_SPARC_LO10 12
62 #define R_SPARC_GOT10 13
63 #define R_SPARC_GOT13 14
64 #define R_SPARC_GOT22 15
65 #define R_SPARC_PC10 16
66 #define R_SPARC_PC22 17
67 #define R_SPARC_WPLT30 18
68 #define R_SPARC_COPY 19
69 #define R_SPARC_GLOB_DAT 20
70 #define R_SPARC_JMP_SLOT 21
71 #define R_SPARC_RELATIVE 22
72 #define R_SPARC_UA32 23
73 #define R_SPARC_PLT32 24
74 #define R_SPARC_HIPLT22 25
75 #define R_SPARC_LOPLT10 26
76 #define R_SPARC_PCPLT32 27
77 #define R_SPARC_PCPLT22 28
78 #define R_SPARC_PCPLT10 29
79 #define R_SPARC_10 30
80 #define R_SPARC_11 31
81 #define R_SPARC_64 32
82 #define R_SPARC_OLO10 33
83 #define R_SPARC_HH22 34
84 #define R_SPARC_HM10 35
85 #define R_SPARC_LM22 36
86 #define R_SPARC_PC_HH22 37
87 #define R_SPARC_PC_HM10 38
88 #define R_SPARC_PC_LM22 39
89 #define R_SPARC_WDISP16 40
90 #define R_SPARC_WDISP19 41
91 #define R_SPARC_GLOB_JMP 42
92 #define R_SPARC_7 43
93 #define R_SPARC_5 44
94 #define R_SPARC_6 45
95 #define R_SPARC_DISP64 46
96 #define R_SPARC_PLT64 47
97 #define R_SPARC_HIX22 48
98 #define R_SPARC_LOX10 49
99 #define R_SPARC_H44 50
100 #define R_SPARC_M44 51
101 #define R_SPARC_L44 52
102 #define R_SPARC_REGISTER 53
103 #define R_SPARC_UA64 54
104 #define R_SPARC_UA16 55
105 #define R_SPARC_TLS_GD_HI22 56
106 #define R_SPARC_TLS_GD_LO10 57
107 #define R_SPARC_TLS_GD_ADD 58
108 #define R_SPARC_TLS_GD_CALL 59
109 #define R_SPARC_TLS_LDM_HI22 60
110 #define R_SPARC_TLS_LDM_LO10 61
111 #define R_SPARC_TLS_LDM_ADD 62
112 #define R_SPARC_TLS_LDM_CALL 63
113 #define R_SPARC_TLS_LDO_HIX22 64
114 #define R_SPARC_TLS_LDO_LOX10 65
115 #define R_SPARC_TLS_LDO_ADD 66
116 #define R_SPARC_TLS_IE_HI22 67
117 #define R_SPARC_TLS_IE_LO10 68
118 #define R_SPARC_TLS_IE_LD 69
119 #define R_SPARC_TLS_IE_LDX 70
120 #define R_SPARC_TLS_IE_ADD 71
121 #define R_SPARC_TLS_LE_HIX22 72
122 #define R_SPARC_TLS_LE_LOX10 73
123 #define R_SPARC_TLS_DTPMOD32 74
124 #define R_SPARC_TLS_DTPMOD64 75
125 #define R_SPARC_TLS_DTPOFF32 76
126 #define R_SPARC_TLS_DTPOFF64 77
127 #define R_SPARC_TLS_TPOFF32 78
128 #define R_SPARC_TLS_TPOFF64 79
129 #define R_SPARC_GOTDATA_HIX22 80
130 #define R_SPARC_GOTDATA_LOX10 81
131 #define R_SPARC_GOTDATA_OP_HIX22 82
132 #define R_SPARC_GOTDATA_OP_LOX10 83
133 #define R_SPARC_GOTDATA_OP 84
134 #define R_SPARC_H34 85
135 #define R_SPARC_SIZE32 86
136 #define R_SPARC_SIZE64 87
137 #define R_SPARC_NUM 88
140 * Relocation aliases
142 #define R_SPARC_L34 R_SPARC_L44 /* associated with R_SPARC_H34 */
143 /* same calc as R_SPARC_L44 */
145 #define ELF_SPARC_MAXPGSZ 0x10000 /* maximum page size */
146 #define ELF_SPARCV9_MAXPGSZ 0x100000
149 * Processor specific section types
151 #define SHT_SPARC_GOTDATA 0x70000000
153 #define SHF_ORDERED 0x40000000
154 #define SHF_EXCLUDE 0x80000000
156 #define SHN_BEFORE 0xff00
157 #define SHN_AFTER 0xff01
159 #define STT_SPARC_REGISTER 13 /* register symbol type */
161 #define DT_SPARC_REGISTER 0x70000001 /* identifies register */
162 /* symbols */
166 * Register symbol numbers - to be used in the st_value field
167 * of register symbols.
169 #define STO_SPARC_REGISTER_G1 0x1 /* register %g1 */
170 #define STO_SPARC_REGISTER_G2 0x2 /* register %g2 */
171 #define STO_SPARC_REGISTER_G3 0x3 /* register %g3 */
172 #define STO_SPARC_REGISTER_G4 0x4 /* register %g4 */
173 #define STO_SPARC_REGISTER_G5 0x5 /* register %g5 */
174 #define STO_SPARC_REGISTER_G6 0x6 /* register %g6 */
175 #define STO_SPARC_REGISTER_G7 0x7 /* register %g7 */
178 * There are consumers of this file that want to include elf defines for
179 * all architectures. This is a problem for the defines below, because
180 * while they are architecture specific they have common names. Hence to
181 * prevent attempts to redefine these variables we'll check if any of
182 * the other elf architecture header files have been included. If
183 * they have then we'll just stick with the existing definitions.
185 #if !defined(_SYS_ELF_MACH_COMMON)
186 #define _SYS_ELF_MACH_COMMON
189 * Plt and Got information; the first few .got and .plt entries are reserved
190 * PLT[0] jump to dynamic linker
191 * GOT[0] address of _DYNAMIC
193 #define M_PLT_INSSIZE 4 /* single plt instruction size */
194 #define M_PLT_XNumber 4 /* reserved no. of plt entries */
195 #define M_GOT_XDYNAMIC 0 /* got index for _DYNAMIC */
196 #define M_GOT_XNumber 1 /* reserved no. of got entries */
199 * ELF32 bit PLT constants
201 #define M32_WORD_ALIGN 4
202 #define M32_PLT_ENTSIZE 12 /* plt entry size in bytes */
203 #define M32_PLT_ALIGN M_WORD_ALIGN /* alignment of .plt section */
204 #define M32_GOT_ENTSIZE 4 /* got entry size in bytes */
205 #define M32_GOT_MAXSMALL 2048 /* maximum no. of small gots */
206 #define M32_PLT_RESERVSZ (M_PLT_XNumber * \
207 M32_PLT_ENTSIZE) /* first 4 plt's reserved */
210 * ELF64 bit PLT constants
212 #define M64_WORD_ALIGN 8
213 #define M64_PLT_ENTSIZE 32 /* plt entry size in bytes */
214 #define M64_PLT_ALIGN 256 /* alignment of .plt section */
215 #define M64_GOT_ENTSIZE 8 /* got entry size in bytes */
216 #define M64_GOT_MAXSMALL 1024 /* maximum no. of small gots */
217 #define M64_PLT_RESERVSZ (M_PLT_XNumber * \
218 M64_PLT_ENTSIZE) /* first 4 plt's reserved */
220 #define M64_PLT_NEARPLTS 0x8000 /* # of NEAR PLTS we can have */
221 #define M64_PLT_FENTSIZE 24 /* size of far plt is 6 instructions */
222 /* x 4bytes */
223 #define M64_PLT_PSIZE 8 /* size of PLTP pointer */
224 #define M64_PLT_FBLKCNTS 160 /* # of plts in far PLT blocks */
225 #define M64_PLT_FBLOCKSZ (M64_PLT_FBLKCNTS *\
226 M64_PLT_ENTSIZE) /* size of far PLT block */
230 * Make common alias for the 32/64 bit specific defines based on _ELF64
232 #ifdef _ELF64
233 /* architecture common defines */
234 #define M_WORD_ALIGN M64_WORD_ALIGN
235 #define M_PLT_ENTSIZE M64_PLT_ENTSIZE
236 #define M_PLT_ALIGN M64_PLT_ALIGN
237 #define M_PLT_RESERVSZ M64_PLT_RESERVSZ
238 #define M_GOT_ENTSIZE M64_GOT_ENTSIZE
239 /* sparc specific defines */
240 #define M_GOT_MAXSMALL M64_GOT_MAXSMALL
241 #else /* !_ELF64 */
242 /* architecture common defines */
243 #define M_WORD_ALIGN M32_WORD_ALIGN
244 #define M_PLT_ENTSIZE M32_PLT_ENTSIZE
245 #define M_PLT_ALIGN M32_PLT_ALIGN
246 #define M_PLT_RESERVSZ M32_PLT_RESERVSZ
247 #define M_GOT_ENTSIZE M32_GOT_ENTSIZE
248 /* sparc specific defines */
249 #define M_GOT_MAXSMALL M32_GOT_MAXSMALL
250 #endif /* !_ELF64 */
252 #endif /* !_SYS_ELF_MACH_COMMON */
254 #ifdef __cplusplus
256 #endif
258 #endif /* _SYS_ELF_SPARC_H */