10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*2712Snn35248 * Common Development and Distribution License (the "License"). 6*2712Snn35248 * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*2712Snn35248 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _ELF_ELF_IMPL_H 270Sstevel@tonic-gate #define _ELF_ELF_IMPL_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 300Sstevel@tonic-gate 310Sstevel@tonic-gate #ifdef __cplusplus 320Sstevel@tonic-gate extern "C" { 330Sstevel@tonic-gate #endif 340Sstevel@tonic-gate 350Sstevel@tonic-gate #if !defined(_LP64) || defined(_ELF32_COMPAT) 360Sstevel@tonic-gate 370Sstevel@tonic-gate /* 380Sstevel@tonic-gate * Definitions for ELF32, native 32-bit or 32-bit compatibility mode. 390Sstevel@tonic-gate */ 400Sstevel@tonic-gate #define ELFCLASS ELFCLASS32 410Sstevel@tonic-gate typedef unsigned int aux_val_t; 420Sstevel@tonic-gate typedef auxv32_t aux_entry_t; 430Sstevel@tonic-gate 440Sstevel@tonic-gate #define USR_LIB_RTLD "/usr/lib/ld.so.1" 450Sstevel@tonic-gate 460Sstevel@tonic-gate #else /* !_LP64 || _ELF32_COMPAT */ 470Sstevel@tonic-gate 480Sstevel@tonic-gate /* 490Sstevel@tonic-gate * Definitions for native 64-bit ELF 500Sstevel@tonic-gate */ 510Sstevel@tonic-gate #define ELFCLASS ELFCLASS64 520Sstevel@tonic-gate typedef unsigned long aux_val_t; 530Sstevel@tonic-gate typedef auxv_t aux_entry_t; 540Sstevel@tonic-gate 550Sstevel@tonic-gate /* put defines for 64-bit architectures here */ 560Sstevel@tonic-gate #if defined(__sparcv9) 570Sstevel@tonic-gate #define USR_LIB_RTLD "/usr/lib/sparcv9/ld.so.1" 580Sstevel@tonic-gate #endif 590Sstevel@tonic-gate 600Sstevel@tonic-gate #if defined(__amd64) 610Sstevel@tonic-gate #define USR_LIB_RTLD "/usr/lib/amd64/ld.so.1" 620Sstevel@tonic-gate #endif 630Sstevel@tonic-gate 640Sstevel@tonic-gate #endif /* !_LP64 || _ELF32_COMPAT */ 650Sstevel@tonic-gate 660Sstevel@tonic-gate /* 670Sstevel@tonic-gate * Start of an ELF Note. 680Sstevel@tonic-gate */ 690Sstevel@tonic-gate typedef struct { 700Sstevel@tonic-gate Nhdr nhdr; 710Sstevel@tonic-gate char name[8]; 720Sstevel@tonic-gate } Note; 730Sstevel@tonic-gate 740Sstevel@tonic-gate #ifdef _ELF32_COMPAT 750Sstevel@tonic-gate /* 760Sstevel@tonic-gate * These are defined only for the 32-bit compatibility 770Sstevel@tonic-gate * compilation mode of the 64-bit kernel. 780Sstevel@tonic-gate */ 790Sstevel@tonic-gate #define elfexec elf32exec 800Sstevel@tonic-gate #define elfnote elf32note 810Sstevel@tonic-gate #define elfcore elf32core 82*2712Snn35248 #define mapexec_brand mapexec32_brand 830Sstevel@tonic-gate #define setup_note_header setup_note_header32 840Sstevel@tonic-gate #define write_elfnotes write_elfnotes32 850Sstevel@tonic-gate #define setup_old_note_header setup_old_note_header32 860Sstevel@tonic-gate #define write_old_elfnotes write_old_elfnotes32 870Sstevel@tonic-gate 880Sstevel@tonic-gate #if defined(__sparc) 890Sstevel@tonic-gate #define gwindows_t gwindows32_t 900Sstevel@tonic-gate #define rwindow rwindow32 910Sstevel@tonic-gate #endif 920Sstevel@tonic-gate 930Sstevel@tonic-gate #define psinfo_t psinfo32_t 940Sstevel@tonic-gate #define pstatus_t pstatus32_t 950Sstevel@tonic-gate #define lwpsinfo_t lwpsinfo32_t 960Sstevel@tonic-gate #define lwpstatus_t lwpstatus32_t 970Sstevel@tonic-gate 980Sstevel@tonic-gate #define prgetpsinfo prgetpsinfo32 990Sstevel@tonic-gate #define prgetstatus prgetstatus32 1000Sstevel@tonic-gate #define prgetlwpsinfo prgetlwpsinfo32 1010Sstevel@tonic-gate #define prgetlwpstatus prgetlwpstatus32 1020Sstevel@tonic-gate #define prgetwindows prgetwindows32 1030Sstevel@tonic-gate 1040Sstevel@tonic-gate #define prpsinfo_t prpsinfo32_t 1050Sstevel@tonic-gate #define prstatus_t prstatus32_t 1060Sstevel@tonic-gate #if defined(prfpregset_t) 1070Sstevel@tonic-gate #undef prfpregset_t 1080Sstevel@tonic-gate #endif 1090Sstevel@tonic-gate #define prfpregset_t prfpregset32_t 1100Sstevel@tonic-gate 1110Sstevel@tonic-gate #define oprgetstatus oprgetstatus32 1120Sstevel@tonic-gate #define oprgetpsinfo oprgetpsinfo32 1130Sstevel@tonic-gate #define prgetprfpregs prgetprfpregs32 1140Sstevel@tonic-gate 1150Sstevel@tonic-gate #endif /* _ELF32_COMPAT */ 1160Sstevel@tonic-gate 1170Sstevel@tonic-gate extern int elfnote(vnode_t *, offset_t *, int, int, void *, rlim64_t, cred_t *); 1180Sstevel@tonic-gate extern void setup_old_note_header(Phdr *, proc_t *); 1190Sstevel@tonic-gate extern void setup_note_header(Phdr *, proc_t *); 1200Sstevel@tonic-gate 1210Sstevel@tonic-gate extern int write_old_elfnotes(proc_t *, int, vnode_t *, offset_t, 1220Sstevel@tonic-gate rlim64_t, cred_t *); 1230Sstevel@tonic-gate 1240Sstevel@tonic-gate extern int write_elfnotes(proc_t *, int, vnode_t *, offset_t, 1250Sstevel@tonic-gate rlim64_t, cred_t *, core_content_t); 1260Sstevel@tonic-gate 1270Sstevel@tonic-gate #ifdef __cplusplus 1280Sstevel@tonic-gate } 1290Sstevel@tonic-gate #endif 1300Sstevel@tonic-gate 1310Sstevel@tonic-gate #endif /* _ELF_ELF_IMPL_H */ 132