1 /*
2  * CDDL HEADER START
3  *
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.
7  *
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.
12  *
13  *
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]
19  *
20  * CDDL HEADER END
21  */
22 
23 /*
24  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
25  * Use is subject to license terms.
26  */
27 
28 #ifndef	_SYS_ISA_DEFS_H
29 #define	_SYS_ISA_DEFS_H
30 #include <sys/endian.h>
31 
32 /*
33  * This header file serves to group a set of well known defines and to
34  * set these for each instruction set architecture.  These defines may
35  * be divided into two groups;  characteristics of the processor and
36  * implementation choices for Solaris on a processor.
37  *
38  * Processor Characteristics:
39  *
40  * _LITTLE_ENDIAN / _BIG_ENDIAN:
41  *	The natural byte order of the processor.  A pointer to an int points
42  *	to the least/most significant byte of that int.
43  *
44  * _STACK_GROWS_UPWARD / _STACK_GROWS_DOWNWARD:
45  *	The processor specific direction of stack growth.  A push onto the
46  *	stack increases/decreases the stack pointer, so it stores data at
47  *	successively higher/lower addresses.  (Stackless machines ignored
48  *	without regrets).
49  *
50  * _LONG_LONG_HTOL / _LONG_LONG_LTOH:
51  *	A pointer to a long long points to the most/least significant long
52  *	within that long long.
53  *
54  * _BIT_FIELDS_HTOL / _BIT_FIELDS_LTOH:
55  *	The C compiler assigns bit fields from the high/low to the low/high end
56  *	of an int (most to least significant vs. least to most significant).
57  *
58  * _IEEE_754:
59  *	The processor (or supported implementations of the processor)
60  *	supports the ieee-754 floating point standard.  No other floating
61  *	point standards are supported (or significant).  Any other supported
62  *	floating point formats are expected to be cased on the ISA processor
63  *	symbol.
64  *
65  * _CHAR_IS_UNSIGNED / _CHAR_IS_SIGNED:
66  *	The C Compiler implements objects of type `char' as `unsigned' or
67  *	`signed' respectively.  This is really an implementation choice of
68  *	the compiler writer, but it is specified in the ABI and tends to
69  *	be uniform across compilers for an instruction set architecture.
70  *	Hence, it has the properties of a processor characteristic.
71  *
72  * _CHAR_ALIGNMENT / _SHORT_ALIGNMENT / _INT_ALIGNMENT / _LONG_ALIGNMENT /
73  * _LONG_LONG_ALIGNMENT / _DOUBLE_ALIGNMENT / _LONG_DOUBLE_ALIGNMENT /
74  * _POINTER_ALIGNMENT / _FLOAT_ALIGNMENT:
75  *	The ABI defines alignment requirements of each of the primitive
76  *	object types.  Some, if not all, may be hardware requirements as
77  * 	well.  The values are expressed in "byte-alignment" units.
78  *
79  * _MAX_ALIGNMENT:
80  *	The most stringent alignment requirement as specified by the ABI.
81  *	Equal to the maximum of all the above _XXX_ALIGNMENT values.
82  *
83  * _ALIGNMENT_REQUIRED:
84  *	True or false (1 or 0) whether or not the hardware requires the ABI
85  *	alignment.
86  *
87  * _LONG_LONG_ALIGNMENT_32
88  *	The 32-bit ABI supported by a 64-bit kernel may have different
89  *	alignment requirements for primitive object types.  The value of this
90  *	identifier is expressed in "byte-alignment" units.
91  *
92  * _HAVE_CPUID_INSN
93  *	This indicates that the architecture supports the 'cpuid'
94  *	instruction as defined by Intel.  (Intel allows other vendors
95  *	to extend the instruction for their own purposes.)
96  *
97  *
98  * Implementation Choices:
99  *
100  * _ILP32 / _LP64:
101  *	This specifies the compiler data type implementation as specified in
102  *	the relevant ABI.  The choice between these is strongly influenced
103  *	by the underlying hardware, but is not absolutely tied to it.
104  *	Currently only two data type models are supported:
105  *
106  *	_ILP32:
107  *		Int/Long/Pointer are 32 bits.  This is the historical UNIX
108  *		and Solaris implementation.  Due to its historical standing,
109  *		this is the default case.
110  *
111  *	_LP64:
112  *		Long/Pointer are 64 bits, Int is 32 bits.  This is the chosen
113  *		implementation for 64-bit ABIs such as SPARC V9.
114  *
115  *	_I32LPx:
116  *		A compilation environment where 'int' is 32-bit, and
117  *		longs and pointers are simply the same size.
118  *
119  *	In all cases, Char is 8 bits and Short is 16 bits.
120  *
121  * _SUNOS_VTOC_8 / _SUNOS_VTOC_16 / _SVR4_VTOC_16:
122  *	This specifies the form of the disk VTOC (or label):
123  *
124  *	_SUNOS_VTOC_8:
125  *		This is a VTOC form which is upwardly compatible with the
126  *		SunOS 4.x disk label and allows 8 partitions per disk.
127  *
128  *	_SUNOS_VTOC_16:
129  *		In this format the incore vtoc image matches the ondisk
130  *		version.  It allows 16 slices per disk, and is not
131  *		compatible with the SunOS 4.x disk label.
132  *
133  *	Note that these are not the only two VTOC forms possible and
134  *	additional forms may be added.  One possible form would be the
135  *	SVr4 VTOC form.  The symbol for that is reserved now, although
136  *	it is not implemented.
137  *
138  *	_SVR4_VTOC_16:
139  *		This VTOC form is compatible with the System V Release 4
140  *		VTOC (as implemented on the SVr4 Intel and 3b ports) with
141  *		16 partitions per disk.
142  *
143  *
144  * _DMA_USES_PHYSADDR / _DMA_USES_VIRTADDR
145  *	This describes the type of addresses used by system DMA:
146  *
147  *	_DMA_USES_PHYSADDR:
148  *		This type of DMA, used in the x86 implementation,
149  *		requires physical addresses for DMA buffers.  The 24-bit
150  *		addresses used by some legacy boards is the source of the
151  *		"low-memory" (<16MB) requirement for some devices using DMA.
152  *
153  *	_DMA_USES_VIRTADDR:
154  *		This method of DMA allows the use of virtual addresses for
155  *		DMA transfers.
156  *
157  * _FIRMWARE_NEEDS_FDISK / _NO_FDISK_PRESENT
158  *      This indicates the presence/absence of an fdisk table.
159  *
160  *      _FIRMWARE_NEEDS_FDISK
161  *              The fdisk table is required by system firmware.  If present,
162  *              it allows a disk to be subdivided into multiple fdisk
163  *              partitions, each of which is equivalent to a separate,
164  *              virtual disk.  This enables the co-existence of multiple
165  *              operating systems on a shared hard disk.
166  *
167  *      _NO_FDISK_PRESENT
168  *              If the fdisk table is absent, it is assumed that the entire
169  *              media is allocated for a single operating system.
170  *
171  * _HAVE_TEM_FIRMWARE
172  *	Defined if this architecture has the (fallback) option of
173  *	using prom_* calls for doing I/O if a suitable kernel driver
174  *	is not available to do it.
175  *
176  * _DONT_USE_1275_GENERIC_NAMES
177  *		Controls whether or not device tree node names should
178  *		comply with the IEEE 1275 "Generic Names" Recommended
179  *		Practice. With _DONT_USE_GENERIC_NAMES, device-specific
180  *		names identifying the particular device will be used.
181  *
182  * __i386_COMPAT
183  *	This indicates whether the i386 ABI is supported as a *non-native*
184  *	mode for the platform.  When this symbol is defined:
185  *	-	32-bit xstat-style system calls are enabled
186  *	-	32-bit xmknod-style system calls are enabled
187  *	-	32-bit system calls use i386 sizes -and- alignments
188  *
189  *	Note that this is NOT defined for the i386 native environment!
190  *
191  * __x86
192  *	This is ONLY a synonym for defined(__i386) || defined(__amd64)
193  *	which is useful only insofar as these two architectures share
194  *	common attributes.  Analogous to __sparc.
195  *
196  * _PSM_MODULES
197  *	This indicates whether or not the implementation uses PSM
198  *	modules for processor support, reading /etc/mach from inside
199  *	the kernel to extract a list.
200  *
201  * _RTC_CONFIG
202  *	This indicates whether or not the implementation uses /etc/rtc_config
203  *	to configure the real-time clock in the kernel.
204  *
205  * _UNIX_KRTLD
206  *	This indicates that the implementation uses a dynamically
207  *	linked unix + krtld to form the core kernel image at boot
208  *	time, or (in the absence of this symbol) a prelinked kernel image.
209  *
210  * _OBP
211  *	This indicates the firmware interface is OBP.
212  *
213  * _SOFT_HOSTID
214  *	This indicates that the implementation obtains the hostid
215  *	from the file /etc/hostid, rather than from hardware.
216  */
217 
218 #ifdef	__cplusplus
219 extern "C" {
220 #endif
221 
222 /*
223  * The following set of definitions characterize Solaris on AMD's
224  * 64-bit systems.
225  */
226 #if defined(__x86_64) || defined(__amd64)
227 
228 #if !defined(__amd64)
229 #define	__amd64		/* preferred guard */
230 #endif
231 
232 #if !defined(__x86)
233 #define	__x86
234 #endif
235 
236 /*
237  * Define the appropriate "processor characteristics"
238  */
239 #define	_STACK_GROWS_DOWNWARD
240 #define	_LONG_LONG_LTOH
241 #define	_BIT_FIELDS_LTOH
242 #define	_IEEE_754
243 #define	_CHAR_IS_SIGNED
244 #define	_BOOL_ALIGNMENT			1
245 #define	_CHAR_ALIGNMENT			1
246 #define	_SHORT_ALIGNMENT		2
247 #define	_INT_ALIGNMENT			4
248 #define	_FLOAT_ALIGNMENT		4
249 #define	_FLOAT_COMPLEX_ALIGNMENT	4
250 #define	_LONG_ALIGNMENT			8
251 #define	_LONG_LONG_ALIGNMENT		8
252 #define	_DOUBLE_ALIGNMENT		8
253 #define	_DOUBLE_COMPLEX_ALIGNMENT	8
254 #define	_LONG_DOUBLE_ALIGNMENT		16
255 #define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	16
256 #define	_POINTER_ALIGNMENT		8
257 #define	_MAX_ALIGNMENT			16
258 #define	_ALIGNMENT_REQUIRED		1
259 
260 /*
261  * Different alignment constraints for the i386 ABI in compatibility mode
262  */
263 #define	_LONG_LONG_ALIGNMENT_32		4
264 
265 /*
266  * Define the appropriate "implementation choices".
267  */
268 #if !defined(_LP64)
269 #error "_LP64 not defined"
270 #endif
271 #if !defined(_I32LPx)
272 #define	_I32LPx
273 #endif
274 #define	_MULTI_DATAMODEL
275 #define	_SUNOS_VTOC_16
276 #define	_DMA_USES_PHYSADDR
277 #define	_FIRMWARE_NEEDS_FDISK
278 #define	__i386_COMPAT
279 #define	_PSM_MODULES
280 #define	_RTC_CONFIG
281 #define	_SOFT_HOSTID
282 #define	_DONT_USE_1275_GENERIC_NAMES
283 #define	_HAVE_CPUID_INSN
284 
285 /*
286  * The feature test macro __i386 is generic for all processors implementing
287  * the Intel 386 instruction set or a superset of it.  Specifically, this
288  * includes all members of the 386, 486, and Pentium family of processors.
289  */
290 #elif defined(__i386) || defined(__i386__)
291 
292 #if !defined(__i386)
293 #define	__i386
294 #endif
295 
296 #if !defined(__x86)
297 #define	__x86
298 #endif
299 
300 /*
301  * Define the appropriate "processor characteristics"
302  */
303 #define	_STACK_GROWS_DOWNWARD
304 #define	_LONG_LONG_LTOH
305 #define	_BIT_FIELDS_LTOH
306 #define	_IEEE_754
307 #define	_CHAR_IS_SIGNED
308 #define	_BOOL_ALIGNMENT			1
309 #define	_CHAR_ALIGNMENT			1
310 #define	_SHORT_ALIGNMENT		2
311 #define	_INT_ALIGNMENT			4
312 #define	_FLOAT_ALIGNMENT		4
313 #define	_FLOAT_COMPLEX_ALIGNMENT	4
314 #define	_LONG_ALIGNMENT			4
315 #define	_LONG_LONG_ALIGNMENT		4
316 #define	_DOUBLE_ALIGNMENT		4
317 #define	_DOUBLE_COMPLEX_ALIGNMENT	4
318 #define	_LONG_DOUBLE_ALIGNMENT		4
319 #define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	4
320 #define	_POINTER_ALIGNMENT		4
321 #define	_MAX_ALIGNMENT			4
322 #define	_ALIGNMENT_REQUIRED		0
323 
324 #define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGNMENT
325 
326 /*
327  * Define the appropriate "implementation choices".
328  */
329 #if !defined(_ILP32)
330 #define	_ILP32
331 #endif
332 #if !defined(_I32LPx)
333 #define	_I32LPx
334 #endif
335 #define	_SUNOS_VTOC_16
336 #define	_DMA_USES_PHYSADDR
337 #define	_FIRMWARE_NEEDS_FDISK
338 #define	_PSM_MODULES
339 #define	_RTC_CONFIG
340 #define	_SOFT_HOSTID
341 #define	_DONT_USE_1275_GENERIC_NAMES
342 #define	_HAVE_CPUID_INSN
343 
344 #elif defined(__aarch64__)
345 
346 /*
347  * Define the appropriate "processor characteristics"
348  */
349 #define	_STACK_GROWS_DOWNWARD
350 #define	_LONG_LONG_LTOH
351 #define	_BIT_FIELDS_LTOH
352 #define	_IEEE_754
353 #define	_CHAR_IS_UNSIGNED
354 #define	_BOOL_ALIGNMENT			1
355 #define	_CHAR_ALIGNMENT			1
356 #define	_SHORT_ALIGNMENT		2
357 #define	_INT_ALIGNMENT			4
358 #define	_FLOAT_ALIGNMENT		4
359 #define	_FLOAT_COMPLEX_ALIGNMENT	4
360 #define	_LONG_ALIGNMENT			8
361 #define	_LONG_LONG_ALIGNMENT		8
362 #define	_DOUBLE_ALIGNMENT		8
363 #define	_DOUBLE_COMPLEX_ALIGNMENT	8
364 #define	_LONG_DOUBLE_ALIGNMENT		16
365 #define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	16
366 #define	_POINTER_ALIGNMENT		8
367 #define	_MAX_ALIGNMENT			16
368 #define	_ALIGNMENT_REQUIRED		1
369 
370 #define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGNMENT
371 
372 /*
373  * Define the appropriate "implementation choices"
374  */
375 #if !defined(_LP64)
376 #error "_LP64 not defined"
377 #endif
378 #define	_SUNOS_VTOC_16
379 #define	_DMA_USES_PHYSADDR
380 #define	_FIRMWARE_NEEDS_FDISK
381 #define	_PSM_MODULES
382 #define	_RTC_CONFIG
383 #define	_DONT_USE_1275_GENERIC_NAMES
384 #define	_HAVE_CPUID_INSN
385 
386 #elif defined(__riscv)
387 
388 /*
389  * Define the appropriate "processor characteristics"
390  */
391 #define	_STACK_GROWS_DOWNWARD
392 #define	_LONG_LONG_LTOH
393 #define	_BIT_FIELDS_LTOH
394 #define	_IEEE_754
395 #define	_CHAR_IS_UNSIGNED
396 #define	_BOOL_ALIGNMENT			1
397 #define	_CHAR_ALIGNMENT			1
398 #define	_SHORT_ALIGNMENT		2
399 #define	_INT_ALIGNMENT			4
400 #define	_FLOAT_ALIGNMENT		4
401 #define	_FLOAT_COMPLEX_ALIGNMENT	4
402 #define	_LONG_ALIGNMENT			8
403 #define	_LONG_LONG_ALIGNMENT		8
404 #define	_DOUBLE_ALIGNMENT		8
405 #define	_DOUBLE_COMPLEX_ALIGNMENT	8
406 #define	_LONG_DOUBLE_ALIGNMENT		16
407 #define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	16
408 #define	_POINTER_ALIGNMENT		8
409 #define	_MAX_ALIGNMENT			16
410 #define	_ALIGNMENT_REQUIRED		1
411 
412 #define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGNMENT
413 
414 /*
415  * Define the appropriate "implementation choices"
416  */
417 #if !defined(_LP64)
418 #define	_LP64
419 #endif
420 #define	_SUNOS_VTOC_16
421 #define	_DMA_USES_PHYSADDR
422 #define	_FIRMWARE_NEEDS_FDISK
423 #define	_PSM_MODULES
424 #define	_RTC_CONFIG
425 #define	_DONT_USE_1275_GENERIC_NAMES
426 #define	_HAVE_CPUID_INSN
427 
428 #elif defined(__arm__)
429 
430 /*
431  * Define the appropriate "processor characteristics"
432  */
433 #define	_STACK_GROWS_DOWNWARD
434 #define	_LONG_LONG_LTOH
435 #define	_BIT_FIELDS_LTOH
436 #define	_IEEE_754
437 #define	_CHAR_IS_SIGNED
438 #define	_BOOL_ALIGNMENT			1
439 #define	_CHAR_ALIGNMENT			1
440 #define	_SHORT_ALIGNMENT		2
441 #define	_INT_ALIGNMENT			4
442 #define	_FLOAT_ALIGNMENT		4
443 #define	_FLOAT_COMPLEX_ALIGNMENT	4
444 #define	_LONG_ALIGNMENT			4
445 #define	_LONG_LONG_ALIGNMENT		4
446 #define	_DOUBLE_ALIGNMENT		4
447 #define	_DOUBLE_COMPLEX_ALIGNMENT	4
448 #define	_LONG_DOUBLE_ALIGNMENT		4
449 #define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	4
450 #define	_POINTER_ALIGNMENT		4
451 #define	_MAX_ALIGNMENT			4
452 #define	_ALIGNMENT_REQUIRED		0
453 
454 #define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGNMENT
455 
456 /*
457  * Define the appropriate "implementation choices".
458  */
459 #if !defined(_ILP32)
460 #define	_ILP32
461 #endif
462 #if !defined(_I32LPx)
463 #define	_I32LPx
464 #endif
465 #define	_SUNOS_VTOC_16
466 #define	_DMA_USES_PHYSADDR
467 #define	_FIRMWARE_NEEDS_FDISK
468 #define	_PSM_MODULES
469 #define	_RTC_CONFIG
470 #define	_DONT_USE_1275_GENERIC_NAMES
471 #define	_HAVE_CPUID_INSN
472 
473 #elif defined(__mips__)
474 
475 /*
476  * Define the appropriate "processor characteristics"
477  */
478 #define	_STACK_GROWS_DOWNWARD
479 #define	_LONG_LONG_LTOH
480 #define	_BIT_FIELDS_LTOH
481 #define	_IEEE_754
482 #define	_CHAR_IS_SIGNED
483 #define	_BOOL_ALIGNMENT			1
484 #define	_CHAR_ALIGNMENT			1
485 #define	_SHORT_ALIGNMENT		2
486 #define	_INT_ALIGNMENT			4
487 #define	_FLOAT_ALIGNMENT		4
488 #define	_FLOAT_COMPLEX_ALIGNMENT	4
489 #if defined(__mips_n64)
490 #define	_LONG_ALIGNMENT			8
491 #define	_LONG_LONG_ALIGNMENT		8
492 #define	_DOUBLE_ALIGNMENT		8
493 #define	_DOUBLE_COMPLEX_ALIGNMENT	8
494 #define	_LONG_DOUBLE_ALIGNMENT		8
495 #define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	8
496 #define	_POINTER_ALIGNMENT		8
497 #define	_MAX_ALIGNMENT			8
498 #define	_ALIGNMENT_REQUIRED		0
499 
500 #define	_LONG_LONG_ALIGNMENT_32		_INT_ALIGNMENT
501 /*
502  * Define the appropriate "implementation choices".
503  */
504 #if !defined(_LP64)
505 #error "_LP64 not defined"
506 #endif
507 #else
508 #define	_LONG_ALIGNMENT			4
509 #define	_LONG_LONG_ALIGNMENT		4
510 #define	_DOUBLE_ALIGNMENT		4
511 #define	_DOUBLE_COMPLEX_ALIGNMENT	4
512 #define	_LONG_DOUBLE_ALIGNMENT		4
513 #define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	4
514 #define	_POINTER_ALIGNMENT		4
515 #define	_MAX_ALIGNMENT			4
516 #define	_ALIGNMENT_REQUIRED		0
517 
518 #define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGNMENT
519 
520 /*
521  * Define the appropriate "implementation choices".
522  */
523 #if !defined(_ILP32)
524 #define	_ILP32
525 #endif
526 #if !defined(_I32LPx)
527 #define	_I32LPx
528 #endif
529 #endif
530 #define	_SUNOS_VTOC_16
531 #define	_DMA_USES_PHYSADDR
532 #define	_FIRMWARE_NEEDS_FDISK
533 #define	_PSM_MODULES
534 #define	_RTC_CONFIG
535 #define	_DONT_USE_1275_GENERIC_NAMES
536 #define	_HAVE_CPUID_INSN
537 
538 #elif defined(__powerpc__)
539 
540 #if defined(__BIG_ENDIAN__)
541 #define	_BIT_FIELDS_HTOL
542 #else
543 #define	_BIT_FIELDS_LTOH
544 #endif
545 
546 #if !defined(__powerpc)
547 #define	__powerpc
548 #endif
549 
550 #if defined(__powerpc64__)
551 #define	_LONG_LONG_ALIGNMENT		8
552 #define	_MULTI_DATAMODEL
553 #else
554 #define	_LONG_LONG_ALIGNMENT		4
555 #endif
556 #define	_LONG_LONG_ALIGNMENT_32		4
557 #define	_ALIGNMENT_REQUIRED		1
558 
559 #define	_SUNOS_VTOC_16	1
560 
561 /*
562  * The following set of definitions characterize the Solaris on SPARC systems.
563  *
564  * The symbol __sparc indicates any of the SPARC family of processor
565  * architectures.  This includes SPARC V7, SPARC V8 and SPARC V9.
566  *
567  * The symbol __sparcv8 indicates the 32-bit SPARC V8 architecture as defined
568  * by Version 8 of the SPARC Architecture Manual.  (SPARC V7 is close enough
569  * to SPARC V8 for the former to be subsumed into the latter definition.)
570  *
571  * The symbol __sparcv9 indicates the 64-bit SPARC V9 architecture as defined
572  * by Version 9 of the SPARC Architecture Manual.
573  *
574  * The symbols __sparcv8 and __sparcv9 are mutually exclusive, and are only
575  * relevant when the symbol __sparc is defined.
576  */
577 /*
578  * XXX Due to the existence of 5110166, "defined(__sparcv9)" needs to be added
579  * to support backwards builds.  This workaround should be removed in s10_71.
580  */
581 #elif defined(__sparc) || defined(__sparcv9) || defined(__sparc__)
582 #if !defined(__sparc)
583 #define	__sparc
584 #endif
585 
586 /*
587  * You can be 32-bit or 64-bit, but not both at the same time.
588  */
589 #if defined(__sparcv8) && defined(__sparcv9)
590 #error	"SPARC Versions 8 and 9 are mutually exclusive choices"
591 #endif
592 
593 /*
594  * Existing compilers do not set __sparcv8.  Years will transpire before
595  * the compilers can be depended on to set the feature test macro. In
596  * the interim, we'll set it here on the basis of historical behaviour;
597  * if you haven't asked for SPARC V9, then you must've meant SPARC V8.
598  */
599 #if !defined(__sparcv9) && !defined(__sparcv8)
600 #define	__sparcv8
601 #endif
602 
603 /*
604  * Define the appropriate "processor characteristics" shared between
605  * all Solaris on SPARC systems.
606  */
607 #define	_STACK_GROWS_DOWNWARD
608 #define	_LONG_LONG_HTOL
609 #define	_BIT_FIELDS_HTOL
610 #define	_IEEE_754
611 #define	_CHAR_IS_SIGNED
612 #define	_BOOL_ALIGNMENT			1
613 #define	_CHAR_ALIGNMENT			1
614 #define	_SHORT_ALIGNMENT		2
615 #define	_INT_ALIGNMENT			4
616 #define	_FLOAT_ALIGNMENT		4
617 #define	_FLOAT_COMPLEX_ALIGNMENT	4
618 #define	_LONG_LONG_ALIGNMENT		8
619 #define	_DOUBLE_ALIGNMENT		8
620 #define	_DOUBLE_COMPLEX_ALIGNMENT	8
621 #define	_ALIGNMENT_REQUIRED		1
622 
623 /*
624  * Define the appropriate "implementation choices" shared between versions.
625  */
626 #define	_SUNOS_VTOC_8
627 #define	_DMA_USES_VIRTADDR
628 #define	_NO_FDISK_PRESENT
629 #define	_HAVE_TEM_FIRMWARE
630 #define	_OBP
631 
632 /*
633  * The following set of definitions characterize the implementation of
634  * 32-bit Solaris on SPARC V8 systems.
635  */
636 #if defined(__sparcv8)
637 
638 /*
639  * Define the appropriate "processor characteristics"
640  */
641 #define	_LONG_ALIGNMENT			4
642 #define	_LONG_DOUBLE_ALIGNMENT		8
643 #define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	8
644 #define	_POINTER_ALIGNMENT		4
645 #define	_MAX_ALIGNMENT			8
646 
647 #define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGNMENT
648 
649 /*
650  * Define the appropriate "implementation choices"
651  */
652 #define	_ILP32
653 #if !defined(_I32LPx)
654 #define	_I32LPx
655 #endif
656 
657 /*
658  * The following set of definitions characterize the implementation of
659  * 64-bit Solaris on SPARC V9 systems.
660  */
661 #elif defined(__sparcv9)
662 
663 /*
664  * Define the appropriate "processor characteristics"
665  */
666 #define	_LONG_ALIGNMENT			8
667 #define	_LONG_DOUBLE_ALIGNMENT		16
668 #define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	16
669 #define	_POINTER_ALIGNMENT		8
670 #define	_MAX_ALIGNMENT			16
671 
672 #define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGNMENT
673 
674 /*
675  * Define the appropriate "implementation choices"
676  */
677 #if !defined(_LP64)
678 #error "_LP64 not defined"
679 #endif
680 #if !defined(_I32LPx)
681 #define	_I32LPx
682 #endif
683 #define	_MULTI_DATAMODEL
684 
685 #else
686 #error	"unknown SPARC version"
687 #endif
688 
689 /*
690  * #error is strictly ansi-C, but works as well as anything for K&R systems.
691  */
692 #else
693 #error "ISA not supported"
694 #endif
695 
696 #if defined(_ILP32) && defined(_LP64)
697 #error "Both _ILP32 and _LP64 are defined"
698 #endif
699 
700 #if BYTE_ORDER == _BIG_ENDIAN
701 #define	_ZFS_BIG_ENDIAN
702 #elif BYTE_ORDER == _LITTLE_ENDIAN
703 #define	_ZFS_LITTLE_ENDIAN
704 #else
705 #error "unknown byte order"
706 #endif
707 
708 #ifdef	__cplusplus
709 }
710 #endif
711 
712 #endif	/* _SYS_ISA_DEFS_H */
713