xref: /onnv-gate/usr/src/uts/common/exec/elf/elf_impl.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef _ELF_ELF_IMPL_H
28*0Sstevel@tonic-gate #define	_ELF_ELF_IMPL_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifdef	__cplusplus
33*0Sstevel@tonic-gate extern "C" {
34*0Sstevel@tonic-gate #endif
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate #if	!defined(_LP64) || defined(_ELF32_COMPAT)
37*0Sstevel@tonic-gate 
38*0Sstevel@tonic-gate /*
39*0Sstevel@tonic-gate  * Definitions for ELF32, native 32-bit or 32-bit compatibility mode.
40*0Sstevel@tonic-gate  */
41*0Sstevel@tonic-gate #define	ELFCLASS	ELFCLASS32
42*0Sstevel@tonic-gate typedef	unsigned int	aux_val_t;
43*0Sstevel@tonic-gate typedef	auxv32_t	aux_entry_t;
44*0Sstevel@tonic-gate 
45*0Sstevel@tonic-gate #define	USR_LIB_RTLD	"/usr/lib/ld.so.1"
46*0Sstevel@tonic-gate 
47*0Sstevel@tonic-gate #else	/* !_LP64 || _ELF32_COMPAT */
48*0Sstevel@tonic-gate 
49*0Sstevel@tonic-gate /*
50*0Sstevel@tonic-gate  * Definitions for native 64-bit ELF
51*0Sstevel@tonic-gate  */
52*0Sstevel@tonic-gate #define	ELFCLASS	ELFCLASS64
53*0Sstevel@tonic-gate typedef	unsigned long	aux_val_t;
54*0Sstevel@tonic-gate typedef	auxv_t		aux_entry_t;
55*0Sstevel@tonic-gate 
56*0Sstevel@tonic-gate /* put defines for 64-bit architectures here */
57*0Sstevel@tonic-gate #if defined(__sparcv9)
58*0Sstevel@tonic-gate #define	USR_LIB_RTLD	"/usr/lib/sparcv9/ld.so.1"
59*0Sstevel@tonic-gate #endif
60*0Sstevel@tonic-gate 
61*0Sstevel@tonic-gate #if defined(__amd64)
62*0Sstevel@tonic-gate #define	USR_LIB_RTLD	"/usr/lib/amd64/ld.so.1"
63*0Sstevel@tonic-gate #endif
64*0Sstevel@tonic-gate 
65*0Sstevel@tonic-gate #endif	/* !_LP64 || _ELF32_COMPAT */
66*0Sstevel@tonic-gate 
67*0Sstevel@tonic-gate /*
68*0Sstevel@tonic-gate  * Start of an ELF Note.
69*0Sstevel@tonic-gate  */
70*0Sstevel@tonic-gate typedef struct {
71*0Sstevel@tonic-gate 	Nhdr	nhdr;
72*0Sstevel@tonic-gate 	char	name[8];
73*0Sstevel@tonic-gate } Note;
74*0Sstevel@tonic-gate 
75*0Sstevel@tonic-gate #ifdef	_ELF32_COMPAT
76*0Sstevel@tonic-gate /*
77*0Sstevel@tonic-gate  * These are defined only for the 32-bit compatibility
78*0Sstevel@tonic-gate  * compilation mode of the 64-bit kernel.
79*0Sstevel@tonic-gate  */
80*0Sstevel@tonic-gate #define	elfexec	elf32exec
81*0Sstevel@tonic-gate #define	elfnote	elf32note
82*0Sstevel@tonic-gate #define	elfcore	elf32core
83*0Sstevel@tonic-gate #define	setup_note_header	setup_note_header32
84*0Sstevel@tonic-gate #define	write_elfnotes		write_elfnotes32
85*0Sstevel@tonic-gate #define	setup_old_note_header	setup_old_note_header32
86*0Sstevel@tonic-gate #define	write_old_elfnotes	write_old_elfnotes32
87*0Sstevel@tonic-gate 
88*0Sstevel@tonic-gate #if defined(__sparc)
89*0Sstevel@tonic-gate #define	gwindows_t	gwindows32_t
90*0Sstevel@tonic-gate #define	rwindow		rwindow32
91*0Sstevel@tonic-gate #endif
92*0Sstevel@tonic-gate 
93*0Sstevel@tonic-gate #define	psinfo_t	psinfo32_t
94*0Sstevel@tonic-gate #define	pstatus_t	pstatus32_t
95*0Sstevel@tonic-gate #define	lwpsinfo_t	lwpsinfo32_t
96*0Sstevel@tonic-gate #define	lwpstatus_t	lwpstatus32_t
97*0Sstevel@tonic-gate 
98*0Sstevel@tonic-gate #define	prgetpsinfo	prgetpsinfo32
99*0Sstevel@tonic-gate #define	prgetstatus	prgetstatus32
100*0Sstevel@tonic-gate #define	prgetlwpsinfo	prgetlwpsinfo32
101*0Sstevel@tonic-gate #define	prgetlwpstatus	prgetlwpstatus32
102*0Sstevel@tonic-gate #define	prgetwindows	prgetwindows32
103*0Sstevel@tonic-gate 
104*0Sstevel@tonic-gate #define	prpsinfo_t	prpsinfo32_t
105*0Sstevel@tonic-gate #define	prstatus_t	prstatus32_t
106*0Sstevel@tonic-gate #if defined(prfpregset_t)
107*0Sstevel@tonic-gate #undef prfpregset_t
108*0Sstevel@tonic-gate #endif
109*0Sstevel@tonic-gate #define	prfpregset_t	prfpregset32_t
110*0Sstevel@tonic-gate 
111*0Sstevel@tonic-gate #define	oprgetstatus	oprgetstatus32
112*0Sstevel@tonic-gate #define	oprgetpsinfo	oprgetpsinfo32
113*0Sstevel@tonic-gate #define	prgetprfpregs	prgetprfpregs32
114*0Sstevel@tonic-gate 
115*0Sstevel@tonic-gate #endif	/*	_ELF32_COMPAT	*/
116*0Sstevel@tonic-gate 
117*0Sstevel@tonic-gate extern int elfnote(vnode_t *, offset_t *, int, int, void *, rlim64_t, cred_t *);
118*0Sstevel@tonic-gate extern void setup_old_note_header(Phdr *, proc_t *);
119*0Sstevel@tonic-gate extern void setup_note_header(Phdr *, proc_t *);
120*0Sstevel@tonic-gate 
121*0Sstevel@tonic-gate extern int write_old_elfnotes(proc_t *, int, vnode_t *, offset_t,
122*0Sstevel@tonic-gate     rlim64_t, cred_t *);
123*0Sstevel@tonic-gate 
124*0Sstevel@tonic-gate extern int write_elfnotes(proc_t *, int, vnode_t *, offset_t,
125*0Sstevel@tonic-gate     rlim64_t, cred_t *, core_content_t);
126*0Sstevel@tonic-gate 
127*0Sstevel@tonic-gate #ifdef	__cplusplus
128*0Sstevel@tonic-gate }
129*0Sstevel@tonic-gate #endif
130*0Sstevel@tonic-gate 
131*0Sstevel@tonic-gate #endif	/* _ELF_ELF_IMPL_H */
132