17c478bdstevel@tonic-gate/*
27c478bdstevel@tonic-gate * CDDL HEADER START
37c478bdstevel@tonic-gate *
47c478bdstevel@tonic-gate * The contents of this file are subject to the terms of the
5fea9cb9lq * Common Development and Distribution License (the "License").
6fea9cb9lq * You may not use this file except in compliance with the License.
77c478bdstevel@tonic-gate *
87c478bdstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bdstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bdstevel@tonic-gate * See the License for the specific language governing permissions
117c478bdstevel@tonic-gate * and limitations under the License.
127c478bdstevel@tonic-gate *
13ed5289fKen Erickson *
147c478bdstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
157c478bdstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bdstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
177c478bdstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
187c478bdstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bdstevel@tonic-gate *
207c478bdstevel@tonic-gate * CDDL HEADER END
217c478bdstevel@tonic-gate */
22fea9cb9lq
237c478bdstevel@tonic-gate/*
24b4b6080Roger A. Faulkner * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
257c478bdstevel@tonic-gate * Use is subject to license terms.
26fc2512cRobert Mustacchi * Copyright 2016 Joyent, Inc.
277c478bdstevel@tonic-gate */
287c478bdstevel@tonic-gate
297c478bdstevel@tonic-gate#ifndef	_SYS_ISA_DEFS_H
307c478bdstevel@tonic-gate#define	_SYS_ISA_DEFS_H
317c478bdstevel@tonic-gate
327c478bdstevel@tonic-gate/*
337c478bdstevel@tonic-gate * This header file serves to group a set of well known defines and to
347c478bdstevel@tonic-gate * set these for each instruction set architecture.  These defines may
357c478bdstevel@tonic-gate * be divided into two groups;  characteristics of the processor and
367c478bdstevel@tonic-gate * implementation choices for Solaris on a processor.
377c478bdstevel@tonic-gate *
387c478bdstevel@tonic-gate * Processor Characteristics:
397c478bdstevel@tonic-gate *
407c478bdstevel@tonic-gate * _LITTLE_ENDIAN / _BIG_ENDIAN:
417c478bdstevel@tonic-gate *	The natural byte order of the processor.  A pointer to an int points
427c478bdstevel@tonic-gate *	to the least/most significant byte of that int.
437c478bdstevel@tonic-gate *
447c478bdstevel@tonic-gate * _STACK_GROWS_UPWARD / _STACK_GROWS_DOWNWARD:
457c478bdstevel@tonic-gate *	The processor specific direction of stack growth.  A push onto the
467c478bdstevel@tonic-gate *	stack increases/decreases the stack pointer, so it stores data at
477c478bdstevel@tonic-gate *	successively higher/lower addresses.  (Stackless machines ignored
487c478bdstevel@tonic-gate *	without regrets).
497c478bdstevel@tonic-gate *
507c478bdstevel@tonic-gate * _LONG_LONG_HTOL / _LONG_LONG_LTOH:
517c478bdstevel@tonic-gate *	A pointer to a long long points to the most/least significant long
527c478bdstevel@tonic-gate *	within that long long.
537c478bdstevel@tonic-gate *
547c478bdstevel@tonic-gate * _BIT_FIELDS_HTOL / _BIT_FIELDS_LTOH:
557c478bdstevel@tonic-gate *	The C compiler assigns bit fields from the high/low to the low/high end
567c478bdstevel@tonic-gate *	of an int (most to least significant vs. least to most significant).
577c478bdstevel@tonic-gate *
587c478bdstevel@tonic-gate * _IEEE_754:
597c478bdstevel@tonic-gate *	The processor (or supported implementations of the processor)
607c478bdstevel@tonic-gate *	supports the ieee-754 floating point standard.  No other floating
617c478bdstevel@tonic-gate *	point standards are supported (or significant).  Any other supported
627c478bdstevel@tonic-gate *	floating point formats are expected to be cased on the ISA processor
637c478bdstevel@tonic-gate *	symbol.
647c478bdstevel@tonic-gate *
657c478bdstevel@tonic-gate * _CHAR_IS_UNSIGNED / _CHAR_IS_SIGNED:
667c478bdstevel@tonic-gate *	The C Compiler implements objects of type `char' as `unsigned' or
677c478bdstevel@tonic-gate *	`signed' respectively.  This is really an implementation choice of
687c478bdstevel@tonic-gate *	the compiler writer, but it is specified in the ABI and tends to
697c478bdstevel@tonic-gate *	be uniform across compilers for an instruction set architecture.
707c478bdstevel@tonic-gate *	Hence, it has the properties of a processor characteristic.
717c478bdstevel@tonic-gate *
727c478bdstevel@tonic-gate * _CHAR_ALIGNMENT / _SHORT_ALIGNMENT / _INT_ALIGNMENT / _LONG_ALIGNMENT /
737c478bdstevel@tonic-gate * _LONG_LONG_ALIGNMENT / _DOUBLE_ALIGNMENT / _LONG_DOUBLE_ALIGNMENT /
747c478bdstevel@tonic-gate * _POINTER_ALIGNMENT / _FLOAT_ALIGNMENT:
757c478bdstevel@tonic-gate *	The ABI defines alignment requirements of each of the primitive
767c478bdstevel@tonic-gate *	object types.  Some, if not all, may be hardware requirements as
777c478bdstevel@tonic-gate * 	well.  The values are expressed in "byte-alignment" units.
787c478bdstevel@tonic-gate *
797c478bdstevel@tonic-gate * _MAX_ALIGNMENT:
807c478bdstevel@tonic-gate *	The most stringent alignment requirement as specified by the ABI.
817c478bdstevel@tonic-gate *	Equal to the maximum of all the above _XXX_ALIGNMENT values.
827c478bdstevel@tonic-gate *
83fc2512cRobert Mustacchi * _MAX_ALIGNMENT_TYPE:
84fc2512cRobert Mustacchi * 	The name of the C type that has the value descried in _MAX_ALIGNMENT.
85fc2512cRobert Mustacchi *
867c478bdstevel@tonic-gate * _ALIGNMENT_REQUIRED:
877c478bdstevel@tonic-gate *	True or false (1 or 0) whether or not the hardware requires the ABI
887c478bdstevel@tonic-gate *	alignment.
897c478bdstevel@tonic-gate *
907c478bdstevel@tonic-gate * _LONG_LONG_ALIGNMENT_32
917c478bdstevel@tonic-gate *	The 32-bit ABI supported by a 64-bit kernel may have different
927c478bdstevel@tonic-gate *	alignment requirements for primitive object types.  The value of this
937c478bdstevel@tonic-gate *	identifier is expressed in "byte-alignment" units.
947c478bdstevel@tonic-gate *
957c478bdstevel@tonic-gate * _HAVE_CPUID_INSN
967c478bdstevel@tonic-gate *	This indicates that the architecture supports the 'cpuid'
977c478bdstevel@tonic-gate *	instruction as defined by Intel.  (Intel allows other vendors
987c478bdstevel@tonic-gate *	to extend the instruction for their own purposes.)
997c478bdstevel@tonic-gate *
1007c478bdstevel@tonic-gate *
1017c478bdstevel@tonic-gate * Implementation Choices:
1027c478bdstevel@tonic-gate *
1037c478bdstevel@tonic-gate * _ILP32 / _LP64:
1047c478bdstevel@tonic-gate *	This specifies the compiler data type implementation as specified in
1057c478bdstevel@tonic-gate *	the relevant ABI.  The choice between these is strongly influenced
1067c478bdstevel@tonic-gate *	by the underlying hardware, but is not absolutely tied to it.
1077c478bdstevel@tonic-gate *	Currently only two data type models are supported:
1087c478bdstevel@tonic-gate *
1097c478bdstevel@tonic-gate *	_ILP32:
1107c478bdstevel@tonic-gate *		Int/Long/Pointer are 32 bits.  This is the historical UNIX
1117c478bdstevel@tonic-gate *		and Solaris implementation.  Due to its historical standing,
1127c478bdstevel@tonic-gate *		this is the default case.
1137c478bdstevel@tonic-gate *
1147c478bdstevel@tonic-gate *	_LP64:
1157c478bdstevel@tonic-gate *		Long/Pointer are 64 bits, Int is 32 bits.  This is the chosen
1167c478bdstevel@tonic-gate *		implementation for 64-bit ABIs such as SPARC V9.
1177c478bdstevel@tonic-gate *
1187c478bdstevel@tonic-gate *	_I32LPx:
1197c478bdstevel@tonic-gate *		A compilation environment where 'int' is 32-bit, and
1207c478bdstevel@tonic-gate *		longs and pointers are simply the same size.
1217c478bdstevel@tonic-gate *
1227c478bdstevel@tonic-gate *	In all cases, Char is 8 bits and Short is 16 bits.
1237c478bdstevel@tonic-gate *
1247c478bdstevel@tonic-gate * _SUNOS_VTOC_8 / _SUNOS_VTOC_16 / _SVR4_VTOC_16:
1257c478bdstevel@tonic-gate *	This specifies the form of the disk VTOC (or label):
1267c478bdstevel@tonic-gate *
1277c478bdstevel@tonic-gate *	_SUNOS_VTOC_8:
1287c478bdstevel@tonic-gate *		This is a VTOC form which is upwardly compatible with the
1297c478bdstevel@tonic-gate *		SunOS 4.x disk label and allows 8 partitions per disk.
1307c478bdstevel@tonic-gate *
1317c478bdstevel@tonic-gate *	_SUNOS_VTOC_16:
1327c478bdstevel@tonic-gate *		In this format the incore vtoc image matches the ondisk
1337c478bdstevel@tonic-gate *		version.  It allows 16 slices per disk, and is not
1347c478bdstevel@tonic-gate *		compatible with the SunOS 4.x disk label.
1357c478bdstevel@tonic-gate *
1367c478bdstevel@tonic-gate *	Note that these are not the only two VTOC forms possible and
1377c478bdstevel@tonic-gate *	additional forms may be added.  One possible form would be the
1387c478bdstevel@tonic-gate *	SVr4 VTOC form.  The symbol for that is reserved now, although
1397c478bdstevel@tonic-gate *	it is not implemented.
1407c478bdstevel@tonic-gate *
1417c478bdstevel@tonic-gate *	_SVR4_VTOC_16:
1427c478bdstevel@tonic-gate *		This VTOC form is compatible with the System V Release 4
1437c478bdstevel@tonic-gate *		VTOC (as implemented on the SVr4 Intel and 3b ports) with
1447c478bdstevel@tonic-gate *		16 partitions per disk.
1457c478bdstevel@tonic-gate *
1467c478bdstevel@tonic-gate *
1477c478bdstevel@tonic-gate * _DMA_USES_PHYSADDR / _DMA_USES_VIRTADDR
1487c478bdstevel@tonic-gate *	This describes the type of addresses used by system DMA:
1497c478bdstevel@tonic-gate *
1507c478bdstevel@tonic-gate *	_DMA_USES_PHYSADDR:
1517c478bdstevel@tonic-gate *		This type of DMA, used in the x86 implementation,
1527c478bdstevel@tonic-gate *		requires physical addresses for DMA buffers.  The 24-bit
1537c478bdstevel@tonic-gate *		addresses used by some legacy boards is the source of the
1547c478bdstevel@tonic-gate *		"low-memory" (<16MB) requirement for some devices using DMA.
1557c478bdstevel@tonic-gate *
1567c478bdstevel@tonic-gate *	_DMA_USES_VIRTADDR:
1577c478bdstevel@tonic-gate *		This method of DMA allows the use of virtual addresses for
1587c478bdstevel@tonic-gate *		DMA transfers.
1597c478bdstevel@tonic-gate *
1607c478bdstevel@tonic-gate * _FIRMWARE_NEEDS_FDISK / _NO_FDISK_PRESENT
1617c478bdstevel@tonic-gate *      This indicates the presence/absence of an fdisk table.
1627c478bdstevel@tonic-gate *
1637c478bdstevel@tonic-gate *      _FIRMWARE_NEEDS_FDISK
1647c478bdstevel@tonic-gate *              The fdisk table is required by system firmware.  If present,
1657c478bdstevel@tonic-gate *              it allows a disk to be subdivided into multiple fdisk
1667c478bdstevel@tonic-gate *              partitions, each of which is equivalent to a separate,
1677c478bdstevel@tonic-gate *              virtual disk.  This enables the co-existence of multiple
1687c478bdstevel@tonic-gate *              operating systems on a shared hard disk.
1697c478bdstevel@tonic-gate *
1707c478bdstevel@tonic-gate *      _NO_FDISK_PRESENT
1717c478bdstevel@tonic-gate *              If the fdisk table is absent, it is assumed that the entire
1727c478bdstevel@tonic-gate *              media is allocated for a single operating system.
1737c478bdstevel@tonic-gate *
174fea9cb9lq * _HAVE_TEM_FIRMWARE
175fea9cb9lq *	Defined if this architecture has the (fallback) option of
176fea9cb9lq *	using prom_* calls for doing I/O if a suitable kernel driver
177fea9cb9lq *	is not available to do it.
1787c478bdstevel@tonic-gate *
179fea9cb9lq * _DONT_USE_1275_GENERIC_NAMES
1807c478bdstevel@tonic-gate *		Controls whether or not device tree node names should
1817c478bdstevel@tonic-gate *		comply with the IEEE 1275 "Generic Names" Recommended
1827c478bdstevel@tonic-gate *		Practice. With _DONT_USE_GENERIC_NAMES, device-specific
1837c478bdstevel@tonic-gate *		names identifying the particular device will be used.
1847c478bdstevel@tonic-gate *
1857c478bdstevel@tonic-gate * __i386_COMPAT
1867c478bdstevel@tonic-gate *	This indicates whether the i386 ABI is supported as a *non-native*
1877c478bdstevel@tonic-gate *	mode for the platform.  When this symbol is defined:
1887c478bdstevel@tonic-gate *	-	32-bit xstat-style system calls are enabled
1897c478bdstevel@tonic-gate *	-	32-bit xmknod-style system calls are enabled
1907c478bdstevel@tonic-gate *	-	32-bit system calls use i386 sizes -and- alignments
1917c478bdstevel@tonic-gate *
1927c478bdstevel@tonic-gate *	Note that this is NOT defined for the i386 native environment!
1937c478bdstevel@tonic-gate *
1947c478bdstevel@tonic-gate * __x86
1957c478bdstevel@tonic-gate *	This is ONLY a synonym for defined(__i386) || defined(__amd64)
1967c478bdstevel@tonic-gate *	which is useful only insofar as these two architectures share
1977c478bdstevel@tonic-gate *	common attributes.  Analogous to __sparc.
1987c478bdstevel@tonic-gate *
1997c478bdstevel@tonic-gate * _PSM_MODULES
2007c478bdstevel@tonic-gate *	This indicates whether or not the implementation uses PSM
2017c478bdstevel@tonic-gate *	modules for processor support, reading /etc/mach from inside
2027c478bdstevel@tonic-gate *	the kernel to extract a list.
2037c478bdstevel@tonic-gate *
2047c478bdstevel@tonic-gate * _RTC_CONFIG
2057c478bdstevel@tonic-gate *	This indicates whether or not the implementation uses /etc/rtc_config
2067c478bdstevel@tonic-gate *	to configure the real-time clock in the kernel.
207ae115bcmrj *
208ae115bcmrj * _UNIX_KRTLD
209ae115bcmrj *	This indicates that the implementation uses a dynamically
210ae115bcmrj *	linked unix + krtld to form the core kernel image at boot
211ae115bcmrj *	time, or (in the absence of this symbol) a prelinked kernel image.
212986fd29setje *
213986fd29setje * _OBP
214986fd29setje *	This indicates the firmware interface is OBP.
215ed5289fKen Erickson *
216ed5289fKen Erickson * _SOFT_HOSTID
217ed5289fKen Erickson *	This indicates that the implementation obtains the hostid
218ed5289fKen Erickson *	from the file /etc/hostid, rather than from hardware.
2197c478bdstevel@tonic-gate */
2207c478bdstevel@tonic-gate
2217c478bdstevel@tonic-gate#ifdef	__cplusplus
2227c478bdstevel@tonic-gateextern "C" {
2237c478bdstevel@tonic-gate#endif
2247c478bdstevel@tonic-gate
2257c478bdstevel@tonic-gate/*
2267c478bdstevel@tonic-gate * The following set of definitions characterize Solaris on AMD's
2277c478bdstevel@tonic-gate * 64-bit systems.
2287c478bdstevel@tonic-gate */
229c2e7b48kalai#if defined(__x86_64) || defined(__amd64)
2307c478bdstevel@tonic-gate
2317c478bdstevel@tonic-gate#if !defined(__amd64)
2327c478bdstevel@tonic-gate#define	__amd64		/* preferred guard */
2337c478bdstevel@tonic-gate#endif
2347c478bdstevel@tonic-gate
2357c478bdstevel@tonic-gate#if !defined(__x86)
2367c478bdstevel@tonic-gate#define	__x86
2377c478bdstevel@tonic-gate#endif
2387c478bdstevel@tonic-gate
2397c478bdstevel@tonic-gate/*
2407c478bdstevel@tonic-gate * Define the appropriate "processor characteristics"
2417c478bdstevel@tonic-gate */
2427c478bdstevel@tonic-gate#define	_LITTLE_ENDIAN
2437c478bdstevel@tonic-gate#define	_STACK_GROWS_DOWNWARD
2447c478bdstevel@tonic-gate#define	_LONG_LONG_LTOH
2457c478bdstevel@tonic-gate#define	_BIT_FIELDS_LTOH
2467c478bdstevel@tonic-gate#define	_IEEE_754
2477c478bdstevel@tonic-gate#define	_CHAR_IS_SIGNED
2487c478bdstevel@tonic-gate#define	_BOOL_ALIGNMENT			1
2497c478bdstevel@tonic-gate#define	_CHAR_ALIGNMENT			1
2507c478bdstevel@tonic-gate#define	_SHORT_ALIGNMENT		2
2517c478bdstevel@tonic-gate#define	_INT_ALIGNMENT			4
2527c478bdstevel@tonic-gate#define	_FLOAT_ALIGNMENT		4
2537c478bdstevel@tonic-gate#define	_FLOAT_COMPLEX_ALIGNMENT	4
2547c478bdstevel@tonic-gate#define	_LONG_ALIGNMENT			8
2557c478bdstevel@tonic-gate#define	_LONG_LONG_ALIGNMENT		8
2567c478bdstevel@tonic-gate#define	_DOUBLE_ALIGNMENT		8
2577c478bdstevel@tonic-gate#define	_DOUBLE_COMPLEX_ALIGNMENT	8
2587c478bdstevel@tonic-gate#define	_LONG_DOUBLE_ALIGNMENT		16
2597c478bdstevel@tonic-gate#define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	16
2607c478bdstevel@tonic-gate#define	_POINTER_ALIGNMENT		8
2617c478bdstevel@tonic-gate#define	_MAX_ALIGNMENT			16
2627c478bdstevel@tonic-gate#define	_ALIGNMENT_REQUIRED		1
263fc2512cRobert Mustacchi#define	_MAX_ALIGNMENT_TYPE		long double
2647c478bdstevel@tonic-gate
2657c478bdstevel@tonic-gate/*
2667c478bdstevel@tonic-gate * Different alignment constraints for the i386 ABI in compatibility mode
2677c478bdstevel@tonic-gate */
2687c478bdstevel@tonic-gate#define	_LONG_LONG_ALIGNMENT_32		4
2697c478bdstevel@tonic-gate
2707c478bdstevel@tonic-gate/*
2717c478bdstevel@tonic-gate * Define the appropriate "implementation choices".
2727c478bdstevel@tonic-gate */
2737c478bdstevel@tonic-gate#if !defined(_LP64)
2747c478bdstevel@tonic-gate#define	_LP64
2757c478bdstevel@tonic-gate#endif
2767c478bdstevel@tonic-gate#if !defined(_I32LPx) && defined(_KERNEL)
2777c478bdstevel@tonic-gate#define	_I32LPx
2787c478bdstevel@tonic-gate#endif
2797c478bdstevel@tonic-gate#define	_MULTI_DATAMODEL
2807c478bdstevel@tonic-gate#define	_SUNOS_VTOC_16
2817c478bdstevel@tonic-gate#define	_DMA_USES_PHYSADDR
2827c478bdstevel@tonic-gate#define	_FIRMWARE_NEEDS_FDISK
2837c478bdstevel@tonic-gate#define	__i386_COMPAT
2847c478bdstevel@tonic-gate#define	_PSM_MODULES
2857c478bdstevel@tonic-gate#define	_RTC_CONFIG
286ed5289fKen Erickson#define	_SOFT_HOSTID
2877c478bdstevel@tonic-gate#define	_DONT_USE_1275_GENERIC_NAMES
2887c478bdstevel@tonic-gate#define	_HAVE_CPUID_INSN
2897c478bdstevel@tonic-gate
2907c478bdstevel@tonic-gate/*
2917c478bdstevel@tonic-gate * The feature test macro __i386 is generic for all processors implementing
2927c478bdstevel@tonic-gate * the Intel 386 instruction set or a superset of it.  Specifically, this
2937c478bdstevel@tonic-gate * includes all members of the 386, 486, and Pentium family of processors.
2947c478bdstevel@tonic-gate */
2957c478bdstevel@tonic-gate#elif defined(__i386) || defined(__i386__)
2967c478bdstevel@tonic-gate
2977c478bdstevel@tonic-gate#if !defined(__i386)
2987c478bdstevel@tonic-gate#define	__i386
2997c478bdstevel@tonic-gate#endif
3007c478bdstevel@tonic-gate
3017c478bdstevel@tonic-gate#if !defined(__x86)
3027c478bdstevel@tonic-gate#define	__x86
3037c478bdstevel@tonic-gate#endif
3047c478bdstevel@tonic-gate
3057c478bdstevel@tonic-gate/*
3067c478bdstevel@tonic-gate * Define the appropriate "processor characteristics"
3077c478bdstevel@tonic-gate */
3087c478bdstevel@tonic-gate#define	_LITTLE_ENDIAN
3097c478bdstevel@tonic-gate#define	_STACK_GROWS_DOWNWARD
3107c478bdstevel@tonic-gate#define	_LONG_LONG_LTOH
3117c478bdstevel@tonic-gate#define	_BIT_FIELDS_LTOH
3127c478bdstevel@tonic-gate#define	_IEEE_754
3137c478bdstevel@tonic-gate#define	_CHAR_IS_SIGNED
3147c478bdstevel@tonic-gate#define	_BOOL_ALIGNMENT			1
3157c478bdstevel@tonic-gate#define	_CHAR_ALIGNMENT			1
3167c478bdstevel@tonic-gate#define	_SHORT_ALIGNMENT		2
3177c478bdstevel@tonic-gate#define	_INT_ALIGNMENT			4
3187c478bdstevel@tonic-gate#define	_FLOAT_ALIGNMENT		4
3197c478bdstevel@tonic-gate#define	_FLOAT_COMPLEX_ALIGNMENT	4
3207c478bdstevel@tonic-gate#define	_LONG_ALIGNMENT			4
3217c478bdstevel@tonic-gate#define	_LONG_LONG_ALIGNMENT		4
3227c478bdstevel@tonic-gate#define	_DOUBLE_ALIGNMENT		4
3237c478bdstevel@tonic-gate#define	_DOUBLE_COMPLEX_ALIGNMENT	4
3247c478bdstevel@tonic-gate#define	_LONG_DOUBLE_ALIGNMENT		4
3257c478bdstevel@tonic-gate#define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	4
3267c478bdstevel@tonic-gate#define	_POINTER_ALIGNMENT		4
3277c478bdstevel@tonic-gate#define	_MAX_ALIGNMENT			4
3287c478bdstevel@tonic-gate#define	_ALIGNMENT_REQUIRED		0
329fc2512cRobert Mustacchi#define	_MAX_ALIGNMENT_TYPE		long
3307c478bdstevel@tonic-gate
3317c478bdstevel@tonic-gate#define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGNMENT
3327c478bdstevel@tonic-gate
3337c478bdstevel@tonic-gate/*
3347c478bdstevel@tonic-gate * Define the appropriate "implementation choices".
3357c478bdstevel@tonic-gate */
336d643a85Yuri Pankov#if !defined(_ILP32)
3377c478bdstevel@tonic-gate#define	_ILP32
338d643a85Yuri Pankov#endif
3397c478bdstevel@tonic-gate#if !defined(_I32LPx) && defined(_KERNEL)
3407c478bdstevel@tonic-gate#define	_I32LPx
3417c478bdstevel@tonic-gate#endif
3427c478bdstevel@tonic-gate#define	_SUNOS_VTOC_16
3437c478bdstevel@tonic-gate#define	_DMA_USES_PHYSADDR
3447c478bdstevel@tonic-gate#define	_FIRMWARE_NEEDS_FDISK
3457c478bdstevel@tonic-gate#define	_PSM_MODULES
3467c478bdstevel@tonic-gate#define	_RTC_CONFIG
347ed5289fKen Erickson#define	_SOFT_HOSTID
3487c478bdstevel@tonic-gate#define	_DONT_USE_1275_GENERIC_NAMES
3497c478bdstevel@tonic-gate#define	_HAVE_CPUID_INSN
3507c478bdstevel@tonic-gate
3517c478bdstevel@tonic-gate/*
3527c478bdstevel@tonic-gate * The following set of definitions characterize the Solaris on SPARC systems.
3537c478bdstevel@tonic-gate *
3547c478bdstevel@tonic-gate * The symbol __sparc indicates any of the SPARC family of processor
3557c478bdstevel@tonic-gate * architectures.  This includes SPARC V7, SPARC V8 and SPARC V9.
3567c478bdstevel@tonic-gate *
3577c478bdstevel@tonic-gate * The symbol __sparcv8 indicates the 32-bit SPARC V8 architecture as defined
3587c478bdstevel@tonic-gate * by Version 8 of the SPARC Architecture Manual.  (SPARC V7 is close enough
3597c478bdstevel@tonic-gate * to SPARC V8 for the former to be subsumed into the latter definition.)
3607c478bdstevel@tonic-gate *
3617c478bdstevel@tonic-gate * The symbol __sparcv9 indicates the 64-bit SPARC V9 architecture as defined
3627c478bdstevel@tonic-gate * by Version 9 of the SPARC Architecture Manual.
3637c478bdstevel@tonic-gate *
3647c478bdstevel@tonic-gate * The symbols __sparcv8 and __sparcv9 are mutually exclusive, and are only
3657c478bdstevel@tonic-gate * relevant when the symbol __sparc is defined.
3667c478bdstevel@tonic-gate */
3677c478bdstevel@tonic-gate/*
3687c478bdstevel@tonic-gate * XXX Due to the existence of 5110166, "defined(__sparcv9)" needs to be added
3697c478bdstevel@tonic-gate * to support backwards builds.  This workaround should be removed in s10_71.
3707c478bdstevel@tonic-gate */
3717c478bdstevel@tonic-gate#elif defined(__sparc) || defined(__sparcv9) || defined(__sparc__)
3727c478bdstevel@tonic-gate#if !defined(__sparc)
3737c478bdstevel@tonic-gate#define	__sparc
3747c478bdstevel@tonic-gate#endif
3757c478bdstevel@tonic-gate
3767c478bdstevel@tonic-gate/*
3777c478bdstevel@tonic-gate * You can be 32-bit or 64-bit, but not both at the same time.
3787c478bdstevel@tonic-gate */
3797c478bdstevel@tonic-gate#if defined(__sparcv8) && defined(__sparcv9)
3807c478bdstevel@tonic-gate#error	"SPARC Versions 8 and 9 are mutually exclusive choices"
3817c478bdstevel@tonic-gate#endif
3827c478bdstevel@tonic-gate
3837c478bdstevel@tonic-gate/*
3847c478bdstevel@tonic-gate * Existing compilers do not set __sparcv8.  Years will transpire before
3857c478bdstevel@tonic-gate * the compilers can be depended on to set the feature test macro. In
3867c478bdstevel@tonic-gate * the interim, we'll set it here on the basis of historical behaviour;
3877c478bdstevel@tonic-gate * if you haven't asked for SPARC V9, then you must've meant SPARC V8.
3887c478bdstevel@tonic-gate */
3897c478bdstevel@tonic-gate#if !defined(__sparcv9) && !defined(__sparcv8)
3907c478bdstevel@tonic-gate#define	__sparcv8
3917c478bdstevel@tonic-gate#endif
3927c478bdstevel@tonic-gate
3937c478bdstevel@tonic-gate/*
3947c478bdstevel@tonic-gate * Define the appropriate "processor characteristics" shared between
3957c478bdstevel@tonic-gate * all Solaris on SPARC systems.
3967c478bdstevel@tonic-gate */
3977c478bdstevel@tonic-gate#define	_BIG_ENDIAN
3987c478bdstevel@tonic-gate#define	_STACK_GROWS_DOWNWARD
3997c478bdstevel@tonic-gate#define	_LONG_LONG_HTOL
4007c478bdstevel@tonic-gate#define	_BIT_FIELDS_HTOL
4017c478bdstevel@tonic-gate#define	_IEEE_754
4027c478bdstevel@tonic-gate#define	_CHAR_IS_SIGNED
4037c478bdstevel@tonic-gate#define	_BOOL_ALIGNMENT			1
4047c478bdstevel@tonic-gate#define	_CHAR_ALIGNMENT			1
4057c478bdstevel@tonic-gate#define	_SHORT_ALIGNMENT		2
4067c478bdstevel@tonic-gate#define	_INT_ALIGNMENT			4
4077c478bdstevel@tonic-gate#define	_FLOAT_ALIGNMENT		4
4087c478bdstevel@tonic-gate#define	_FLOAT_COMPLEX_ALIGNMENT	4
4097c478bdstevel@tonic-gate#define	_LONG_LONG_ALIGNMENT		8
4107c478bdstevel@tonic-gate#define	_DOUBLE_ALIGNMENT		8
4117c478bdstevel@tonic-gate#define	_DOUBLE_COMPLEX_ALIGNMENT	8
4127c478bdstevel@tonic-gate#define	_ALIGNMENT_REQUIRED		1
4137c478bdstevel@tonic-gate
4147c478bdstevel@tonic-gate/*
4157c478bdstevel@tonic-gate * Define the appropriate "implementation choices" shared between versions.
4167c478bdstevel@tonic-gate */
4177c478bdstevel@tonic-gate#define	_SUNOS_VTOC_8
4187c478bdstevel@tonic-gate#define	_DMA_USES_VIRTADDR
4197c478bdstevel@tonic-gate#define	_NO_FDISK_PRESENT
420fea9cb9lq#define	_HAVE_TEM_FIRMWARE
421986fd29setje#define	_OBP
4227c478bdstevel@tonic-gate
4237c478bdstevel@tonic-gate/*
4247c478bdstevel@tonic-gate * The following set of definitions characterize the implementation of
4257c478bdstevel@tonic-gate * 32-bit Solaris on SPARC V8 systems.
4267c478bdstevel@tonic-gate */
4277c478bdstevel@tonic-gate#if defined(__sparcv8)
4287c478bdstevel@tonic-gate
4297c478bdstevel@tonic-gate/*
4307c478bdstevel@tonic-gate * Define the appropriate "processor characteristics"
4317c478bdstevel@tonic-gate */
4327c478bdstevel@tonic-gate#define	_LONG_ALIGNMENT			4
4337c478bdstevel@tonic-gate#define	_LONG_DOUBLE_ALIGNMENT		8
4347c478bdstevel@tonic-gate#define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	8
4357c478bdstevel@tonic-gate#define	_POINTER_ALIGNMENT		4
4367c478bdstevel@tonic-gate#define	_MAX_ALIGNMENT			8
437fc2512cRobert Mustacchi#define	_MAX_ALIGNMENT_TYPE		long double
4387c478bdstevel@tonic-gate
4397c478bdstevel@tonic-gate#define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGNMENT
4407c478bdstevel@tonic-gate
4417c478bdstevel@tonic-gate/*
4427c478bdstevel@tonic-gate * Define the appropriate "implementation choices"
4437c478bdstevel@tonic-gate */
444d643a85Yuri Pankov#if !defined(_ILP32)
4457c478bdstevel@tonic-gate#define	_ILP32
446d643a85Yuri Pankov#endif
4477c478bdstevel@tonic-gate#if !defined(_I32LPx) && defined(_KERNEL)
4487c478bdstevel@tonic-gate#define	_I32LPx
4497c478bdstevel@tonic-gate#endif
4507c478bdstevel@tonic-gate
4517c478bdstevel@tonic-gate/*
4527c478bdstevel@tonic-gate * The following set of definitions characterize the implementation of
4537c478bdstevel@tonic-gate * 64-bit Solaris on SPARC V9 systems.
4547c478bdstevel@tonic-gate */
4557c478bdstevel@tonic-gate#elif defined(__sparcv9)
4567c478bdstevel@tonic-gate
4577c478bdstevel@tonic-gate/*
4587c478bdstevel@tonic-gate * Define the appropriate "processor characteristics"
4597c478bdstevel@tonic-gate */
4607c478bdstevel@tonic-gate#define	_LONG_ALIGNMENT			8
4617c478bdstevel@tonic-gate#define	_LONG_DOUBLE_ALIGNMENT		16
4627c478bdstevel@tonic-gate#define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	16
4637c478bdstevel@tonic-gate#define	_POINTER_ALIGNMENT		8
4647c478bdstevel@tonic-gate#define	_MAX_ALIGNMENT			16
465fc2512cRobert Mustacchi#define	_MAX_ALIGNMENT_TYPE		long double
4667c478bdstevel@tonic-gate
467b4b6080Roger A. Faulkner#define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGNMENT
4687c478bdstevel@tonic-gate
4697c478bdstevel@tonic-gate/*
4707c478bdstevel@tonic-gate * Define the appropriate "implementation choices"
4717c478bdstevel@tonic-gate */
4727c478bdstevel@tonic-gate#if !defined(_LP64)
4737c478bdstevel@tonic-gate#define	_LP64
4747c478bdstevel@tonic-gate#endif
4757c478bdstevel@tonic-gate#if !defined(_I32LPx)
4767c478bdstevel@tonic-gate#define	_I32LPx
4777c478bdstevel@tonic-gate#endif
4787c478bdstevel@tonic-gate#define	_MULTI_DATAMODEL
4797c478bdstevel@tonic-gate
4807c478bdstevel@tonic-gate#else
4817c478bdstevel@tonic-gate#error	"unknown SPARC version"
4827c478bdstevel@tonic-gate#endif
4837c478bdstevel@tonic-gate
4847c478bdstevel@tonic-gate/*
4857c478bdstevel@tonic-gate * #error is strictly ansi-C, but works as well as anything for K&R systems.
4867c478bdstevel@tonic-gate */
4877c478bdstevel@tonic-gate#else
4887c478bdstevel@tonic-gate#error "ISA not supported"
4897c478bdstevel@tonic-gate#endif
4907c478bdstevel@tonic-gate
4917c478bdstevel@tonic-gate#if defined(_ILP32) && defined(_LP64)
4927c478bdstevel@tonic-gate#error "Both _ILP32 and _LP64 are defined"
4937c478bdstevel@tonic-gate#endif
4947c478bdstevel@tonic-gate
4957c478bdstevel@tonic-gate#ifdef	__cplusplus
4967c478bdstevel@tonic-gate}
4977c478bdstevel@tonic-gate#endif
4987c478bdstevel@tonic-gate
4997c478bdstevel@tonic-gate#endif	/* _SYS_ISA_DEFS_H */
500