isa_defs.h revision 185614
1168404Spjd/*
2168404Spjd * CDDL HEADER START
3168404Spjd *
4168404Spjd * The contents of this file are subject to the terms of the
5168404Spjd * Common Development and Distribution License (the "License").
6168404Spjd * You may not use this file except in compliance with the License.
7168404Spjd *
8168404Spjd * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9168404Spjd * or http://www.opensolaris.org/os/licensing.
10168404Spjd * See the License for the specific language governing permissions
11168404Spjd * and limitations under the License.
12168404Spjd *
13185029Spjd *
14168404Spjd * When distributing Covered Code, include this CDDL HEADER in each
15168404Spjd * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16168404Spjd * If applicable, add the following below this CDDL HEADER, with the
17168404Spjd * fields enclosed by brackets "[]" replaced with your own identifying
18168404Spjd * information: Portions Copyright [yyyy] [name of copyright owner]
19168404Spjd *
20168404Spjd * CDDL HEADER END
21168404Spjd */
22168404Spjd
23168404Spjd/*
24185029Spjd * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
25168404Spjd * Use is subject to license terms.
26168404Spjd */
27168404Spjd
28168404Spjd#ifndef	_SYS_ISA_DEFS_H
29168404Spjd#define	_SYS_ISA_DEFS_H
30168404Spjd
31168404Spjd/*
32168404Spjd * This header file serves to group a set of well known defines and to
33168404Spjd * set these for each instruction set architecture.  These defines may
34168404Spjd * be divided into two groups;  characteristics of the processor and
35168404Spjd * implementation choices for Solaris on a processor.
36168404Spjd *
37168404Spjd * Processor Characteristics:
38168404Spjd *
39168404Spjd * _LITTLE_ENDIAN / _BIG_ENDIAN:
40168404Spjd *	The natural byte order of the processor.  A pointer to an int points
41168404Spjd *	to the least/most significant byte of that int.
42168404Spjd *
43168404Spjd * _STACK_GROWS_UPWARD / _STACK_GROWS_DOWNWARD:
44168404Spjd *	The processor specific direction of stack growth.  A push onto the
45168404Spjd *	stack increases/decreases the stack pointer, so it stores data at
46168404Spjd *	successively higher/lower addresses.  (Stackless machines ignored
47168404Spjd *	without regrets).
48168404Spjd *
49168404Spjd * _LONG_LONG_HTOL / _LONG_LONG_LTOH:
50168404Spjd *	A pointer to a long long points to the most/least significant long
51168404Spjd *	within that long long.
52168404Spjd *
53168404Spjd * _BIT_FIELDS_HTOL / _BIT_FIELDS_LTOH:
54168404Spjd *	The C compiler assigns bit fields from the high/low to the low/high end
55168404Spjd *	of an int (most to least significant vs. least to most significant).
56168404Spjd *
57168404Spjd * _IEEE_754:
58168404Spjd *	The processor (or supported implementations of the processor)
59168404Spjd *	supports the ieee-754 floating point standard.  No other floating
60168404Spjd *	point standards are supported (or significant).  Any other supported
61168404Spjd *	floating point formats are expected to be cased on the ISA processor
62168404Spjd *	symbol.
63168404Spjd *
64168404Spjd * _CHAR_IS_UNSIGNED / _CHAR_IS_SIGNED:
65168404Spjd *	The C Compiler implements objects of type `char' as `unsigned' or
66168404Spjd *	`signed' respectively.  This is really an implementation choice of
67168404Spjd *	the compiler writer, but it is specified in the ABI and tends to
68168404Spjd *	be uniform across compilers for an instruction set architecture.
69168404Spjd *	Hence, it has the properties of a processor characteristic.
70168404Spjd *
71168404Spjd * _CHAR_ALIGNMENT / _SHORT_ALIGNMENT / _INT_ALIGNMENT / _LONG_ALIGNMENT /
72168404Spjd * _LONG_LONG_ALIGNMENT / _DOUBLE_ALIGNMENT / _LONG_DOUBLE_ALIGNMENT /
73168404Spjd * _POINTER_ALIGNMENT / _FLOAT_ALIGNMENT:
74168404Spjd *	The ABI defines alignment requirements of each of the primitive
75168404Spjd *	object types.  Some, if not all, may be hardware requirements as
76168404Spjd * 	well.  The values are expressed in "byte-alignment" units.
77168404Spjd *
78168404Spjd * _MAX_ALIGNMENT:
79168404Spjd *	The most stringent alignment requirement as specified by the ABI.
80168404Spjd *	Equal to the maximum of all the above _XXX_ALIGNMENT values.
81168404Spjd *
82168404Spjd * _ALIGNMENT_REQUIRED:
83168404Spjd *	True or false (1 or 0) whether or not the hardware requires the ABI
84168404Spjd *	alignment.
85168404Spjd *
86168404Spjd * _LONG_LONG_ALIGNMENT_32
87168404Spjd *	The 32-bit ABI supported by a 64-bit kernel may have different
88168404Spjd *	alignment requirements for primitive object types.  The value of this
89168404Spjd *	identifier is expressed in "byte-alignment" units.
90168404Spjd *
91168404Spjd * _HAVE_CPUID_INSN
92168404Spjd *	This indicates that the architecture supports the 'cpuid'
93168404Spjd *	instruction as defined by Intel.  (Intel allows other vendors
94168404Spjd *	to extend the instruction for their own purposes.)
95168404Spjd *
96168404Spjd *
97168404Spjd * Implementation Choices:
98168404Spjd *
99168404Spjd * _ILP32 / _LP64:
100168404Spjd *	This specifies the compiler data type implementation as specified in
101168404Spjd *	the relevant ABI.  The choice between these is strongly influenced
102168404Spjd *	by the underlying hardware, but is not absolutely tied to it.
103168404Spjd *	Currently only two data type models are supported:
104168404Spjd *
105168404Spjd *	_ILP32:
106168404Spjd *		Int/Long/Pointer are 32 bits.  This is the historical UNIX
107168404Spjd *		and Solaris implementation.  Due to its historical standing,
108168404Spjd *		this is the default case.
109168404Spjd *
110168404Spjd *	_LP64:
111168404Spjd *		Long/Pointer are 64 bits, Int is 32 bits.  This is the chosen
112168404Spjd *		implementation for 64-bit ABIs such as SPARC V9.
113168404Spjd *
114168404Spjd *	_I32LPx:
115168404Spjd *		A compilation environment where 'int' is 32-bit, and
116168404Spjd *		longs and pointers are simply the same size.
117168404Spjd *
118168404Spjd *	In all cases, Char is 8 bits and Short is 16 bits.
119168404Spjd *
120168404Spjd * _SUNOS_VTOC_8 / _SUNOS_VTOC_16 / _SVR4_VTOC_16:
121168404Spjd *	This specifies the form of the disk VTOC (or label):
122168404Spjd *
123168404Spjd *	_SUNOS_VTOC_8:
124168404Spjd *		This is a VTOC form which is upwardly compatible with the
125168404Spjd *		SunOS 4.x disk label and allows 8 partitions per disk.
126168404Spjd *
127168404Spjd *	_SUNOS_VTOC_16:
128168404Spjd *		In this format the incore vtoc image matches the ondisk
129168404Spjd *		version.  It allows 16 slices per disk, and is not
130168404Spjd *		compatible with the SunOS 4.x disk label.
131168404Spjd *
132168404Spjd *	Note that these are not the only two VTOC forms possible and
133168404Spjd *	additional forms may be added.  One possible form would be the
134168404Spjd *	SVr4 VTOC form.  The symbol for that is reserved now, although
135168404Spjd *	it is not implemented.
136168404Spjd *
137168404Spjd *	_SVR4_VTOC_16:
138168404Spjd *		This VTOC form is compatible with the System V Release 4
139168404Spjd *		VTOC (as implemented on the SVr4 Intel and 3b ports) with
140168404Spjd *		16 partitions per disk.
141168404Spjd *
142168404Spjd *
143168404Spjd * _DMA_USES_PHYSADDR / _DMA_USES_VIRTADDR
144168404Spjd *	This describes the type of addresses used by system DMA:
145168404Spjd *
146168404Spjd *	_DMA_USES_PHYSADDR:
147168404Spjd *		This type of DMA, used in the x86 implementation,
148168404Spjd *		requires physical addresses for DMA buffers.  The 24-bit
149168404Spjd *		addresses used by some legacy boards is the source of the
150168404Spjd *		"low-memory" (<16MB) requirement for some devices using DMA.
151168404Spjd *
152168404Spjd *	_DMA_USES_VIRTADDR:
153168404Spjd *		This method of DMA allows the use of virtual addresses for
154168404Spjd *		DMA transfers.
155168404Spjd *
156168404Spjd * _FIRMWARE_NEEDS_FDISK / _NO_FDISK_PRESENT
157168404Spjd *      This indicates the presence/absence of an fdisk table.
158168404Spjd *
159168404Spjd *      _FIRMWARE_NEEDS_FDISK
160168404Spjd *              The fdisk table is required by system firmware.  If present,
161168404Spjd *              it allows a disk to be subdivided into multiple fdisk
162168404Spjd *              partitions, each of which is equivalent to a separate,
163168404Spjd *              virtual disk.  This enables the co-existence of multiple
164168404Spjd *              operating systems on a shared hard disk.
165168404Spjd *
166168404Spjd *      _NO_FDISK_PRESENT
167168404Spjd *              If the fdisk table is absent, it is assumed that the entire
168168404Spjd *              media is allocated for a single operating system.
169168404Spjd *
170168404Spjd * _HAVE_TEM_FIRMWARE
171168404Spjd *	Defined if this architecture has the (fallback) option of
172168404Spjd *	using prom_* calls for doing I/O if a suitable kernel driver
173168404Spjd *	is not available to do it.
174168404Spjd *
175168404Spjd * _DONT_USE_1275_GENERIC_NAMES
176168404Spjd *		Controls whether or not device tree node names should
177168404Spjd *		comply with the IEEE 1275 "Generic Names" Recommended
178168404Spjd *		Practice. With _DONT_USE_GENERIC_NAMES, device-specific
179168404Spjd *		names identifying the particular device will be used.
180168404Spjd *
181168404Spjd * __i386_COMPAT
182168404Spjd *	This indicates whether the i386 ABI is supported as a *non-native*
183168404Spjd *	mode for the platform.  When this symbol is defined:
184168404Spjd *	-	32-bit xstat-style system calls are enabled
185168404Spjd *	-	32-bit xmknod-style system calls are enabled
186168404Spjd *	-	32-bit system calls use i386 sizes -and- alignments
187168404Spjd *
188168404Spjd *	Note that this is NOT defined for the i386 native environment!
189168404Spjd *
190168404Spjd * __x86
191168404Spjd *	This is ONLY a synonym for defined(__i386) || defined(__amd64)
192168404Spjd *	which is useful only insofar as these two architectures share
193168404Spjd *	common attributes.  Analogous to __sparc.
194168404Spjd *
195168404Spjd * _PSM_MODULES
196168404Spjd *	This indicates whether or not the implementation uses PSM
197168404Spjd *	modules for processor support, reading /etc/mach from inside
198168404Spjd *	the kernel to extract a list.
199168404Spjd *
200168404Spjd * _RTC_CONFIG
201168404Spjd *	This indicates whether or not the implementation uses /etc/rtc_config
202168404Spjd *	to configure the real-time clock in the kernel.
203168404Spjd *
204168404Spjd * _UNIX_KRTLD
205168404Spjd *	This indicates that the implementation uses a dynamically
206168404Spjd *	linked unix + krtld to form the core kernel image at boot
207168404Spjd *	time, or (in the absence of this symbol) a prelinked kernel image.
208179198Sjb *
209179198Sjb * _OBP
210179198Sjb *	This indicates the firmware interface is OBP.
211185029Spjd *
212185029Spjd * _SOFT_HOSTID
213185029Spjd *	This indicates that the implementation obtains the hostid
214185029Spjd *	from the file /etc/hostid, rather than from hardware.
215168404Spjd */
216168404Spjd
217168404Spjd#ifdef	__cplusplus
218168404Spjdextern "C" {
219168404Spjd#endif
220168404Spjd
221168404Spjd/*
222168404Spjd * The following set of definitions characterize Solaris on AMD's
223168404Spjd * 64-bit systems.
224168404Spjd */
225179198Sjb#if defined(__x86_64) || defined(__amd64) || defined(__ia64__)
226168404Spjd
227168404Spjd#if !defined(__amd64)
228168404Spjd#define	__amd64		/* preferred guard */
229168404Spjd#endif
230168404Spjd
231168404Spjd#if !defined(__x86)
232168404Spjd#define	__x86
233168404Spjd#endif
234168404Spjd
235168404Spjd/*
236168404Spjd * Define the appropriate "processor characteristics"
237168404Spjd */
238174049Sjb#if defined(sun)
239168404Spjd#define	_LITTLE_ENDIAN
240174049Sjb#endif
241168404Spjd#define	_STACK_GROWS_DOWNWARD
242168404Spjd#define	_LONG_LONG_LTOH
243168404Spjd#define	_BIT_FIELDS_LTOH
244168404Spjd#define	_IEEE_754
245168404Spjd#define	_CHAR_IS_SIGNED
246168404Spjd#define	_BOOL_ALIGNMENT			1
247168404Spjd#define	_CHAR_ALIGNMENT			1
248168404Spjd#define	_SHORT_ALIGNMENT		2
249168404Spjd#define	_INT_ALIGNMENT			4
250168404Spjd#define	_FLOAT_ALIGNMENT		4
251168404Spjd#define	_FLOAT_COMPLEX_ALIGNMENT	4
252168404Spjd#define	_LONG_ALIGNMENT			8
253168404Spjd#define	_LONG_LONG_ALIGNMENT		8
254168404Spjd#define	_DOUBLE_ALIGNMENT		8
255168404Spjd#define	_DOUBLE_COMPLEX_ALIGNMENT	8
256168404Spjd#define	_LONG_DOUBLE_ALIGNMENT		16
257168404Spjd#define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	16
258168404Spjd#define	_POINTER_ALIGNMENT		8
259168404Spjd#define	_MAX_ALIGNMENT			16
260168404Spjd#define	_ALIGNMENT_REQUIRED		1
261168404Spjd
262168404Spjd/*
263168404Spjd * Different alignment constraints for the i386 ABI in compatibility mode
264168404Spjd */
265168404Spjd#define	_LONG_LONG_ALIGNMENT_32		4
266168404Spjd
267168404Spjd/*
268168404Spjd * Define the appropriate "implementation choices".
269168404Spjd */
270168404Spjd#if !defined(_LP64)
271168404Spjd#define	_LP64
272168404Spjd#endif
273168404Spjd#if !defined(_I32LPx) && defined(_KERNEL)
274168404Spjd#define	_I32LPx
275168404Spjd#endif
276168404Spjd#define	_MULTI_DATAMODEL
277168404Spjd#define	_SUNOS_VTOC_16
278168404Spjd#define	_DMA_USES_PHYSADDR
279168404Spjd#define	_FIRMWARE_NEEDS_FDISK
280168404Spjd#define	__i386_COMPAT
281168404Spjd#define	_PSM_MODULES
282168404Spjd#define	_RTC_CONFIG
283185029Spjd#define	_SOFT_HOSTID
284168404Spjd#define	_DONT_USE_1275_GENERIC_NAMES
285168404Spjd#define	_HAVE_CPUID_INSN
286168404Spjd
287168404Spjd/*
288168404Spjd * The feature test macro __i386 is generic for all processors implementing
289168404Spjd * the Intel 386 instruction set or a superset of it.  Specifically, this
290168404Spjd * includes all members of the 386, 486, and Pentium family of processors.
291168404Spjd */
292168404Spjd#elif defined(__i386) || defined(__i386__)
293168404Spjd
294168404Spjd#if !defined(__i386)
295168404Spjd#define	__i386
296168404Spjd#endif
297168404Spjd
298168404Spjd#if !defined(__x86)
299168404Spjd#define	__x86
300168404Spjd#endif
301168404Spjd
302168404Spjd/*
303168404Spjd * Define the appropriate "processor characteristics"
304168404Spjd */
305174049Sjb#if defined(sun)
306168404Spjd#define	_LITTLE_ENDIAN
307174049Sjb#endif
308168404Spjd#define	_STACK_GROWS_DOWNWARD
309168404Spjd#define	_LONG_LONG_LTOH
310168404Spjd#define	_BIT_FIELDS_LTOH
311168404Spjd#define	_IEEE_754
312168404Spjd#define	_CHAR_IS_SIGNED
313168404Spjd#define	_BOOL_ALIGNMENT			1
314168404Spjd#define	_CHAR_ALIGNMENT			1
315168404Spjd#define	_SHORT_ALIGNMENT		2
316168404Spjd#define	_INT_ALIGNMENT			4
317168404Spjd#define	_FLOAT_ALIGNMENT		4
318168404Spjd#define	_FLOAT_COMPLEX_ALIGNMENT	4
319168404Spjd#define	_LONG_ALIGNMENT			4
320168404Spjd#define	_LONG_LONG_ALIGNMENT		4
321168404Spjd#define	_DOUBLE_ALIGNMENT		4
322168404Spjd#define	_DOUBLE_COMPLEX_ALIGNMENT	4
323168404Spjd#define	_LONG_DOUBLE_ALIGNMENT		4
324168404Spjd#define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	4
325168404Spjd#define	_POINTER_ALIGNMENT		4
326168404Spjd#define	_MAX_ALIGNMENT			4
327168404Spjd#define	_ALIGNMENT_REQUIRED		0
328168404Spjd
329168404Spjd#define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGNMENT
330168404Spjd
331168404Spjd/*
332168404Spjd * Define the appropriate "implementation choices".
333168404Spjd */
334168404Spjd#define	_ILP32
335168404Spjd#if !defined(_I32LPx) && defined(_KERNEL)
336168404Spjd#define	_I32LPx
337168404Spjd#endif
338168404Spjd#define	_SUNOS_VTOC_16
339168404Spjd#define	_DMA_USES_PHYSADDR
340168404Spjd#define	_FIRMWARE_NEEDS_FDISK
341168404Spjd#define	_PSM_MODULES
342168404Spjd#define	_RTC_CONFIG
343185029Spjd#define	_SOFT_HOSTID
344168404Spjd#define	_DONT_USE_1275_GENERIC_NAMES
345168404Spjd#define	_HAVE_CPUID_INSN
346168404Spjd
347179198Sjb#elif defined(__arm__)
348179198Sjb
349168404Spjd/*
350179198Sjb * Define the appropriate "processor characteristics"
351179198Sjb */
352179198Sjb#define	_STACK_GROWS_DOWNWARD
353179198Sjb#define	_LONG_LONG_LTOH
354179198Sjb#define	_BIT_FIELDS_LTOH
355179198Sjb#define	_IEEE_754
356179198Sjb#define	_CHAR_IS_SIGNED
357179198Sjb#define	_BOOL_ALIGNMENT			1
358179198Sjb#define	_CHAR_ALIGNMENT			1
359179198Sjb#define	_SHORT_ALIGNMENT		2
360179198Sjb#define	_INT_ALIGNMENT			4
361179198Sjb#define	_FLOAT_ALIGNMENT		4
362179198Sjb#define	_FLOAT_COMPLEX_ALIGNMENT	4
363179198Sjb#define	_LONG_ALIGNMENT			4
364179198Sjb#define	_LONG_LONG_ALIGNMENT		4
365179198Sjb#define	_DOUBLE_ALIGNMENT		4
366179198Sjb#define	_DOUBLE_COMPLEX_ALIGNMENT	4
367179198Sjb#define	_LONG_DOUBLE_ALIGNMENT		4
368179198Sjb#define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	4
369179198Sjb#define	_POINTER_ALIGNMENT		4
370179198Sjb#define	_MAX_ALIGNMENT			4
371179198Sjb#define	_ALIGNMENT_REQUIRED		0
372179198Sjb
373179198Sjb#define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGNMENT
374179198Sjb
375179198Sjb/*
376179198Sjb * Define the appropriate "implementation choices".
377179198Sjb */
378179198Sjb#define	_ILP32
379179198Sjb#if !defined(_I32LPx) && defined(_KERNEL)
380179198Sjb#define	_I32LPx
381179198Sjb#endif
382179198Sjb#define	_SUNOS_VTOC_16
383179198Sjb#define	_DMA_USES_PHYSADDR
384179198Sjb#define	_FIRMWARE_NEEDS_FDISK
385179198Sjb#define	_PSM_MODULES
386179198Sjb#define	_RTC_CONFIG
387179198Sjb#define	_DONT_USE_1275_GENERIC_NAMES
388179198Sjb#define	_HAVE_CPUID_INSN
389179198Sjb
390185614Simp#elif defined(__mips__)
391185614Simp
392185614Simp/*
393185614Simp * Define the appropriate "processor characteristics"
394185614Simp */
395185614Simp#define	_STACK_GROWS_DOWNWARD
396185614Simp#define	_LONG_LONG_LTOH
397185614Simp#define	_BIT_FIELDS_LTOH
398185614Simp#define	_IEEE_754
399185614Simp#define	_CHAR_IS_SIGNED
400185614Simp#define	_BOOL_ALIGNMENT			1
401185614Simp#define	_CHAR_ALIGNMENT			1
402185614Simp#define	_SHORT_ALIGNMENT		2
403185614Simp#define	_INT_ALIGNMENT			4
404185614Simp#define	_FLOAT_ALIGNMENT		4
405185614Simp#define	_FLOAT_COMPLEX_ALIGNMENT	4
406185614Simp#define	_LONG_ALIGNMENT			4
407185614Simp#define	_LONG_LONG_ALIGNMENT		4
408185614Simp#define	_DOUBLE_ALIGNMENT		4
409185614Simp#define	_DOUBLE_COMPLEX_ALIGNMENT	4
410185614Simp#define	_LONG_DOUBLE_ALIGNMENT		4
411185614Simp#define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	4
412185614Simp#define	_POINTER_ALIGNMENT		4
413185614Simp#define	_MAX_ALIGNMENT			4
414185614Simp#define	_ALIGNMENT_REQUIRED		0
415185614Simp
416185614Simp#define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGNMENT
417185614Simp
418185614Simp/*
419185614Simp * Define the appropriate "implementation choices".
420185614Simp */
421185614Simp#define	_ILP32
422185614Simp#if !defined(_I32LPx) && defined(_KERNEL)
423185614Simp#define	_I32LPx
424185614Simp#endif
425185614Simp#define	_SUNOS_VTOC_16
426185614Simp#define	_DMA_USES_PHYSADDR
427185614Simp#define	_FIRMWARE_NEEDS_FDISK
428185614Simp#define	_PSM_MODULES
429185614Simp#define	_RTC_CONFIG
430185614Simp#define	_DONT_USE_1275_GENERIC_NAMES
431185614Simp#define	_HAVE_CPUID_INSN
432185614Simp
433179198Sjb#elif defined(__powerpc__)
434179198Sjb
435179198Sjb/*
436168404Spjd * The following set of definitions characterize the Solaris on SPARC systems.
437168404Spjd *
438168404Spjd * The symbol __sparc indicates any of the SPARC family of processor
439168404Spjd * architectures.  This includes SPARC V7, SPARC V8 and SPARC V9.
440168404Spjd *
441168404Spjd * The symbol __sparcv8 indicates the 32-bit SPARC V8 architecture as defined
442168404Spjd * by Version 8 of the SPARC Architecture Manual.  (SPARC V7 is close enough
443168404Spjd * to SPARC V8 for the former to be subsumed into the latter definition.)
444168404Spjd *
445168404Spjd * The symbol __sparcv9 indicates the 64-bit SPARC V9 architecture as defined
446168404Spjd * by Version 9 of the SPARC Architecture Manual.
447168404Spjd *
448168404Spjd * The symbols __sparcv8 and __sparcv9 are mutually exclusive, and are only
449168404Spjd * relevant when the symbol __sparc is defined.
450168404Spjd */
451168404Spjd/*
452168404Spjd * XXX Due to the existence of 5110166, "defined(__sparcv9)" needs to be added
453168404Spjd * to support backwards builds.  This workaround should be removed in s10_71.
454168404Spjd */
455168404Spjd#elif defined(__sparc) || defined(__sparcv9) || defined(__sparc__)
456168404Spjd#if !defined(__sparc)
457168404Spjd#define	__sparc
458168404Spjd#endif
459168404Spjd
460168404Spjd/*
461168404Spjd * You can be 32-bit or 64-bit, but not both at the same time.
462168404Spjd */
463168404Spjd#if defined(__sparcv8) && defined(__sparcv9)
464168404Spjd#error	"SPARC Versions 8 and 9 are mutually exclusive choices"
465168404Spjd#endif
466168404Spjd
467168404Spjd/*
468168404Spjd * Existing compilers do not set __sparcv8.  Years will transpire before
469168404Spjd * the compilers can be depended on to set the feature test macro. In
470168404Spjd * the interim, we'll set it here on the basis of historical behaviour;
471168404Spjd * if you haven't asked for SPARC V9, then you must've meant SPARC V8.
472168404Spjd */
473168404Spjd#if !defined(__sparcv9) && !defined(__sparcv8)
474168404Spjd#define	__sparcv8
475168404Spjd#endif
476168404Spjd
477168404Spjd/*
478168404Spjd * Define the appropriate "processor characteristics" shared between
479168404Spjd * all Solaris on SPARC systems.
480168404Spjd */
481174049Sjb#if defined(sun)
482168404Spjd#define	_BIG_ENDIAN
483174049Sjb#endif
484168404Spjd#define	_STACK_GROWS_DOWNWARD
485168404Spjd#define	_LONG_LONG_HTOL
486168404Spjd#define	_BIT_FIELDS_HTOL
487168404Spjd#define	_IEEE_754
488168404Spjd#define	_CHAR_IS_SIGNED
489168404Spjd#define	_BOOL_ALIGNMENT			1
490168404Spjd#define	_CHAR_ALIGNMENT			1
491168404Spjd#define	_SHORT_ALIGNMENT		2
492168404Spjd#define	_INT_ALIGNMENT			4
493168404Spjd#define	_FLOAT_ALIGNMENT		4
494168404Spjd#define	_FLOAT_COMPLEX_ALIGNMENT	4
495168404Spjd#define	_LONG_LONG_ALIGNMENT		8
496168404Spjd#define	_DOUBLE_ALIGNMENT		8
497168404Spjd#define	_DOUBLE_COMPLEX_ALIGNMENT	8
498168404Spjd#define	_ALIGNMENT_REQUIRED		1
499168404Spjd
500168404Spjd/*
501168404Spjd * Define the appropriate "implementation choices" shared between versions.
502168404Spjd */
503168404Spjd#define	_SUNOS_VTOC_8
504168404Spjd#define	_DMA_USES_VIRTADDR
505168404Spjd#define	_NO_FDISK_PRESENT
506168404Spjd#define	_HAVE_TEM_FIRMWARE
507179198Sjb#define	_OBP
508168404Spjd
509168404Spjd/*
510168404Spjd * The following set of definitions characterize the implementation of
511168404Spjd * 32-bit Solaris on SPARC V8 systems.
512168404Spjd */
513168404Spjd#if defined(__sparcv8)
514168404Spjd
515168404Spjd/*
516168404Spjd * Define the appropriate "processor characteristics"
517168404Spjd */
518168404Spjd#define	_LONG_ALIGNMENT			4
519168404Spjd#define	_LONG_DOUBLE_ALIGNMENT		8
520168404Spjd#define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	8
521168404Spjd#define	_POINTER_ALIGNMENT		4
522168404Spjd#define	_MAX_ALIGNMENT			8
523168404Spjd
524168404Spjd#define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGNMENT
525168404Spjd
526168404Spjd/*
527168404Spjd * Define the appropriate "implementation choices"
528168404Spjd */
529168404Spjd#define	_ILP32
530168404Spjd#if !defined(_I32LPx) && defined(_KERNEL)
531168404Spjd#define	_I32LPx
532168404Spjd#endif
533168404Spjd
534168404Spjd/*
535168404Spjd * The following set of definitions characterize the implementation of
536168404Spjd * 64-bit Solaris on SPARC V9 systems.
537168404Spjd */
538168404Spjd#elif defined(__sparcv9)
539168404Spjd
540168404Spjd/*
541168404Spjd * Define the appropriate "processor characteristics"
542168404Spjd */
543168404Spjd#define	_LONG_ALIGNMENT			8
544168404Spjd#define	_LONG_DOUBLE_ALIGNMENT		16
545168404Spjd#define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	16
546168404Spjd#define	_POINTER_ALIGNMENT		8
547168404Spjd#define	_MAX_ALIGNMENT			16
548168404Spjd
549185029Spjd#define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGNMENT
550168404Spjd
551168404Spjd/*
552168404Spjd * Define the appropriate "implementation choices"
553168404Spjd */
554168404Spjd#if !defined(_LP64)
555168404Spjd#define	_LP64
556168404Spjd#endif
557168404Spjd#if !defined(_I32LPx)
558168404Spjd#define	_I32LPx
559168404Spjd#endif
560168404Spjd#define	_MULTI_DATAMODEL
561168404Spjd
562168404Spjd#else
563168404Spjd#error	"unknown SPARC version"
564168404Spjd#endif
565168404Spjd
566168404Spjd/*
567168404Spjd * #error is strictly ansi-C, but works as well as anything for K&R systems.
568168404Spjd */
569168404Spjd#else
570168404Spjd#error "ISA not supported"
571168404Spjd#endif
572168404Spjd
573168404Spjd#if defined(_ILP32) && defined(_LP64)
574168404Spjd#error "Both _ILP32 and _LP64 are defined"
575168404Spjd#endif
576168404Spjd
577168404Spjd#ifdef	__cplusplus
578168404Spjd}
579168404Spjd#endif
580168404Spjd
581168404Spjd#endif	/* _SYS_ISA_DEFS_H */
582