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 /* 23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #include <sys/types.h> 28 29 /* 30 * In order to let the DTrace fasttrap provider trace processes before libc 31 * is initialized, we place this structure in the thread pointer register. 32 * This is communicated to the kernel (in the elfexec() function) by 33 * placing the address of this structure in the PT_SUNWDTRACE program 34 * header with the -zdtrace_data=<object> option to ld(1). 35 * 36 * Besides DTrace use, the initialization sequence carried out for the 37 * PT_SUNWDTRACE data is an essential step required for the correct 38 * initialization of any process. Therefore, PT_SUNWDTRACE data must 39 * exist in any interpretor available on Solaris. 40 * 41 * ld.so.1 is the standard interpretor on all Solaris platforms. However, 42 * for ABI compliance, 32-bit executables are able to identify libc.so.1 43 * as their interpretor. Therefore, this data file is used to build all 44 * instances of ld.so.1, and the 32-bit versions of libc.so.1. Note, 45 * although libc.so.1 can act as an interpretor for 32-bit applications, 46 * libc.so.1 only provides a bootstrap mechanism to load and jump to 47 * ld.so.1. 48 * 49 * The fields of the program header are set as follows: 50 * p_type: PT_SUNWDTRACE 51 * p_vaddr: address of dtrace_data 52 * p_memsz: size of dtrace_data 53 * p_flags: flags of segment dtrace_data is assigned to 54 * p_paddr: <reserved> 55 * p_filesz: <reserved> 56 * p_offset: <reserved> 57 * p_align: <reserved> 58 * 59 * See the comment in fasttrap.h for information on how to safely change 60 * this data structure and the other places that need to be kept in sync. 61 */ 62 63 #if defined(__sparc) 64 65 #pragma align 64(dtrace_data) 66 uint32_t dtrace_data[32] = { 67 0, 0, 0, 0, 0, 0, 0, 0, 68 0, 0, 0, 0, 0, 0, 0, 0, 69 0x9de04000, /* save %g1, %g0, %sp */ 70 0x81e80000, /* restore %g0, %g0, %g0 */ 71 0x91d0203a, /* ta 0x3a */ 72 0x81ca0000, /* return %o0 */ 73 0, 0, /* self pointer (must be zero) */ 74 0, 0, 75 0, 0, 0, 0, 0, 0, 0, 0 76 }; 77 78 #elif defined(__amd64) 79 80 #pragma align 64(dtrace_data) 81 uint8_t dtrace_data[64] = { 82 0, 0, 0, 0, 0, 0, 0, 0, /* self pointer (must be zero) */ 83 0, 0, 0, 0, 0, 0, 0, 0, 84 0, 0, 0, 0, 0, 0, 0, 0, 85 0, 0, 0, 0, 0, 0, 0, 0, 86 0, 0, 0, 0, 0, 0, 0, 0, 87 0, 0, 0, 0, 0, 0, 0, 0, 88 0, 0, 0, 0, 0, 0, 0, 0, 89 0, 0, 0, 0, 0, 0, 0, 0 90 }; 91 92 #elif defined(__i386) 93 94 #pragma align 64(dtrace_data) 95 uint8_t dtrace_data[64] = { 96 0, 0, 0, 0, /* self pointer (must be zero) */ 97 0, 0, 0, 0, 98 0, 0, 0, 0, 0, 0, 0, 0, 99 0, 0, 0, 0, 0, 0, 0, 0, 100 0, 0, 0, 0, 0, 0, 0, 0, 101 0, 0, 0, 0, 0, 0, 0, 0, 102 0, 0, 0, 0, 0, 0, 0, 0, 103 0, 0, 0, 0, 0, 0, 0, 0, 104 0, 0, 0, 0, 0, 0, 0, 0 105 }; 106 107 #else 108 109 #error "unknown ISA" 110 111 #endif 112