isa_defs.h
1 /*
2 * Copyright (c) 1993-1999 by Sun Microsystems, Inc.
3 * All rights reserved.
4 */
5
6 #ifndef _SYS_ISA_DEFS_H
7 #define _SYS_ISA_DEFS_H
8
9 #pragma ident "@(#)isa_defs.h 1.20 99/05/04 SMI"
10
11 /*
12 * This header file serves to group a set of well known defines and to
13 * set these for each instruction set architecture. These defines may
14 * be divided into two groups; characteristics of the processor and <__XML_XLINK_H__>
15 * implementation choices for Solaris on a processor.
16 *
17 * Processor Characteristics:
18 *
19 * _LITTLE_ENDIAN / _BIG_ENDIAN:
20 * The natural byte order of the processor. A pointer to an int points <iso/time_iso.h>
21 * to the least/most significant byte of that int.
22 *
23 * _STACK_GROWS_UPWARD / _STACK_GROWS_DOWNWARD:
24 * The processor specific direction of stack growth. A push onto the
25 * stack increases/decreases the stack pointer, so it stores data at
26 * successively higher/lower addresses. (Stackless machines ignored
27 * without regrets).
28 *
29 * _LONG_LONG_HTOL / _LONG_LONG_LTOH:
30 * A pointer to a long long points to the most/least significant long
31 * within that long long.
32 *
33 * _BIT_FIELDS_HTOL / _BIT_FIELDS_LTOH:
34 * The C compiler assigns bit fields from the high/low to the low/high end
35 * of an int (most to least significant vs. least to most significant).
36 *
37 * _IEEE_754:
38 * The processor (or supported implementations of the processor)
39 * supports the ieee-754 floating point standard. No other floating
40 * point standards are supported (or significant). Any other supported
41 * floating point formats are expected to be cased on the ISA processor
42 * symbol.
43 *
44 * _CHAR_IS_UNSIGNED / _CHAR_IS_SIGNED:
45 * The C Compiler implements objects of type `char' as `unsigned' or
46 * `signed' respectively. This is really an implementation choice of
47 * the compiler writer, but it is specified in the ABI and tends to
48 * be uniform across compilers for an instruction set architecture.
49 * Hence, it has the properties of a processor characteristic.
50 *
51 * _CHAR_ALIGNMENT / _SHORT_ALIGNMENT / _INT_ALIGNMENT / _LONG_ALIGNMENT /
52 * _LONG_LONG_ALIGNMENT / _DOUBLE_ALIGNMENT / _LONG_DOUBLE_ALIGNMENT /
53 * _POINTER_ALIGNMENT:
54 * The ABI defines alignment requirements of each of the primitive
55 * object types. Some, if not all, may be hardware requirements as
56 * well. The values are expressed in "byte-alignment" units.
57 *
58 * _MAX_ALIGNMENT:
59 * The most stringent alignment requirement as specified by the ABI.
60 * Equal to the maximum of all the above _XXX_ALIGNMENT values.
61 *
62 * _ALIGNMENT_REQUIRED:
63 * True or false (1 or 0) whether or not the hardware requires the ABI
64 * alignment.
65 *
66 *
67 * Implementation Choices:
68 *
69 * _ILP32 / _LP64:
70 * This specifies the compiler data type implementation as specified in
71 * the relevant ABI. The choice between these is strongly influenced
72 * by the underlying hardware, but is not absolutely tied to it.
73 * Currently only two data type models are supported:
74 *
75 * _ILP32:
76 * Int/Long/Pointer are 32 bits. This is the historical UNIX
77 * and Solaris implementation. Due to its historical standing,
78 * this is the default case.
79 *
80 * _LP64:
81 * Long/Pointer are 64 bits, Int is 32 bits. This is the chosen
82 * implementation for 64-bit ABIs such as SPARC V9.
83 * <time_impl.h>
84 * _I32LPx:
85 * A compilation environment where 'int' is 32-bit, and
86 * longs and pointers are simply the same size.
87 *
88 * In all cases, Char is 8 bits and Short is 16 bits.
89 *
90 * _SUNOS_VTOC_8 / _SUNOS_VTOC_16 / _SVR4_VTOC_16:
91 * This specifies the form of the disk VTOC (or label):
92 *
93 * _SUNOS_VTOC_8:
94 * This is a VTOC form which is upwardly compatible with the
95 * SunOS 4.x disk label and allows 8 partitions per disk.
96 *
97 * _SUNOS_VTOC_16: <_SIGVAL>
98 * In this format the incore vtoc image matches the ondisk
99 * version. It allows 16 slices per disk, and is not
100 * compatible with the SunOS 4.x disk label.
101 *
102 * Note that these are not the only two VTOC forms possible and
103 * additional forms may be added. One possible form would be the
104 * SVr4 VTOC form. The symbol for that is reserved now, although
105 * it is not implemented. <_SIGEVENT>
106 *
107 * _SVR4_VTOC_16:
108 * This VTOC form is compatible with the System V Release 4
109 * VTOC (as implemented on the SVr4 Intel and 3b ports) with
110 * 16 partitions per disk.
111 *
112 *
113 * _DMA_USES_PHYSADDR / _DMA_USES_VIRTADDR
114 * This describes the type of addresses used by system DMA:
115 *
116 * _DMA_USES_PHYSADDR:
117 * This type of DMA, used in the x86 implementation,
118 * requires physical addresses for DMA buffers. The 24-bit
119 * addresses used by some legacy boards is the source of the
120 * "low-memory" (<16MB) requirement for some devices using DMA.
121 *
122 * _DMA_USES_VIRTADDR:
123 * This method of DMA allows the use of virtual addresses for
124 * DMA transfers.
125 *
126 * _FIRMWARE_NEEDS_FDISK / _NO_FDISK_PRESENT
127 * This indicates the presence/absence of an fdisk table.
128 *
129 * _FIRMWARE_NEEDS_FDISK
130 * The fdisk table is required by system firmware. If present,
131 * it allows a disk to be subdivided into multiple fdisk
132 * partitions, each of which is equivalent to a separate,
133 * virtual disk. This enables the co-existence of multiple
134 * operating systems on a shared hard disk.
135 *
136 * _NO_FDISK_PRESENT <CLK_TCK>
137 * If the fdisk table is absent, it is assumed that the entire
138 * media is allocated for a single operating system.
139 *
140 * _CONSOLE_OUTPUT_VIA_FIRMWARE / _CONSOLE_OUTPUT_VIA_SOFTWARE
141 * This indicates whether framebuffer console output is done by
142 * firmware or software.
143 *
144 * _CONSOLE_OUTPUT_VIA_FIRMWARE
145 * Framebuffer console output is done via prom_* calls.
146 *
147 * _CONSOLE_OUTPUT_VIA_SOFTWARE
148 * Framebuffer console output is done via the software
149 * terminal emulator.
150 * _DONT_USE_1275_GENERIC_NAMES
151 * Controls whether or not device tree node names should
152 * comply with the IEEE 1275 "Generic Names" Recommended
153 * Practice. With _DONT_USE_GENERIC_NAMES, device-specific
154 * names identifying the particular device will be used.
155 */
156
157 #ifdef __cplusplus
158 extern "C" {
159 #endif
160
161
162 /*
163 * The following set of definitions characterize the Solaris on Intel systems.
164 *
165 * The feature test macro __ia64 is generic for all processors implementing
166 * the Intel ia64 instruction set. Specifically, this includes Merced.
167 */
168 #if defined(__ia64)
169
170 /*
171 * Define the appropriate "processor characteristics"
172 */
173 #define _LITTLE_ENDIAN
174 #define _STACK_GROWS_DOWNWARD /* sort of */
175 #define _LONG_LONG_LTOH
176 #define _BIT_FIELDS_LTOH
177 #define _IEEE_754
178 #define _CHAR_IS_SIGNED
179 #define _CHAR_ALIGNMENT 1
180 #define _SHORT_ALIGNMENT 2
181 #define _INT_ALIGNMENT 4
182 #define _LONG_ALIGNMENT 8
183 #define _LONG_LONG_ALIGNMENT 8
184 #define _DOUBLE_ALIGNMENT 8
185 #define _LONG_DOUBLE_ALIGNMENT 16
186 #define _POINTER_ALIGNMENT 8
187 #define _MAX_ALIGNMENT 16
188 #define _ALIGNMENT_REQUIRED 1
189
190 /*
191 * Define the appropriate "implementation choices".
192 */
193 #define _LP64
194 #if !defined(_I32LPx) && defined(_KERNEL)
195 #define _I32LPx
196 #endif
197 #define _MULTI_DATAMODEL
198 #define _SUNOS_VTOC_16
199 #define _DMA_USES_PHYSADDR
200 #define _FIRMWARE_NEEDS_FDISK
201 #define _CONSOLE_OUTPUT_VIA_SOFTWARE
202
203 /*
204 * The feature test macro __i386 is generic for all processors implementing
205 * the Intel 386 instruction set or a superset of it. Specifically, this
206 * includes all members of the 386, 486, and Pentium family of processors.
207 */
208 #elif defined(__i386) || defined(i386)
209
210 /*
211 * Make sure that the ANSI-C "politically correct" symbol is defined.
212 */
213 #if !defined(__i386)
214 #define __i386
215 #endif
216
217 /*
218 * Define the appropriate "processor characteristics"
219 */
220 #define _LITTLE_ENDIAN
221 #define _STACK_GROWS_DOWNWARD
222 #define _LONG_LONG_LTOH
223 #define _BIT_FIELDS_LTOH
224 #define _IEEE_754
225 #define _CHAR_IS_SIGNED
226 #define _CHAR_ALIGNMENT 1
227 #define _SHORT_ALIGNMENT 2
228 #define _INT_ALIGNMENT 4
229 #define _LONG_ALIGNMENT 4
230 #define _LONG_LONG_ALIGNMENT 4
231 #define _DOUBLE_ALIGNMENT 4
232 #define _LONG_DOUBLE_ALIGNMENT 4
233 #define _POINTER_ALIGNMENT 4
234 #define _MAX_ALIGNMENT 4
235 #define _ALIGNMENT_REQUIRED 0
236 #define _DONT_USE_1275_GENERIC_NAMES
237 /*
238 * Define the appropriate "implementation choices".
239 */
240 #define _ILP32
241 #if !defined(_I32LPx) && defined(_KERNEL)
242 #define _I32LPx
243 #endif
244 #define _SUNOS_VTOC_16
245 #define _DMA_USES_PHYSADDR
246 #define _FIRMWARE_NEEDS_FDISK
247 #define _CONSOLE_OUTPUT_VIA_SOFTWARE
248
249 /*
250 * The following set of definitions characterize the Solaris on SPARC systems.
251 *
252 * The symbol __sparc indicates any of the SPARC family of processor
253 * architectures. This includes SPARC V7, SPARC V8 and SPARC V9.
254 *
255 * The symbol sparc is a deprecated historical synonym for __sparc.
256 *
257 * The symbol __sparcv8 indicates the 32-bit SPARC V8 architecture as defined
258 * by Version 8 of the SPARC Architecture Manual. (SPARC V7 is close enough
259 * to SPARC V8 for the former to be subsumed into the latter definition.)
260 *
261 * The symbol __sparcv9 indicates the 64-bit SPARC V9 architecture as defined
262 * by Version 9 of the SPARC Architecture Manual.
263 *
264 * The symbols __sparcv8 and __sparcv9 are mutually exclusive, and are only
265 * relevant when the symbol __sparc is defined.
266 */
267 #elif defined(__sparc) || defined(sparc)
268
269 /*
270 * Make sure that the ANSI-C "politically correct" symbol is defined.
271 */
272 #if !defined(__sparc)
273 #define __sparc
274 #endif
275
276 /*
277 * You can be 32-bit or 64-bit, but not both at the same time.
278 */
279 #if defined(__sparcv8) && defined(__sparcv9)
280 #error "SPARC Versions 8 and 9 are mutually exclusive choices"
281 #endif
282
283 /*
284 * Existing compilers do not set __sparcv8. Years will transpire before
285 * the compilers can be depended on to set the feature test macro. In
286 * the interim, we'll set it here on the basis of historical behaviour;
287 * if you haven't asked for SPARC V9, then you must've meant SPARC V8.
288 */
289 #if !defined(__sparcv9) && !defined(__sparcv8)
290 #define __sparcv8
291 #endif
292
293 /*
294 * Define the appropriate "processor characteristics" shared between
295 * all Solaris on SPARC systems.
296 */
297 #define _BIG_ENDIAN
298 #define _STACK_GROWS_DOWNWARD
299 #define _LONG_LONG_HTOL
300 #define _BIT_FIELDS_HTOL
301 #define _IEEE_754
302 #define _CHAR_IS_SIGNED
303 #define _CHAR_ALIGNMENT 1
304 #define _SHORT_ALIGNMENT 2
305 #define _INT_ALIGNMENT 4
306 #define _LONG_LONG_ALIGNMENT 8
307 #define _DOUBLE_ALIGNMENT 8
308 #define _ALIGNMENT_REQUIRED 1
309
310 /*
311 * Define the appropriate "implementation choices" shared between versions.
312 */
313 #define _SUNOS_VTOC_8
314 #define _DMA_USES_VIRTADDR
315 #define _NO_FDISK_PRESENT
316 #define _CONSOLE_OUTPUT_VIA_FIRMWARE
317
318 /*
319 * The following set of definitions characterize the implementation of
320 * 32-bit Solaris on SPARC V8 systems.
321 */
322 #if defined(__sparcv8)
323
324 /*
325 * Define the appropriate "processor characteristics"
326 */
327 #define _LONG_ALIGNMENT 4
328 #define _LONG_DOUBLE_ALIGNMENT 8
329 #define _POINTER_ALIGNMENT 4
330 #define _MAX_ALIGNMENT 8
331
332 /*
333 * Define the appropriate "implementation choices"
334 */
335 #define _ILP32
336
337 #if !defined(_I32LPx) && defined(_KERNEL)
338 #define _I32LPx
339 #endif
340
341 /*
342 * The following set of definitions characterize the implementation of
343 * 64-bit Solaris on SPARC V9 systems.
344 */
345 #elif defined(__sparcv9)
346
347 /*
348 * Define the appropriate "processor characteristics"
349 */
350 #define _LONG_ALIGNMENT 8
351 #define _LONG_DOUBLE_ALIGNMENT 16
352 #define _POINTER_ALIGNMENT 8
353 #define _MAX_ALIGNMENT 16
354
355 /*
356 * Define the appropriate "implementation choices"
357 */
358 #define _LP64
359 #if !defined(_I32LPx)
360 #define _I32LPx
361 #endif
362 #define _MULTI_DATAMODEL
363
364 #else
365 #error "unknown SPARC version"
366 #endif
367
368 /*
369 * #error is strictly ansi-C, but works as well as anything for K&R systems.
370 */
371 #else
372 #error "ISA not supported"
373 #endif
374
375 #if defined(_ILP32) && defined(_LP64)
376 #error "Both _ILP32 and _LP64 are defined"
377 #endif
378
379 #ifdef __cplusplus
380 }
381 #endif
382
383 #endif /* _SYS_ISA_DEFS_H */