xref: /illumos-gate/usr/src/uts/common/brand/sn1/sn1_brand.h (revision 581cede61ac9c14d8d4ea452562a567189eead78)
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 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SN1_BRAND_H
27 #define	_SN1_BRAND_H
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 #include <sys/types.h>
34 
35 #define	SN1_BRANDNAME		"sn1"
36 
37 #define	SN1_VERSION_1		1
38 #define	SN1_VERSION		SN1_VERSION_1
39 
40 #define	SN1_NATIVE_DIR		"/.SUNWnative/"
41 #define	SN1_LIB_NAME		"sn1_brand.so.1"
42 #define	SN1_LINKER_NAME		"ld.so.1"
43 
44 #define	SN1_LIB32		SN1_NATIVE_DIR "usr/lib/" SN1_LIB_NAME
45 #define	SN1_LINKER32		"/lib/" SN1_LINKER_NAME
46 
47 #define	SN1_LIB64		SN1_NATIVE_DIR "usr/lib/64/" SN1_LIB_NAME
48 #define	SN1_LINKER64		"/lib/64/" SN1_LINKER_NAME
49 
50 #if defined(_LP64)
51 #define	SN1_LIB		SN1_LIB64
52 #define	SN1_LINKER	SN1_LINKER64
53 #else /* !_LP64 */
54 #define	SN1_LIB		SN1_LIB32
55 #define	SN1_LINKER	SN1_LINKER32
56 #endif /* !_LP64 */
57 
58 /*
59  * Aux vector containing lddata pointer of brand library linkmap.
60  * Used by lx_librtld_db.
61  */
62 #define	AT_SUN_BRAND_SN1_LDDATA		AT_SUN_BRAND_AUX1
63 
64 /*
65  * Information needed by the sn1 library to launch an executable.
66  */
67 typedef struct sn1_elf_data {
68 	ulong_t		sed_phdr;
69 	ulong_t		sed_phent;
70 	ulong_t		sed_phnum;
71 	ulong_t		sed_entry;
72 	ulong_t		sed_base;
73 	ulong_t		sed_ldentry;
74 	ulong_t		sed_lddata;
75 } sn1_elf_data_t;
76 
77 /*
78  * Structure used to register a branded processes
79  */
80 typedef struct sn1_brand_reg {
81 	uint_t		sbr_version;	/* version number */
82 	caddr_t		sbr_handler;	/* base address of handler */
83 } sn1_brand_reg_t;
84 
85 #if defined(_KERNEL)
86 #if defined(_SYSCALL32)
87 typedef struct sn1_elf_data32 {
88 	uint32_t	sed_phdr;
89 	uint32_t	sed_phent;
90 	uint32_t	sed_phnum;
91 	uint32_t	sed_entry;
92 	uint32_t	sed_base;
93 	uint32_t	sed_ldentry;
94 	uint32_t	sed_lddata;
95 } sn1_elf_data32_t;
96 
97 typedef struct sn1_brand_reg32 {
98 	uint32_t	sbr_version;	/* version number */
99 	caddr32_t	sbr_handler;	/* base address of handler */
100 } sn1_brand_reg32_t;
101 #endif /* _SYSCALL32 */
102 
103 /*
104  * Information associated with all sn1 branded processes
105  */
106 typedef struct sn1_proc_data {
107 	caddr_t		spd_handler;	/* address of user-space handler */
108 	sn1_elf_data_t	spd_elf_data;	/* ELF data for sn1 application */
109 } sn1_proc_data_t;
110 
111 void sn1_brand_syscall_callback(void);
112 void sn1_brand_syscall32_callback(void);
113 
114 #if !defined(sparc)
115 void sn1_brand_sysenter_callback(void);
116 #endif /* !sparc */
117 
118 #if defined(__amd64)
119 void sn1_brand_int91_callback(void);
120 #endif /* __amd64 */
121 #endif /* _KERNEL */
122 
123 #ifdef	__cplusplus
124 }
125 #endif
126 
127 #endif	/* _SN1_BRAND_H */
128