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 2006 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #ifndef _ELF_ELF_IMPL_H
  27 #define _ELF_ELF_IMPL_H
  28 
  29 #ifdef  __cplusplus
  30 extern "C" {
  31 #endif
  32 
  33 #if     !defined(_LP64) || defined(_ELF32_COMPAT)
  34 
  35 /*
  36  * Definitions for ELF32, native 32-bit or 32-bit compatibility mode.
  37  */
  38 #define ELFCLASS        ELFCLASS32
  39 typedef unsigned int    aux_val_t;
  40 typedef auxv32_t        aux_entry_t;
  41 
  42 #define USR_LIB_RTLD    "/usr/lib/ld.so.1"
  43 
  44 #else   /* !_LP64 || _ELF32_COMPAT */
  45 
  46 /*
  47  * Definitions for native 64-bit ELF
  48  */
  49 #define ELFCLASS        ELFCLASS64
  50 typedef unsigned long   aux_val_t;
  51 typedef auxv_t          aux_entry_t;
  52 
  53 /* put defines for 64-bit architectures here */
  54 #if defined(__sparcv9)
  55 #define USR_LIB_RTLD    "/usr/lib/sparcv9/ld.so.1"
  56 #endif
  57 
  58 #if defined(__amd64)
  59 #define USR_LIB_RTLD    "/usr/lib/amd64/ld.so.1"
  60 #endif
  61 
  62 #endif  /* !_LP64 || _ELF32_COMPAT */
  63 
  64 /*
  65  * Start of an ELF Note.
  66  */
  67 typedef struct {
  68         Nhdr    nhdr;
  69         char    name[8];
  70 } Note;
  71 
  72 #ifdef  _ELF32_COMPAT
  73 /*
  74  * These are defined only for the 32-bit compatibility
  75  * compilation mode of the 64-bit kernel.
  76  */
  77 #define elfexec elf32exec
  78 #define elfnote elf32note
  79 #define elfcore elf32core
  80 #define mapexec_brand           mapexec32_brand
  81 #define setup_note_header       setup_note_header32
  82 #define write_elfnotes          write_elfnotes32
  83 #define setup_old_note_header   setup_old_note_header32
  84 #define write_old_elfnotes      write_old_elfnotes32
  85 
  86 #if defined(__sparc)
  87 #define gwindows_t      gwindows32_t
  88 #define rwindow         rwindow32
  89 #endif
  90 
  91 #define psinfo_t        psinfo32_t
  92 #define pstatus_t       pstatus32_t
  93 #define lwpsinfo_t      lwpsinfo32_t
  94 #define lwpstatus_t     lwpstatus32_t
  95 
  96 #define prgetpsinfo     prgetpsinfo32
  97 #define prgetstatus     prgetstatus32
  98 #define prgetlwpsinfo   prgetlwpsinfo32
  99 #define prgetlwpstatus  prgetlwpstatus32
 100 #define prgetwindows    prgetwindows32
 101 
 102 #define prpsinfo_t      prpsinfo32_t
 103 #define prstatus_t      prstatus32_t
 104 #if defined(prfpregset_t)
 105 #undef prfpregset_t
 106 #endif
 107 #define prfpregset_t    prfpregset32_t
 108 
 109 #define oprgetstatus    oprgetstatus32
 110 #define oprgetpsinfo    oprgetpsinfo32
 111 #define prgetprfpregs   prgetprfpregs32
 112 
 113 #endif  /*      _ELF32_COMPAT   */
 114 
 115 extern int elfnote(vnode_t *, offset_t *, int, int, void *, rlim64_t, cred_t *);
 116 extern void setup_old_note_header(Phdr *, proc_t *);
 117 extern void setup_note_header(Phdr *, proc_t *);
 118 
 119 extern int write_old_elfnotes(proc_t *, int, vnode_t *, offset_t,
 120     rlim64_t, cred_t *);
 121 
 122 extern int write_elfnotes(proc_t *, int, vnode_t *, offset_t,
 123     rlim64_t, cred_t *, core_content_t);
 124 
 125 #ifdef  __cplusplus
 126 }
 127 #endif
 128 
 129 #endif  /* _ELF_ELF_IMPL_H */