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 2009 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _S10_BRAND_H 27 #define _S10_BRAND_H 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 #include <sys/types.h> 34 35 #define S10_BRANDNAME "solaris10" 36 37 #define S10_VERSION_1 1 38 #define S10_VERSION S10_VERSION_1 39 40 #define S10_NATIVE_DIR "/.SUNWnative/" 41 #define S10_LIB_NAME "s10_brand.so.1" 42 #define S10_LINKER_NAME "ld.so.1" 43 44 #define S10_LIB32 S10_NATIVE_DIR "usr/lib/" S10_LIB_NAME 45 #define S10_LINKER32 "/lib/" S10_LINKER_NAME 46 #define S10_NATIVE_LINKER32 S10_NATIVE_DIR "lib/" S10_LINKER_NAME 47 48 #define S10_LIB64 S10_NATIVE_DIR "usr/lib/64/" S10_LIB_NAME 49 #define S10_LINKER64 "/lib/64/" S10_LINKER_NAME 50 #define S10_NATIVE_LINKER64 S10_NATIVE_DIR "lib/64/" S10_LINKER_NAME 51 52 #if defined(_LP64) 53 #define S10_LIB S10_LIB64 54 #define S10_LINKER S10_LINKER64 55 #else /* !_LP64 */ 56 #define S10_LIB S10_LIB32 57 #define S10_LINKER S10_LINKER32 58 #endif /* !_LP64 */ 59 60 /* 61 * Brand system call subcodes. 0-127 are reserved for generic subcodes. 62 */ 63 #define B_S10_PIDINFO 128 64 #define B_S10_TRUSS_POINT 129 65 #define B_S10_NATIVE 130 66 #define B_S10_FSREGCORRECTION 131 67 68 /* 69 * s10_brand_syscall_callback_common() needs to save 4 local registers so it 70 * can free them up for its own use. 71 */ 72 #define S10_CPU_REG_SAVE_SIZE (sizeof (ulong_t) * 4) 73 74 /* 75 * Aux vector containing lddata pointer of brand library linkmap. 76 * Used by s10_librtld_db. 77 */ 78 #define AT_SUN_BRAND_S10_LDDATA AT_SUN_BRAND_AUX1 79 80 /* 81 * S10 system call codes for S10 traps that have been removed or 82 * re-assigned. 83 */ 84 #define S10_SYS_issetugid 75 85 86 /* 87 * S10 brand emulation versions are used to trigger different behavior 88 * based on the version of S10 installed in the zone. 89 */ 90 #define S10_EMUL_UNDEF -1 91 92 #define S10_EMUL_VERSION_NUM ZONE_ATTR_BRAND_ATTRS 93 94 /* 95 * Information needed by the s10 library to launch an executable. 96 */ 97 typedef struct s10_elf_data { 98 ulong_t sed_phdr; 99 ulong_t sed_phent; 100 ulong_t sed_phnum; 101 ulong_t sed_entry; 102 ulong_t sed_base; 103 ulong_t sed_ldentry; 104 ulong_t sed_lddata; 105 } s10_elf_data_t; 106 107 /* 108 * Structure used to register a branded processes 109 */ 110 typedef struct s10_brand_reg { 111 uint_t sbr_version; /* version number */ 112 caddr_t sbr_handler; /* base address of handler */ 113 } s10_brand_reg_t; 114 115 #if defined(_KERNEL) 116 #if defined(_SYSCALL32) 117 typedef struct s10_elf_data32 { 118 uint32_t sed_phdr; 119 uint32_t sed_phent; 120 uint32_t sed_phnum; 121 uint32_t sed_entry; 122 uint32_t sed_base; 123 uint32_t sed_ldentry; 124 uint32_t sed_lddata; 125 } s10_elf_data32_t; 126 127 typedef struct s10_brand_reg32 { 128 uint32_t sbr_version; /* version number */ 129 caddr32_t sbr_handler; /* base address of handler */ 130 } s10_brand_reg32_t; 131 #endif /* _SYSCALL32 */ 132 133 /* 134 * Information associated with all s10 branded processes 135 */ 136 typedef struct s10_proc_data { 137 caddr_t spd_handler; /* address of user-space handler */ 138 s10_elf_data_t spd_elf_data; /* ELF data for s10 application */ 139 } s10_proc_data_t; 140 141 /* brand specific data */ 142 typedef struct s10_zone_data { 143 int s10zd_emul_version; 144 } s10_zone_data_t; 145 146 void s10_brand_syscall_callback(void); 147 void s10_brand_syscall32_callback(void); 148 149 #if !defined(sparc) 150 void s10_brand_sysenter_callback(void); 151 #endif /* !sparc */ 152 153 #if defined(__amd64) 154 void s10_brand_int91_callback(void); 155 #endif /* __amd64 */ 156 #endif /* _KERNEL */ 157 158 #ifdef __cplusplus 159 } 160 #endif 161 162 #endif /* _S10_BRAND_H */ 163