1*e127a3e7Sraf /* 2*e127a3e7Sraf * CDDL HEADER START 3*e127a3e7Sraf * 4*e127a3e7Sraf * The contents of this file are subject to the terms of the 5*e127a3e7Sraf * Common Development and Distribution License (the "License"). 6*e127a3e7Sraf * You may not use this file except in compliance with the License. 7*e127a3e7Sraf * 8*e127a3e7Sraf * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*e127a3e7Sraf * or http://www.opensolaris.org/os/licensing. 10*e127a3e7Sraf * See the License for the specific language governing permissions 11*e127a3e7Sraf * and limitations under the License. 12*e127a3e7Sraf * 13*e127a3e7Sraf * When distributing Covered Code, include this CDDL HEADER in each 14*e127a3e7Sraf * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*e127a3e7Sraf * If applicable, add the following below this CDDL HEADER, with the 16*e127a3e7Sraf * fields enclosed by brackets "[]" replaced with your own identifying 17*e127a3e7Sraf * information: Portions Copyright [yyyy] [name of copyright owner] 18*e127a3e7Sraf * 19*e127a3e7Sraf * CDDL HEADER END 20*e127a3e7Sraf */ 21*e127a3e7Sraf 22*e127a3e7Sraf /* 23*e127a3e7Sraf * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24*e127a3e7Sraf * Use is subject to license terms. 25*e127a3e7Sraf */ 26*e127a3e7Sraf 27*e127a3e7Sraf #pragma ident "%Z%%M% %I% %E% SMI" 28*e127a3e7Sraf 29*e127a3e7Sraf #include <sys/types.h> 30*e127a3e7Sraf 31*e127a3e7Sraf /* 32*e127a3e7Sraf * In order to let the DTrace fasttrap provider trace processes before libc 33*e127a3e7Sraf * is initialized, we place this structure in the thread pointer register. 34*e127a3e7Sraf * This is communicated to the kernel (in the elfexec() function) by 35*e127a3e7Sraf * placing the address of this structure in the PT_SUNWDTRACE program 36*e127a3e7Sraf * header with the -zdtrace_data=<object> option to ld(1). 37*e127a3e7Sraf * 38*e127a3e7Sraf * Besides DTrace use, the initialization sequence carried out for the 39*e127a3e7Sraf * PT_SUNWDTRACE data is an essential step required for the correct 40*e127a3e7Sraf * initialization of any process. Therefore, PT_SUNWDTRACE data must 41*e127a3e7Sraf * exist in any interpretor available on Solaris. 42*e127a3e7Sraf * 43*e127a3e7Sraf * ld.so.1 is the standard interpretor on all Solaris platforms. However, 44*e127a3e7Sraf * for ABI compliance, 32-bit executables are able to identify libc.so.1 45*e127a3e7Sraf * as their interpretor. Therefore, this data file is used to build all 46*e127a3e7Sraf * instances of ld.so.1, and the 32-bit versions of libc.so.1. Note, 47*e127a3e7Sraf * although libc.so.1 can act as an interpretor for 32-bit applications, 48*e127a3e7Sraf * libc.so.1 only provides a bootstrap mechanism to load and jump to 49*e127a3e7Sraf * ld.so.1. 50*e127a3e7Sraf * 51*e127a3e7Sraf * The fields of the program header are set as follows: 52*e127a3e7Sraf * p_type: PT_SUNWDTRACE 53*e127a3e7Sraf * p_vaddr: address of dtrace_data 54*e127a3e7Sraf * p_memsz: size of dtrace_data 55*e127a3e7Sraf * p_flags: flags of segment dtrace_data is assigned to 56*e127a3e7Sraf * p_paddr: <reserved> 57*e127a3e7Sraf * p_filesz: <reserved> 58*e127a3e7Sraf * p_offset: <reserved> 59*e127a3e7Sraf * p_align: <reserved> 60*e127a3e7Sraf * 61*e127a3e7Sraf * See the comment in fasttrap.h for information on how to safely change 62*e127a3e7Sraf * this data structure and the other places that need to be kept in sync. 63*e127a3e7Sraf */ 64*e127a3e7Sraf 65*e127a3e7Sraf #if defined(__sparc) 66*e127a3e7Sraf 67*e127a3e7Sraf #pragma align 64(dtrace_data) 68*e127a3e7Sraf uint32_t dtrace_data[32] = { 69*e127a3e7Sraf 0, 0, 0, 0, 0, 0, 0, 0, 70*e127a3e7Sraf 0, 0, 0, 0, 0, 0, 0, 0, 71*e127a3e7Sraf 0x9de04000, /* save %g1, %g0, %sp */ 72*e127a3e7Sraf 0x81e80000, /* restore %g0, %g0, %g0 */ 73*e127a3e7Sraf 0x91d0203a, /* ta 0x3a */ 74*e127a3e7Sraf 0x81ca0000, /* return %o0 */ 75*e127a3e7Sraf 0, 0, /* self pointer (must be zero) */ 76*e127a3e7Sraf 0, 0, 77*e127a3e7Sraf 0, 0, 0, 0, 0, 0, 0, 0 78*e127a3e7Sraf }; 79*e127a3e7Sraf 80*e127a3e7Sraf #elif defined(__amd64) 81*e127a3e7Sraf 82*e127a3e7Sraf #pragma align 64(dtrace_data) 83*e127a3e7Sraf uint8_t dtrace_data[64] = { 84*e127a3e7Sraf 0, 0, 0, 0, 0, 0, 0, 0, /* self pointer (must be zero) */ 85*e127a3e7Sraf 0, 0, 0, 0, 0, 0, 0, 0, 86*e127a3e7Sraf 0, 0, 0, 0, 0, 0, 0, 0, 87*e127a3e7Sraf 0, 0, 0, 0, 0, 0, 0, 0, 88*e127a3e7Sraf 0, 0, 0, 0, 0, 0, 0, 0, 89*e127a3e7Sraf 0, 0, 0, 0, 0, 0, 0, 0, 90*e127a3e7Sraf 0, 0, 0, 0, 0, 0, 0, 0, 91*e127a3e7Sraf 0, 0, 0, 0, 0, 0, 0, 0 92*e127a3e7Sraf }; 93*e127a3e7Sraf 94*e127a3e7Sraf #elif defined(__i386) 95*e127a3e7Sraf 96*e127a3e7Sraf #pragma align 64(dtrace_data) 97*e127a3e7Sraf uint8_t dtrace_data[64] = { 98*e127a3e7Sraf 0, 0, 0, 0, /* self pointer (must be zero) */ 99*e127a3e7Sraf 0, 0, 0, 0, 100*e127a3e7Sraf 0, 0, 0, 0, 0, 0, 0, 0, 101*e127a3e7Sraf 0, 0, 0, 0, 0, 0, 0, 0, 102*e127a3e7Sraf 0, 0, 0, 0, 0, 0, 0, 0, 103*e127a3e7Sraf 0, 0, 0, 0, 0, 0, 0, 0, 104*e127a3e7Sraf 0, 0, 0, 0, 0, 0, 0, 0, 105*e127a3e7Sraf 0, 0, 0, 0, 0, 0, 0, 0, 106*e127a3e7Sraf 0, 0, 0, 0, 0, 0, 0, 0 107*e127a3e7Sraf }; 108*e127a3e7Sraf 109*e127a3e7Sraf #else 110*e127a3e7Sraf 111*e127a3e7Sraf #error "unknown ISA" 112*e127a3e7Sraf 113*e127a3e7Sraf #endif 114