s10_brand.h revision 12789:82cffaae72d5
10SN/A/*
213776Smikael * CDDL HEADER START
30SN/A *
40SN/A * The contents of this file are subject to the terms of the
50SN/A * Common Development and Distribution License (the "License").
60SN/A * You may not use this file except in compliance with the License.
72362SN/A *
80SN/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
92362SN/A * or http://www.opensolaris.org/os/licensing.
100SN/A * See the License for the specific language governing permissions
110SN/A * and limitations under the License.
120SN/A *
130SN/A * When distributing Covered Code, include this CDDL HEADER in each
140SN/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150SN/A * If applicable, add the following below this CDDL HEADER, with the
160SN/A * fields enclosed by brackets "[]" replaced with your own identifying
170SN/A * information: Portions Copyright [yyyy] [name of copyright owner]
180SN/A *
190SN/A * CDDL HEADER END
200SN/A */
212362SN/A
222362SN/A/*
232362SN/A * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
240SN/A */
250SN/A
260SN/A#ifndef _S10_BRAND_H
270SN/A#define	_S10_BRAND_H
2815287Spsandoz
2912808Schegar#ifdef	__cplusplus
3012808Schegarextern "C" {
3113032Schegar#endif
3213418Schegar
330SN/A#include <sys/brand.h>
3415287Spsandoz
3515287Spsandoz#define	S10_BRANDNAME		"solaris10"
360SN/A
370SN/A#define	S10_VERSION_1		1
380SN/A#define	S10_VERSION		S10_VERSION_1
390SN/A
400SN/A#define	S10_LIB_NAME		"s10_brand.so.1"
410SN/A#define	S10_LINKER_NAME		"ld.so.1"
420SN/A
430SN/A#define	S10_LIB32		BRAND_NATIVE_DIR "usr/lib/" S10_LIB_NAME
440SN/A#define	S10_LINKER32		"/lib/" S10_LINKER_NAME
450SN/A
460SN/A#define	S10_LIB64		BRAND_NATIVE_DIR "usr/lib/64/" S10_LIB_NAME
470SN/A#define	S10_LINKER64		"/lib/64/" S10_LINKER_NAME
482570SN/A
490SN/A#if defined(_LP64)
500SN/A#define	S10_LIB		S10_LIB64
510SN/A#define	S10_LINKER	S10_LINKER64
522570SN/A#else /* !_LP64 */
530SN/A#define	S10_LIB		S10_LIB32
540SN/A#define	S10_LINKER	S10_LINKER32
550SN/A#endif /* !_LP64 */
562570SN/A
570SN/A/*
580SN/A * Solaris 10 value of _SIGRTMIN, _SIGRTMAX, MAXSIG, NSIG
590SN/A */
602570SN/A#define	S10_SIGRTMIN	41
610SN/A#define	S10_SIGRTMAX	48
620SN/A#define	S10_MAXSIG	48
630SN/A#define	S10_NSIG	49
640SN/A
650SN/A/*
660SN/A * Brand system call subcodes.  0-127 are reserved for generic subcodes.
670SN/A */
680SN/A#define	B_S10_PIDINFO		128
690SN/A#define	B_S10_NATIVE		130
700SN/A#define	B_S10_FSREGCORRECTION	131
710SN/A#define	B_S10_ISFDXATTRDIR	132
720SN/A
730SN/A/*
740SN/A * Versioning flags
7511846Saph *
7611846Saph * The first enum value must be zero.  Place new enum values at the end of the
770SN/A * list but before S10_NUM_EMUL_FEATURES, which must always come last.
780SN/A * Enum values should start with "S10_FEATURE_" and be named after the
790SN/A * fixes/backports that they represent.  For example, an enum value representing
800SN/A * a backport that changes a MNTFS ioctl could be named
810SN/A * "S10_FEATURE_ALTERED_MNTFS_IOCTL".
820SN/A */
830SN/Aenum s10_emulated_features {
840SN/A	S10_FEATURE_ALTERED_MNTFS_IOCTL,
850SN/A	S10_FEATURE_U9_ZFS_IOCTL,	/* S10u9 ZFS ioctl changes */
860SN/A	S10_NUM_EMUL_FEATURES		/* This must be the last entry! */
870SN/A};
880SN/A
890SN/A/*
902625SN/A * This string constant represents the path of the Solaris 10 directory
912625SN/A * containing emulation feature files.
922625SN/A */
930SN/A#define	S10_REQ_EMULATION_DIR	"/usr/lib/brand/solaris10"
9411846Saph
950SN/A/*
960SN/A * s10_brand_syscall_callback_common() needs to save 4 local registers so it
970SN/A * can free them up for its own use.
980SN/A */
990SN/A#define	S10_CPU_REG_SAVE_SIZE	(sizeof (ulong_t) * 4)
1000SN/A
1010SN/A/*
1020SN/A * S10 system call codes for S10 traps that have been removed or reassigned,
1030SN/A * or that are to be removed or reassigned after the dtrace syscall provider
1040SN/A * has been reengineered to deal properly with syscall::open (for example).
1050SN/A */
1060SN/A#define	S10_SYS_forkall		2
1079329SN/A#define	S10_SYS_open		5
1089329SN/A#define	S10_SYS_wait		7
1099329SN/A#define	S10_SYS_creat		8
11013344Sredestad#define	S10_SYS_link		9
11113344Sredestad#define	S10_SYS_unlink		10
1129329SN/A#define	S10_SYS_exec		11
1139329SN/A#define	S10_SYS_mknod		14
1149329SN/A#define	S10_SYS_chmod		15
1159329SN/A#define	S10_SYS_chown		16
1169329SN/A#define	S10_SYS_stat		18
1170SN/A#define	S10_SYS_umount		22
1180SN/A#define	S10_SYS_fstat		28
1190SN/A#define	S10_SYS_utime		30
1200SN/A#define	S10_SYS_access		33
121515SN/A#define	S10_SYS_dup		41
1229329SN/A#define	S10_SYS_issetugid	75
12313901Salanb#define	S10_SYS_fsat		76
1249329SN/A#define	S10_SYS_rmdir		79
1259329SN/A#define	S10_SYS_mkdir		80
1269329SN/A#define	S10_SYS_poll		87
1279329SN/A#define	S10_SYS_lstat		88
1289329SN/A#define	S10_SYS_symlink		89
1299329SN/A#define	S10_SYS_readlink	90
1309329SN/A#define	S10_SYS_fchmod		93
1319329SN/A#define	S10_SYS_fchown		94
1329329SN/A#define	S10_SYS_xstat		123
1339329SN/A#define	S10_SYS_lxstat		124
1349329SN/A#define	S10_SYS_fxstat		125
1350SN/A#define	S10_SYS_xmknod		126
13615606Skbarrett#define	S10_SYS_lchown		130
13715606Skbarrett#define	S10_SYS_rename		134
13815606Skbarrett#define	S10_SYS_fork1		143
13915606Skbarrett#define	S10_SYS_lwp_sema_wait	147
14015606Skbarrett#define	S10_SYS_utimes		154
14115606Skbarrett#define	S10_SYS_lwp_mutex_lock	169
14215606Skbarrett#define	S10_SYS_stat64		215
14315606Skbarrett#define	S10_SYS_lstat64		216
14415606Skbarrett#define	S10_SYS_fstat64		217
14515606Skbarrett#define	S10_SYS_creat64		224
14615606Skbarrett#define	S10_SYS_open64		225
14715606Skbarrett
14815606Skbarrett/*
14915606Skbarrett * solaris10-brand-specific attributes
15015606Skbarrett * These must start at ZONE_ATTR_BRAND_ATTRS.
15115606Skbarrett */
15215606Skbarrett#define	S10_EMUL_BITMAP		ZONE_ATTR_BRAND_ATTRS
15315606Skbarrett
15415606Skbarrett/*
15515606Skbarrett * s10_emul_bitmap represents an emulation feature bitmap.  Each constant
15615606Skbarrett * in s10_emulated_features defines a bit index in this bitmap.  If a bit is
15715606Skbarrett * set, then the feature associated with the s10_emulated_features constant
15815606Skbarrett * whose value is the bit's index is present in the associated zone's hosted
15915606Skbarrett * Solaris 10 environment.
16015606Skbarrett *
16115606Skbarrett * NOTE: There must be at least one byte in the bitmap.
16215606Skbarrett *
16315606Skbarrett * We don't use the bitmap macros provided by usr/src/uts/common/sys/bitmap.h
16415606Skbarrett * because they operate on ulong_t arrays.  The size of a ulong_t depends on
16515606Skbarrett * the data model in which the code that declares the ulong_t is compiled:
1669329SN/A * four bytes on 32-bit architectures and eight bytes 64-bit architectures.
1679329SN/A * If the kernel is 64-bit and a 32-bit process executes in a solaris10-
1689329SN/A * branded zone, then if the process' emulation library, which is 32-bit,
1699329SN/A * queries the kernel for the zone's emulation bitmap, then the kernel will
1709329SN/A * refuse because the library will request a bitmap that's half as big
1719329SN/A * as the bitmap the kernel provides.  The 32-bit emulation library would need
1729329SN/A * its own macros to define and operate on bitmaps with 64-bit array elements.
1739329SN/A * Thus using the sys/bitmap.h macros is probably more troublesome than
1749329SN/A * defining and using our own constants and macros for bitmap manipulations.
17515606Skbarrett */
17615606Skbarretttypedef uint8_t s10_emul_bitmap_t[(S10_NUM_EMUL_FEATURES >> 3) + 1];
1779329SN/A
1789329SN/A#if defined(_KERNEL)
1799329SN/A
1809329SN/A/* brand specific data */
18115606Skbarretttypedef struct s10_zone_data {
18215606Skbarrett	/*
1839329SN/A	 * emul_bitmap specifies the features that are present in the
1849329SN/A	 * associated zone.
1859329SN/A	 */
1869329SN/A	s10_emul_bitmap_t	emul_bitmap;
1879329SN/A} s10_zone_data_t;
1889329SN/A
1899329SN/Avoid s10_brand_syscall_callback(void);
1909329SN/Avoid s10_brand_syscall32_callback(void);
1919329SN/A
1929329SN/A#if !defined(sparc)
1939329SN/Avoid s10_brand_sysenter_callback(void);
1940SN/A#endif /* !sparc */
1959329SN/A
1969329SN/A#if defined(__amd64)
1979329SN/Avoid s10_brand_int91_callback(void);
1989329SN/A#endif /* __amd64 */
1999329SN/A#endif /* _KERNEL */
2009329SN/A
2019329SN/A#ifdef	__cplusplus
2029329SN/A}
2039329SN/A#endif
2049329SN/A
2059329SN/A#endif	/* _S10_BRAND_H */
2069329SN/A