xref: /illumos-gate/usr/src/uts/common/brand/solaris10/s10_brand.h (revision ccd81fdda071e031209c777983199d191c35b0a2)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 #ifndef _S10_BRAND_H
26 #define	_S10_BRAND_H
27 
28 #ifdef	__cplusplus
29 extern "C" {
30 #endif
31 
32 #include <sys/brand.h>
33 
34 #define	S10_BRANDNAME		"solaris10"
35 
36 #define	S10_VERSION_1		1
37 #define	S10_VERSION		S10_VERSION_1
38 
39 #define	S10_LIB_NAME		"s10_brand.so.1"
40 #define	S10_LINKER_NAME		"ld.so.1"
41 
42 #define	S10_LIB32		BRAND_NATIVE_DIR "usr/lib/" S10_LIB_NAME
43 #define	S10_LINKER32		"/lib/" S10_LINKER_NAME
44 
45 #define	S10_LIB64		BRAND_NATIVE_DIR "usr/lib/64/" S10_LIB_NAME
46 #define	S10_LINKER64		"/lib/64/" S10_LINKER_NAME
47 
48 #if defined(_LP64)
49 #define	S10_LIB		S10_LIB64
50 #define	S10_LINKER	S10_LINKER64
51 #else /* !_LP64 */
52 #define	S10_LIB		S10_LIB32
53 #define	S10_LINKER	S10_LINKER32
54 #endif /* !_LP64 */
55 
56 /*
57  * Solaris 10 value of _SIGRTMIN, _SIGRTMAX, MAXSIG, NSIG
58  */
59 #define	S10_SIGRTMIN	41
60 #define	S10_SIGRTMAX	48
61 #define	S10_MAXSIG	48
62 #define	S10_NSIG	49
63 
64 /*
65  * Brand system call subcodes.  0-127 are reserved for generic subcodes.
66  */
67 #define	B_S10_PIDINFO		128
68 #define	B_S10_NATIVE		130
69 #define	B_S10_FSREGCORRECTION	131
70 #define	B_S10_ISFDXATTRDIR	132
71 
72 /*
73  * Versioning flags
74  *
75  * The first enum value must be zero.  Place new enum values at the end of the
76  * list but before S10_NUM_EMUL_FEATURES, which must always come last.
77  * Enum values should start with "S10_FEATURE_" and be named after the
78  * fixes/backports that they represent.  For example, an enum value representing
79  * a backport that changes a MNTFS ioctl could be named
80  * "S10_FEATURE_ALTERED_MNTFS_IOCTL".
81  */
82 enum s10_emulated_features {
83 	S10_FEATURE_ALTERED_MNTFS_IOCTL,
84 	S10_FEATURE_U9_ZFS_IOCTL,	/* S10u9 ZFS ioctl changes */
85 	S10_NUM_EMUL_FEATURES		/* This must be the last entry! */
86 };
87 
88 /*
89  * This string constant represents the path of the Solaris 10 directory
90  * containing emulation feature files.
91  */
92 #define	S10_REQ_EMULATION_DIR	"/usr/lib/brand/solaris10"
93 
94 /*
95  * s10_brand_syscall_callback_common() needs to save 4 local registers so it
96  * can free them up for its own use.
97  */
98 #define	S10_CPU_REG_SAVE_SIZE	(sizeof (ulong_t) * 4)
99 
100 /*
101  * S10 system call codes for S10 traps that have been removed or reassigned,
102  * or that are to be removed or reassigned after the dtrace syscall provider
103  * has been reengineered to deal properly with syscall::open (for example).
104  */
105 #define	S10_SYS_forkall		2
106 #define	S10_SYS_open		5
107 #define	S10_SYS_wait		7
108 #define	S10_SYS_creat		8
109 #define	S10_SYS_unlink		10
110 #define	S10_SYS_exec		11
111 #define	S10_SYS_chown		16
112 #define	S10_SYS_stat		18
113 #define	S10_SYS_umount		22
114 #define	S10_SYS_fstat		28
115 #define	S10_SYS_utime		30
116 #define	S10_SYS_access		33
117 #define	S10_SYS_dup		41
118 #define	S10_SYS_issetugid	75
119 #define	S10_SYS_fsat		76
120 #define	S10_SYS_rmdir		79
121 #define	S10_SYS_poll		87
122 #define	S10_SYS_lstat		88
123 #define	S10_SYS_fchown		94
124 #define	S10_SYS_xstat		123
125 #define	S10_SYS_lxstat		124
126 #define	S10_SYS_fxstat		125
127 #define	S10_SYS_xmknod		126
128 #define	S10_SYS_lchown		130
129 #define	S10_SYS_rename		134
130 #define	S10_SYS_fork1		143
131 #define	S10_SYS_lwp_sema_wait	147
132 #define	S10_SYS_utimes		154
133 #define	S10_SYS_lwp_mutex_lock	169
134 #define	S10_SYS_stat64		215
135 #define	S10_SYS_lstat64		216
136 #define	S10_SYS_fstat64		217
137 #define	S10_SYS_creat64		224
138 #define	S10_SYS_open64		225
139 
140 /*
141  * solaris10-brand-specific attributes
142  * These must start at ZONE_ATTR_BRAND_ATTRS.
143  */
144 #define	S10_EMUL_BITMAP		ZONE_ATTR_BRAND_ATTRS
145 
146 /*
147  * s10_emul_bitmap represents an emulation feature bitmap.  Each constant
148  * in s10_emulated_features defines a bit index in this bitmap.  If a bit is
149  * set, then the feature associated with the s10_emulated_features constant
150  * whose value is the bit's index is present in the associated zone's hosted
151  * Solaris 10 environment.
152  *
153  * NOTE: There must be at least one byte in the bitmap.
154  *
155  * We don't use the bitmap macros provided by usr/src/uts/common/sys/bitmap.h
156  * because they operate on ulong_t arrays.  The size of a ulong_t depends on
157  * the data model in which the code that declares the ulong_t is compiled:
158  * four bytes on 32-bit architectures and eight bytes 64-bit architectures.
159  * If the kernel is 64-bit and a 32-bit process executes in a solaris10-
160  * branded zone, then if the process' emulation library, which is 32-bit,
161  * queries the kernel for the zone's emulation bitmap, then the kernel will
162  * refuse because the library will request a bitmap that's half as big
163  * as the bitmap the kernel provides.  The 32-bit emulation library would need
164  * its own macros to define and operate on bitmaps with 64-bit array elements.
165  * Thus using the sys/bitmap.h macros is probably more troublesome than
166  * defining and using our own constants and macros for bitmap manipulations.
167  */
168 typedef uint8_t s10_emul_bitmap_t[(S10_NUM_EMUL_FEATURES >> 3) + 1];
169 
170 #if defined(_KERNEL)
171 
172 /* brand specific data */
173 typedef struct s10_zone_data {
174 	/*
175 	 * emul_bitmap specifies the features that are present in the
176 	 * associated zone.
177 	 */
178 	s10_emul_bitmap_t	emul_bitmap;
179 } s10_zone_data_t;
180 
181 void s10_brand_syscall_callback(void);
182 void s10_brand_syscall32_callback(void);
183 
184 #if !defined(sparc)
185 void s10_brand_sysenter_callback(void);
186 #endif /* !sparc */
187 
188 #if defined(__amd64)
189 void s10_brand_int91_callback(void);
190 #endif /* __amd64 */
191 #endif /* _KERNEL */
192 
193 #ifdef	__cplusplus
194 }
195 #endif
196 
197 #endif	/* _S10_BRAND_H */
198