File: isa_defs.h

package info (click to toggle)
zfs-fuse 0.7.0-21
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 10,752 kB
  • sloc: ansic: 154,045; sh: 9,707; asm: 1,690; perl: 367; xml: 300; python: 269; makefile: 83
file content (582 lines) | stat: -rw-r--r-- 17,315 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */

/*
 * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef	_SYS_ISA_DEFS_H
#define	_SYS_ISA_DEFS_H

/* #pragma ident	"%Z%%M%	%I%	%E% SMI" */

/*
 * This header file serves to group a set of well known defines and to
 * set these for each instruction set architecture.  These defines may
 * be divided into two groups;  characteristics of the processor and
 * implementation choices for Solaris on a processor.
 *
 * Processor Characteristics:
 *
 * _LITTLE_ENDIAN / _BIG_ENDIAN:
 *	The natural byte order of the processor.  A pointer to an int points
 *	to the least/most significant byte of that int.
 *
 * _STACK_GROWS_UPWARD / _STACK_GROWS_DOWNWARD:
 *	The processor specific direction of stack growth.  A push onto the
 *	stack increases/decreases the stack pointer, so it stores data at
 *	successively higher/lower addresses.  (Stackless machines ignored
 *	without regrets).
 *
 * _LONG_LONG_HTOL / _LONG_LONG_LTOH:
 *	A pointer to a long long points to the most/least significant long
 *	within that long long.
 *
 * _BIT_FIELDS_HTOL / _BIT_FIELDS_LTOH:
 *	The C compiler assigns bit fields from the high/low to the low/high end
 *	of an int (most to least significant vs. least to most significant).
 *
 * _IEEE_754:
 *	The processor (or supported implementations of the processor)
 *	supports the ieee-754 floating point standard.  No other floating
 *	point standards are supported (or significant).  Any other supported
 *	floating point formats are expected to be cased on the ISA processor
 *	symbol.
 *
 * _CHAR_IS_UNSIGNED / _CHAR_IS_SIGNED:
 *	The C Compiler implements objects of type `char' as `unsigned' or
 *	`signed' respectively.  This is really an implementation choice of
 *	the compiler writer, but it is specified in the ABI and tends to
 *	be uniform across compilers for an instruction set architecture.
 *	Hence, it has the properties of a processor characteristic.
 *
 * _CHAR_ALIGNMENT / _SHORT_ALIGNMENT / _INT_ALIGNMENT / _LONG_ALIGNMENT /
 * _LONG_LONG_ALIGNMENT / _DOUBLE_ALIGNMENT / _LONG_DOUBLE_ALIGNMENT /
 * _POINTER_ALIGNMENT / _FLOAT_ALIGNMENT:
 *	The ABI defines alignment requirements of each of the primitive
 *	object types.  Some, if not all, may be hardware requirements as
 * 	well.  The values are expressed in "byte-alignment" units.
 *
 * _MAX_ALIGNMENT:
 *	The most stringent alignment requirement as specified by the ABI.
 *	Equal to the maximum of all the above _XXX_ALIGNMENT values.
 *
 * _ALIGNMENT_REQUIRED:
 *	True or false (1 or 0) whether or not the hardware requires the ABI
 *	alignment.
 *
 * _LONG_LONG_ALIGNMENT_32
 *	The 32-bit ABI supported by a 64-bit kernel may have different
 *	alignment requirements for primitive object types.  The value of this
 *	identifier is expressed in "byte-alignment" units.
 *
 * _HAVE_CPUID_INSN
 *	This indicates that the architecture supports the 'cpuid'
 *	instruction as defined by Intel.  (Intel allows other vendors
 *	to extend the instruction for their own purposes.)
 *
 *
 * Implementation Choices:
 *
 * _ILP32 / _LP64:
 *	This specifies the compiler data type implementation as specified in
 *	the relevant ABI.  The choice between these is strongly influenced
 *	by the underlying hardware, but is not absolutely tied to it.
 *	Currently only two data type models are supported:
 *
 *	_ILP32:
 *		Int/Long/Pointer are 32 bits.  This is the historical UNIX
 *		and Solaris implementation.  Due to its historical standing,
 *		this is the default case.
 *
 *	_LP64:
 *		Long/Pointer are 64 bits, Int is 32 bits.  This is the chosen
 *		implementation for 64-bit ABIs such as SPARC V9.
 *
 *	_I32LPx:
 *		A compilation environment where 'int' is 32-bit, and
 *		longs and pointers are simply the same size.
 *
 *	In all cases, Char is 8 bits and Short is 16 bits.
 *
 * _SUNOS_VTOC_8 / _SUNOS_VTOC_16 / _SVR4_VTOC_16:
 *	This specifies the form of the disk VTOC (or label):
 *
 *	_SUNOS_VTOC_8:
 *		This is a VTOC form which is upwardly compatible with the
 *		SunOS 4.x disk label and allows 8 partitions per disk.
 *
 *	_SUNOS_VTOC_16:
 *		In this format the incore vtoc image matches the ondisk
 *		version.  It allows 16 slices per disk, and is not
 *		compatible with the SunOS 4.x disk label.
 *
 *	Note that these are not the only two VTOC forms possible and
 *	additional forms may be added.  One possible form would be the
 *	SVr4 VTOC form.  The symbol for that is reserved now, although
 *	it is not implemented.
 *
 *	_SVR4_VTOC_16:
 *		This VTOC form is compatible with the System V Release 4
 *		VTOC (as implemented on the SVr4 Intel and 3b ports) with
 *		16 partitions per disk.
 *
 *
 * _DMA_USES_PHYSADDR / _DMA_USES_VIRTADDR
 *	This describes the type of addresses used by system DMA:
 *
 *	_DMA_USES_PHYSADDR:
 *		This type of DMA, used in the x86 implementation,
 *		requires physical addresses for DMA buffers.  The 24-bit
 *		addresses used by some legacy boards is the source of the
 *		"low-memory" (<16MB) requirement for some devices using DMA.
 *
 *	_DMA_USES_VIRTADDR:
 *		This method of DMA allows the use of virtual addresses for
 *		DMA transfers.
 *
 * _FIRMWARE_NEEDS_FDISK / _NO_FDISK_PRESENT
 *      This indicates the presence/absence of an fdisk table.
 *
 *      _FIRMWARE_NEEDS_FDISK
 *              The fdisk table is required by system firmware.  If present,
 *              it allows a disk to be subdivided into multiple fdisk
 *              partitions, each of which is equivalent to a separate,
 *              virtual disk.  This enables the co-existence of multiple
 *              operating systems on a shared hard disk.
 *
 *      _NO_FDISK_PRESENT
 *              If the fdisk table is absent, it is assumed that the entire
 *              media is allocated for a single operating system.
 *
 * _HAVE_TEM_FIRMWARE
 *	Defined if this architecture has the (fallback) option of
 *	using prom_* calls for doing I/O if a suitable kernel driver
 *	is not available to do it.
 *
 * _DONT_USE_1275_GENERIC_NAMES
 *		Controls whether or not device tree node names should
 *		comply with the IEEE 1275 "Generic Names" Recommended
 *		Practice. With _DONT_USE_GENERIC_NAMES, device-specific
 *		names identifying the particular device will be used.
 *
 * __i386_COMPAT
 *	This indicates whether the i386 ABI is supported as a *non-native*
 *	mode for the platform.  When this symbol is defined:
 *	-	32-bit xstat-style system calls are enabled
 *	-	32-bit xmknod-style system calls are enabled
 *	-	32-bit system calls use i386 sizes -and- alignments
 *
 *	Note that this is NOT defined for the i386 native environment!
 *
 * __x86
 *	This is ONLY a synonym for defined(__i386) || defined(__amd64)
 *	which is useful only insofar as these two architectures share
 *	common attributes.  Analogous to __sparc.
 *
 * _PSM_MODULES
 *	This indicates whether or not the implementation uses PSM
 *	modules for processor support, reading /etc/mach from inside
 *	the kernel to extract a list.
 *
 * _RTC_CONFIG
 *	This indicates whether or not the implementation uses /etc/rtc_config
 *	to configure the real-time clock in the kernel.
 *
 * _UNIX_KRTLD
 *	This indicates that the implementation uses a dynamically
 *	linked unix + krtld to form the core kernel image at boot
 *	time, or (in the absence of this symbol) a prelinked kernel image.
 */

#ifdef	__cplusplus
extern "C" {
#endif

/*
 * The following set of definitions characterize Solaris on AMD's
 * 64-bit systems.
 */
#if defined(__x86_64) || defined(__amd64)

#if !defined(__amd64)
#define	__amd64		/* preferred guard */
#endif

#if !defined(__x86)
#define	__x86
#endif

/*
 * Define the appropriate "processor characteristics"
 */
#define	_LITTLE_ENDIAN
#define	_STACK_GROWS_DOWNWARD
#define	_LONG_LONG_LTOH
#define	_BIT_FIELDS_LTOH
#define	_IEEE_754
#define	_CHAR_IS_SIGNED
#define	_BOOL_ALIGNMENT			1
#define	_CHAR_ALIGNMENT			1
#define	_SHORT_ALIGNMENT		2
#define	_INT_ALIGNMENT			4
#define	_FLOAT_ALIGNMENT		4
#define	_FLOAT_COMPLEX_ALIGNMENT	4
#define	_LONG_ALIGNMENT			8
#define	_LONG_LONG_ALIGNMENT		8
#define	_DOUBLE_ALIGNMENT		8
#define	_DOUBLE_COMPLEX_ALIGNMENT	8
#define	_LONG_DOUBLE_ALIGNMENT		16
#define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	16
#define	_POINTER_ALIGNMENT		8
#define	_MAX_ALIGNMENT			16
#define	_ALIGNMENT_REQUIRED		1

/*
 * Different alignment constraints for the i386 ABI in compatibility mode
 */
#define	_LONG_LONG_ALIGNMENT_32		4

/*
 * Define the appropriate "implementation choices".
 */
#if !defined(_LP64)
#define	_LP64
#endif
#if !defined(_I32LPx) && defined(_KERNEL)
#define	_I32LPx
#endif
#define	_MULTI_DATAMODEL
#define	_SUNOS_VTOC_16
#define	_DMA_USES_PHYSADDR
#define	_FIRMWARE_NEEDS_FDISK
#define	__i386_COMPAT
#define	_PSM_MODULES
#define	_RTC_CONFIG
#define	_DONT_USE_1275_GENERIC_NAMES
#define	_HAVE_CPUID_INSN

/*
 * The feature test macro __i386 is generic for all processors implementing
 * the Intel 386 instruction set or a superset of it.  Specifically, this
 * includes all members of the 386, 486, and Pentium family of processors.
 */
#elif defined(__i386) || defined(__i386__)

#if !defined(__i386)
#define	__i386
#endif

#if !defined(__x86)
#define	__x86
#endif

/*
 * Define the appropriate "processor characteristics"
 */
#define	_LITTLE_ENDIAN
#define	_STACK_GROWS_DOWNWARD
#define	_LONG_LONG_LTOH
#define	_BIT_FIELDS_LTOH
#define	_IEEE_754
#define	_CHAR_IS_SIGNED
#define	_BOOL_ALIGNMENT			1
#define	_CHAR_ALIGNMENT			1
#define	_SHORT_ALIGNMENT		2
#define	_INT_ALIGNMENT			4
#define	_FLOAT_ALIGNMENT		4
#define	_FLOAT_COMPLEX_ALIGNMENT	4
#define	_LONG_ALIGNMENT			4
#define	_LONG_LONG_ALIGNMENT		4
#define	_DOUBLE_ALIGNMENT		4
#define	_DOUBLE_COMPLEX_ALIGNMENT	4
#define	_LONG_DOUBLE_ALIGNMENT		4
#define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	4
#define	_POINTER_ALIGNMENT		4
#define	_MAX_ALIGNMENT			4
#define	_ALIGNMENT_REQUIRED		0

#define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGNMENT

/*
 * Define the appropriate "implementation choices".
 */
#define	_ILP32
#if !defined(_I32LPx) && defined(_KERNEL)
#define	_I32LPx
#endif
#define	_SUNOS_VTOC_16
#define	_DMA_USES_PHYSADDR
#define	_FIRMWARE_NEEDS_FDISK
#define	_PSM_MODULES
#define	_RTC_CONFIG
#define	_DONT_USE_1275_GENERIC_NAMES
#define	_HAVE_CPUID_INSN

/*
 * The following set of definitions characterize the Solaris on SPARC systems.
 *
 * The symbol __sparc indicates any of the SPARC family of processor
 * architectures.  This includes SPARC V7, SPARC V8 and SPARC V9.
 *
 * The symbol __sparcv8 indicates the 32-bit SPARC V8 architecture as defined
 * by Version 8 of the SPARC Architecture Manual.  (SPARC V7 is close enough
 * to SPARC V8 for the former to be subsumed into the latter definition.)
 *
 * The symbol __sparcv9 indicates the 64-bit SPARC V9 architecture as defined
 * by Version 9 of the SPARC Architecture Manual.
 *
 * The symbols __sparcv8 and __sparcv9 are mutually exclusive, and are only
 * relevant when the symbol __sparc is defined.
 */
/*
 * XXX Due to the existence of 5110166, "defined(__sparcv9)" needs to be added
 * to support backwards builds.  This workaround should be removed in s10_71.
 */
#elif defined(__sparc) || defined(__sparcv9) || defined(__sparc__)
#if !defined(__sparc)
#define	__sparc
#endif

/* Linux doesn't set __sparcv9 like Solaris */
#if defined(__sparc_v9__) || defined(__arch64__)
#define	__sparcv9
#endif

/*
 * You can be 32-bit or 64-bit, but not both at the same time.
 */
#if defined(__sparcv8) && defined(__sparcv9)
#error	"SPARC Versions 8 and 9 are mutually exclusive choices"
#endif

/*
 * Existing compilers do not set __sparcv8.  Years will transpire before
 * the compilers can be depended on to set the feature test macro. In
 * the interim, we'll set it here on the basis of historical behaviour;
 * if you haven't asked for SPARC V9, then you must've meant SPARC V8.
 */
#if !defined(__sparcv9) && !defined(__sparcv8)
#define	__sparcv8
#endif

/*
 * Define the appropriate "processor characteristics" shared between
 * all Solaris on SPARC systems.
 */
#define	_BIG_ENDIAN
#define	_STACK_GROWS_DOWNWARD
#define	_LONG_LONG_HTOL
#define	_BIT_FIELDS_HTOL
#define	_IEEE_754
#define	_CHAR_IS_SIGNED
#define	_BOOL_ALIGNMENT			1
#define	_CHAR_ALIGNMENT			1
#define	_SHORT_ALIGNMENT		2
#define	_INT_ALIGNMENT			4
#define	_FLOAT_ALIGNMENT		4
#define	_FLOAT_COMPLEX_ALIGNMENT	4
#define	_LONG_LONG_ALIGNMENT		8
#define	_DOUBLE_ALIGNMENT		8
#define	_DOUBLE_COMPLEX_ALIGNMENT	8
#define	_ALIGNMENT_REQUIRED		1

/*
 * Define the appropriate "implementation choices" shared between versions.
 */
#define	_SUNOS_VTOC_8
#define	_DMA_USES_VIRTADDR
#define	_NO_FDISK_PRESENT
#define	_HAVE_TEM_FIRMWARE
#define	_UNIX_KRTLD

/*
 * The following set of definitions characterize the implementation of
 * 32-bit Solaris on SPARC V8 systems.
 */
#if defined(__sparcv8)

/*
 * Define the appropriate "processor characteristics"
 */
#define	_LONG_ALIGNMENT			4
#define	_LONG_DOUBLE_ALIGNMENT		8
#define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	8
#define	_POINTER_ALIGNMENT		4
#define	_MAX_ALIGNMENT			8

#define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGNMENT

/*
 * Define the appropriate "implementation choices"
 */
#define	_ILP32
#if !defined(_I32LPx) && defined(_KERNEL)
#define	_I32LPx
#endif

/*
 * The following set of definitions characterize the implementation of
 * 64-bit Solaris on SPARC V9 systems.
 */
#elif defined(__sparcv9)

/*
 * Define the appropriate "processor characteristics"
 */
#define	_LONG_ALIGNMENT			8
#define	_LONG_DOUBLE_ALIGNMENT		16
#define	_LONG_DOUBLE_COMPLEX_ALIGNMENT	16
#define	_POINTER_ALIGNMENT		8
#define	_MAX_ALIGNMENT			16

#define	_LONG_LONG_ALIGNMENT_32		_LONG_LONG_ALIGMENT

/*
 * Define the appropriate "implementation choices"
 */
#if !defined(_LP64)
#define	_LP64
#endif
#if !defined(_I32LPx)
#define	_I32LPx
#endif
#define	_MULTI_DATAMODEL

#else
#error	"unknown SPARC version"
#endif

#elif defined(__powerpc) || defined(__powerpc__) ||\
      defined(__powerpc64) || defined(__powerpc64__)

#if defined(__powerpc__) && !defined(__powerpc)
#define __powerpc
#endif

#if defined(__powerpc64__) && !defined(__powerpc64)
#define __powerpc64
#endif

/*
 * Next defines common features between 32 and 64 bit PowerPC
 */
#ifdef __BIG_ENDIAN__
#ifndef _BIG_ENDIAN
#define _BIG_ENDIAN
#endif
#elif defined(__LITTLE_ENDIAN__)
#ifndef _LITTLE_ENDIAN
#define _LITTLE_ENDIAN
#endif
#endif
#define _STACK_GROWS_DOWNWARD
#define _LONG_LONG_HTOL
#define _BIT_FIELDS_HTOL
#define _IEEE_754
#define _CHAR_IS_UNSIGNED
#define _BOOL_ALIGNMENT                        1
#define _CHAR_ALIGNMENT                        1
#define _SHORT_ALIGNMENT               2
#define _INT_ALIGNMENT                 4
#define _FLOAT_ALIGNMENT               4
#define _FLOAT_COMPLEX_ALIGNMENT       4
#define _LONG_LONG_ALIGNMENT           8
#define _DOUBLE_ALIGNMENT              8
#define _LONG_DOUBLE_ALIGNMENT         16
#define _DOUBLE_COMPLEX_ALIGNMENT      8
#define _ALIGNMENT_REQUIRED            1

/*
 * Define the appropriate "implementation choices".
 */
#define _SUNOS_VTOC_8
#define _DMA_USES_PHYSADDR
#define _FIRMWARE_NEEDS_FDISK
#define _CONSOLE_OUTPUT_VIA_FIRMWARE

#if defined(__powerpc64)
/*
 * Define the appropriate "processor characteristics" for PowerPC 64 bit
 */
#define _LONG_ALIGNMENT                        8
#define _POINTER_ALIGNMENT             8

/*
 * Define the appropriate "implementation choices" for PowerPC 64 bit
 */
#if !defined(_LP64)
#define _LP64
#endif
#if !defined(_I32LPx)
#define _I32LPx
#endif
#define _MULTI_DATAMODEL

#else
/*
 * Define the appropriate "processor characteristics" for PowerPC 32 bit
 */
#define _LONG_ALIGNMENT                 4
#define _POINTER_ALIGNMENT             4

/*
 * Define the appropriate "implementation choices" for PowerPC 32 bit
 */

#define _ILP32
#if !defined(_I32LPx) && defined(_KERNEL)
#define _I32LPx
#endif

#endif

#elif defined(__ARMEL__)
// From https://bitbucket.org/cli/zfs-fuse-arm/src/865c93c81a95/src/lib/libsolcompat/include/sys/isa_defs.h
/*
 * Define processor specifications for ARM platform (little endian)
 */
#define _LITTLE_ENDIAN
#define _LONG_LONG_LTOH
#define _BIT_FIELDS_LTOH

/*
 * Define the appropriate "implementation choices" for ARM (little endian)
 */
#define _SUNOS_VTOC_16

/*
 * #error is strictly ansi-C, but works as well as anything for K&R systems.
 *  */
#else
#error "ISA not supported"
#endif

#if defined(_ILP32) && defined(_LP64)
#error "Both _ILP32 and _LP64 are defined"
#endif

#ifdef	__cplusplus
}
#endif

#endif	/* _SYS_ISA_DEFS_H */