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 */
225268351Smarcel#if defined(__x86_64) || defined(__amd64)
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 */
238277300Ssmh#ifdef illumos
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 */
305277300Ssmh#ifdef illumos
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 */
334274697Sdim#if !defined(_ILP32)
335168404Spjd#define	_ILP32
336274697Sdim#endif
337168404Spjd#if !defined(_I32LPx) && defined(_KERNEL)
338168404Spjd#define	_I32LPx
339168404Spjd#endif
340168404Spjd#define	_SUNOS_VTOC_16
341168404Spjd#define	_DMA_USES_PHYSADDR
342168404Spjd#define	_FIRMWARE_NEEDS_FDISK
343168404Spjd#define	_PSM_MODULES
344168404Spjd#define	_RTC_CONFIG
345185029Spjd#define	_SOFT_HOSTID
346168404Spjd#define	_DONT_USE_1275_GENERIC_NAMES
347168404Spjd#define	_HAVE_CPUID_INSN
348168404Spjd
349280951Sandrew#elif defined(__aarch64__)
350280951Sandrew
351280951Sandrew/*
352280951Sandrew * Define the appropriate "processor characteristics"
353280951Sandrew */
354280951Sandrew#define	_STACK_GROWS_DOWNWARD
355280951Sandrew#define	_LONG_LONG_LTOH
356280951Sandrew#define	_BIT_FIELDS_LTOH
357280951Sandrew#define	_IEEE_754
358280951Sandrew#define	_CHAR_IS_UNSIGNED
359280951Sandrew#define	_BOOL_ALIGNMENT			1
360280951Sandrew#define	_CHAR_ALIGNMENT			1
361280951Sandrew#define	_SHORT_ALIGNMENT		2
362280951Sandrew#define	_INT_ALIGNMENT			4
363280951Sandrew#define	_FLOAT_ALIGNMENT		4
364280951Sandrew#define	_FLOAT_COMPLEX_ALIGNMENT	4
365280951Sandrew#define	_LONG_ALIGNMENT			8
366280951Sandrew#define	_LONG_LONG_ALIGNMENT		8
367280951Sandrew#define	_DOUBLE_ALIGNMENT		8
368280951Sandrew#define	_DOUBLE_COMPLEX_ALIGNMENT	8
369280951Sandrew#define	_LONG_DOUBLE_ALIGNMENT		16
370280951Sandrew#define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	16
371280951Sandrew#define	_POINTER_ALIGNMENT		8
372280951Sandrew#define	_MAX_ALIGNMENT			16
373280951Sandrew#define	_ALIGNMENT_REQUIRED		1
374280951Sandrew
375280951Sandrew#define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGNMENT
376280951Sandrew
377280951Sandrew/*
378280951Sandrew * Define the appropriate "implementation choices"
379280951Sandrew */
380280951Sandrew#if !defined(_LP64)
381280951Sandrew#define	_LP64
382280951Sandrew#endif
383280951Sandrew#define	_SUNOS_VTOC_16
384280951Sandrew#define	_DMA_USES_PHYSADDR
385280951Sandrew#define	_FIRMWARE_NEEDS_FDISK
386280951Sandrew#define	_PSM_MODULES
387280951Sandrew#define	_RTC_CONFIG
388280951Sandrew#define	_DONT_USE_1275_GENERIC_NAMES
389280951Sandrew#define	_HAVE_CPUID_INSN
390280951Sandrew
391295041Sbr#elif defined(__riscv__)
392295041Sbr
393295041Sbr/*
394295041Sbr * Define the appropriate "processor characteristics"
395295041Sbr */
396295041Sbr#define	_STACK_GROWS_DOWNWARD
397295041Sbr#define	_LONG_LONG_LTOH
398295041Sbr#define	_BIT_FIELDS_LTOH
399295041Sbr#define	_IEEE_754
400295041Sbr#define	_CHAR_IS_UNSIGNED
401295041Sbr#define	_BOOL_ALIGNMENT			1
402295041Sbr#define	_CHAR_ALIGNMENT			1
403295041Sbr#define	_SHORT_ALIGNMENT		2
404295041Sbr#define	_INT_ALIGNMENT			4
405295041Sbr#define	_FLOAT_ALIGNMENT		4
406295041Sbr#define	_FLOAT_COMPLEX_ALIGNMENT	4
407295041Sbr#define	_LONG_ALIGNMENT			8
408295041Sbr#define	_LONG_LONG_ALIGNMENT		8
409295041Sbr#define	_DOUBLE_ALIGNMENT		8
410295041Sbr#define	_DOUBLE_COMPLEX_ALIGNMENT	8
411295041Sbr#define	_LONG_DOUBLE_ALIGNMENT		16
412295041Sbr#define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	16
413295041Sbr#define	_POINTER_ALIGNMENT		8
414295041Sbr#define	_MAX_ALIGNMENT			16
415295041Sbr#define	_ALIGNMENT_REQUIRED		1
416295041Sbr
417295041Sbr#define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGNMENT
418295041Sbr
419295041Sbr/*
420295041Sbr * Define the appropriate "implementation choices"
421295041Sbr */
422295041Sbr#if !defined(_LP64)
423295041Sbr#define	_LP64
424295041Sbr#endif
425295041Sbr#define	_SUNOS_VTOC_16
426295041Sbr#define	_DMA_USES_PHYSADDR
427295041Sbr#define	_FIRMWARE_NEEDS_FDISK
428295041Sbr#define	_PSM_MODULES
429295041Sbr#define	_RTC_CONFIG
430295041Sbr#define	_DONT_USE_1275_GENERIC_NAMES
431295041Sbr#define	_HAVE_CPUID_INSN
432295041Sbr
433179198Sjb#elif defined(__arm__)
434179198Sjb
435168404Spjd/*
436179198Sjb * Define the appropriate "processor characteristics"
437179198Sjb */
438179198Sjb#define	_STACK_GROWS_DOWNWARD
439179198Sjb#define	_LONG_LONG_LTOH
440179198Sjb#define	_BIT_FIELDS_LTOH
441179198Sjb#define	_IEEE_754
442179198Sjb#define	_CHAR_IS_SIGNED
443179198Sjb#define	_BOOL_ALIGNMENT			1
444179198Sjb#define	_CHAR_ALIGNMENT			1
445179198Sjb#define	_SHORT_ALIGNMENT		2
446179198Sjb#define	_INT_ALIGNMENT			4
447179198Sjb#define	_FLOAT_ALIGNMENT		4
448179198Sjb#define	_FLOAT_COMPLEX_ALIGNMENT	4
449179198Sjb#define	_LONG_ALIGNMENT			4
450179198Sjb#define	_LONG_LONG_ALIGNMENT		4
451179198Sjb#define	_DOUBLE_ALIGNMENT		4
452179198Sjb#define	_DOUBLE_COMPLEX_ALIGNMENT	4
453179198Sjb#define	_LONG_DOUBLE_ALIGNMENT		4
454179198Sjb#define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	4
455179198Sjb#define	_POINTER_ALIGNMENT		4
456179198Sjb#define	_MAX_ALIGNMENT			4
457179198Sjb#define	_ALIGNMENT_REQUIRED		0
458179198Sjb
459179198Sjb#define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGNMENT
460179198Sjb
461179198Sjb/*
462179198Sjb * Define the appropriate "implementation choices".
463179198Sjb */
464275565Sandrew#if !defined(_ILP32)
465179198Sjb#define	_ILP32
466275565Sandrew#endif
467179198Sjb#if !defined(_I32LPx) && defined(_KERNEL)
468179198Sjb#define	_I32LPx
469179198Sjb#endif
470179198Sjb#define	_SUNOS_VTOC_16
471179198Sjb#define	_DMA_USES_PHYSADDR
472179198Sjb#define	_FIRMWARE_NEEDS_FDISK
473179198Sjb#define	_PSM_MODULES
474179198Sjb#define	_RTC_CONFIG
475179198Sjb#define	_DONT_USE_1275_GENERIC_NAMES
476179198Sjb#define	_HAVE_CPUID_INSN
477179198Sjb
478185614Simp#elif defined(__mips__)
479185614Simp
480185614Simp/*
481185614Simp * Define the appropriate "processor characteristics"
482185614Simp */
483185614Simp#define	_STACK_GROWS_DOWNWARD
484185614Simp#define	_LONG_LONG_LTOH
485185614Simp#define	_BIT_FIELDS_LTOH
486185614Simp#define	_IEEE_754
487185614Simp#define	_CHAR_IS_SIGNED
488185614Simp#define	_BOOL_ALIGNMENT			1
489185614Simp#define	_CHAR_ALIGNMENT			1
490185614Simp#define	_SHORT_ALIGNMENT		2
491185614Simp#define	_INT_ALIGNMENT			4
492185614Simp#define	_FLOAT_ALIGNMENT		4
493185614Simp#define	_FLOAT_COMPLEX_ALIGNMENT	4
494211484Simp#if defined(__mips_n64)
495211484Simp#define	_LONG_ALIGNMENT			8
496211484Simp#define	_LONG_LONG_ALIGNMENT		8
497211484Simp#define	_DOUBLE_ALIGNMENT		8
498211484Simp#define	_DOUBLE_COMPLEX_ALIGNMENT	8
499211484Simp#define	_LONG_DOUBLE_ALIGNMENT		8
500211484Simp#define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	8
501211484Simp#define	_POINTER_ALIGNMENT		8
502211484Simp#define	_MAX_ALIGNMENT			8
503211484Simp#define	_ALIGNMENT_REQUIRED		0
504211484Simp
505211484Simp#define	_LONG_LONG_ALIGNMENT_32		_INT_ALIGNMENT
506211484Simp/*
507211484Simp * Define the appropriate "implementation choices".
508211484Simp */
509211484Simp#if !defined(_LP64)
510211484Simp#define	_LP64
511211484Simp#endif
512211484Simp#else
513185614Simp#define	_LONG_ALIGNMENT			4
514185614Simp#define	_LONG_LONG_ALIGNMENT		4
515185614Simp#define	_DOUBLE_ALIGNMENT		4
516185614Simp#define	_DOUBLE_COMPLEX_ALIGNMENT	4
517185614Simp#define	_LONG_DOUBLE_ALIGNMENT		4
518185614Simp#define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	4
519185614Simp#define	_POINTER_ALIGNMENT		4
520185614Simp#define	_MAX_ALIGNMENT			4
521185614Simp#define	_ALIGNMENT_REQUIRED		0
522185614Simp
523185614Simp#define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGNMENT
524185614Simp
525185614Simp/*
526185614Simp * Define the appropriate "implementation choices".
527185614Simp */
528185614Simp#define	_ILP32
529185614Simp#if !defined(_I32LPx) && defined(_KERNEL)
530185614Simp#define	_I32LPx
531185614Simp#endif
532211484Simp#endif
533185614Simp#define	_SUNOS_VTOC_16
534185614Simp#define	_DMA_USES_PHYSADDR
535185614Simp#define	_FIRMWARE_NEEDS_FDISK
536185614Simp#define	_PSM_MODULES
537185614Simp#define	_RTC_CONFIG
538185614Simp#define	_DONT_USE_1275_GENERIC_NAMES
539185614Simp#define	_HAVE_CPUID_INSN
540185614Simp
541179198Sjb#elif defined(__powerpc__)
542179198Sjb
543219089Spjd#if defined(__BIG_ENDIAN__)
544219089Spjd#define _BIT_FIELDS_HTOL
545219089Spjd#else
546219089Spjd#define _BIT_FIELDS_LTOH
547219089Spjd#endif
548219089Spjd
549179198Sjb/*
550168404Spjd * The following set of definitions characterize the Solaris on SPARC systems.
551168404Spjd *
552168404Spjd * The symbol __sparc indicates any of the SPARC family of processor
553168404Spjd * architectures.  This includes SPARC V7, SPARC V8 and SPARC V9.
554168404Spjd *
555168404Spjd * The symbol __sparcv8 indicates the 32-bit SPARC V8 architecture as defined
556168404Spjd * by Version 8 of the SPARC Architecture Manual.  (SPARC V7 is close enough
557168404Spjd * to SPARC V8 for the former to be subsumed into the latter definition.)
558168404Spjd *
559168404Spjd * The symbol __sparcv9 indicates the 64-bit SPARC V9 architecture as defined
560168404Spjd * by Version 9 of the SPARC Architecture Manual.
561168404Spjd *
562168404Spjd * The symbols __sparcv8 and __sparcv9 are mutually exclusive, and are only
563168404Spjd * relevant when the symbol __sparc is defined.
564168404Spjd */
565168404Spjd/*
566168404Spjd * XXX Due to the existence of 5110166, "defined(__sparcv9)" needs to be added
567168404Spjd * to support backwards builds.  This workaround should be removed in s10_71.
568168404Spjd */
569168404Spjd#elif defined(__sparc) || defined(__sparcv9) || defined(__sparc__)
570168404Spjd#if !defined(__sparc)
571168404Spjd#define	__sparc
572168404Spjd#endif
573168404Spjd
574168404Spjd/*
575168404Spjd * You can be 32-bit or 64-bit, but not both at the same time.
576168404Spjd */
577168404Spjd#if defined(__sparcv8) && defined(__sparcv9)
578168404Spjd#error	"SPARC Versions 8 and 9 are mutually exclusive choices"
579168404Spjd#endif
580168404Spjd
581168404Spjd/*
582168404Spjd * Existing compilers do not set __sparcv8.  Years will transpire before
583168404Spjd * the compilers can be depended on to set the feature test macro. In
584168404Spjd * the interim, we'll set it here on the basis of historical behaviour;
585168404Spjd * if you haven't asked for SPARC V9, then you must've meant SPARC V8.
586168404Spjd */
587168404Spjd#if !defined(__sparcv9) && !defined(__sparcv8)
588168404Spjd#define	__sparcv8
589168404Spjd#endif
590168404Spjd
591168404Spjd/*
592168404Spjd * Define the appropriate "processor characteristics" shared between
593168404Spjd * all Solaris on SPARC systems.
594168404Spjd */
595277300Ssmh#ifdef illumos
596168404Spjd#define	_BIG_ENDIAN
597174049Sjb#endif
598168404Spjd#define	_STACK_GROWS_DOWNWARD
599168404Spjd#define	_LONG_LONG_HTOL
600168404Spjd#define	_BIT_FIELDS_HTOL
601168404Spjd#define	_IEEE_754
602168404Spjd#define	_CHAR_IS_SIGNED
603168404Spjd#define	_BOOL_ALIGNMENT			1
604168404Spjd#define	_CHAR_ALIGNMENT			1
605168404Spjd#define	_SHORT_ALIGNMENT		2
606168404Spjd#define	_INT_ALIGNMENT			4
607168404Spjd#define	_FLOAT_ALIGNMENT		4
608168404Spjd#define	_FLOAT_COMPLEX_ALIGNMENT	4
609168404Spjd#define	_LONG_LONG_ALIGNMENT		8
610168404Spjd#define	_DOUBLE_ALIGNMENT		8
611168404Spjd#define	_DOUBLE_COMPLEX_ALIGNMENT	8
612168404Spjd#define	_ALIGNMENT_REQUIRED		1
613168404Spjd
614168404Spjd/*
615168404Spjd * Define the appropriate "implementation choices" shared between versions.
616168404Spjd */
617168404Spjd#define	_SUNOS_VTOC_8
618168404Spjd#define	_DMA_USES_VIRTADDR
619168404Spjd#define	_NO_FDISK_PRESENT
620168404Spjd#define	_HAVE_TEM_FIRMWARE
621179198Sjb#define	_OBP
622168404Spjd
623168404Spjd/*
624168404Spjd * The following set of definitions characterize the implementation of
625168404Spjd * 32-bit Solaris on SPARC V8 systems.
626168404Spjd */
627168404Spjd#if defined(__sparcv8)
628168404Spjd
629168404Spjd/*
630168404Spjd * Define the appropriate "processor characteristics"
631168404Spjd */
632168404Spjd#define	_LONG_ALIGNMENT			4
633168404Spjd#define	_LONG_DOUBLE_ALIGNMENT		8
634168404Spjd#define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	8
635168404Spjd#define	_POINTER_ALIGNMENT		4
636168404Spjd#define	_MAX_ALIGNMENT			8
637168404Spjd
638168404Spjd#define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGNMENT
639168404Spjd
640168404Spjd/*
641168404Spjd * Define the appropriate "implementation choices"
642168404Spjd */
643168404Spjd#define	_ILP32
644168404Spjd#if !defined(_I32LPx) && defined(_KERNEL)
645168404Spjd#define	_I32LPx
646168404Spjd#endif
647168404Spjd
648168404Spjd/*
649168404Spjd * The following set of definitions characterize the implementation of
650168404Spjd * 64-bit Solaris on SPARC V9 systems.
651168404Spjd */
652168404Spjd#elif defined(__sparcv9)
653168404Spjd
654168404Spjd/*
655168404Spjd * Define the appropriate "processor characteristics"
656168404Spjd */
657168404Spjd#define	_LONG_ALIGNMENT			8
658168404Spjd#define	_LONG_DOUBLE_ALIGNMENT		16
659168404Spjd#define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	16
660168404Spjd#define	_POINTER_ALIGNMENT		8
661168404Spjd#define	_MAX_ALIGNMENT			16
662168404Spjd
663185029Spjd#define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGNMENT
664168404Spjd
665168404Spjd/*
666168404Spjd * Define the appropriate "implementation choices"
667168404Spjd */
668168404Spjd#if !defined(_LP64)
669168404Spjd#define	_LP64
670168404Spjd#endif
671168404Spjd#if !defined(_I32LPx)
672168404Spjd#define	_I32LPx
673168404Spjd#endif
674168404Spjd#define	_MULTI_DATAMODEL
675168404Spjd
676168404Spjd#else
677168404Spjd#error	"unknown SPARC version"
678168404Spjd#endif
679168404Spjd
680168404Spjd/*
681168404Spjd * #error is strictly ansi-C, but works as well as anything for K&R systems.
682168404Spjd */
683168404Spjd#else
684168404Spjd#error "ISA not supported"
685168404Spjd#endif
686168404Spjd
687168404Spjd#if defined(_ILP32) && defined(_LP64)
688168404Spjd#error "Both _ILP32 and _LP64 are defined"
689168404Spjd#endif
690168404Spjd
691168404Spjd#ifdef	__cplusplus
692168404Spjd}
693168404Spjd#endif
694168404Spjd
695168404Spjd#endif	/* _SYS_ISA_DEFS_H */
696