summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/exec/elf/elf_impl.h
blob: 010d5e6256108c0b0d9fae402580725d9114154d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef _ELF_ELF_IMPL_H
#define	_ELF_ELF_IMPL_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"

#ifdef	__cplusplus
extern "C" {
#endif

#if	!defined(_LP64) || defined(_ELF32_COMPAT)

/*
 * Definitions for ELF32, native 32-bit or 32-bit compatibility mode.
 */
#define	ELFCLASS	ELFCLASS32
typedef	unsigned int	aux_val_t;
typedef	auxv32_t	aux_entry_t;

#define	USR_LIB_RTLD	"/usr/lib/ld.so.1"

#else	/* !_LP64 || _ELF32_COMPAT */

/*
 * Definitions for native 64-bit ELF
 */
#define	ELFCLASS	ELFCLASS64
typedef	unsigned long	aux_val_t;
typedef	auxv_t		aux_entry_t;

/* put defines for 64-bit architectures here */
#if defined(__sparcv9)
#define	USR_LIB_RTLD	"/usr/lib/sparcv9/ld.so.1"
#endif

#if defined(__amd64)
#define	USR_LIB_RTLD	"/usr/lib/amd64/ld.so.1"
#endif

#endif	/* !_LP64 || _ELF32_COMPAT */

/*
 * Start of an ELF Note.
 */
typedef struct {
	Nhdr	nhdr;
	char	name[8];
} Note;

#ifdef	_ELF32_COMPAT
/*
 * These are defined only for the 32-bit compatibility
 * compilation mode of the 64-bit kernel.
 */
#define	elfexec	elf32exec
#define	elfnote	elf32note
#define	elfcore	elf32core
#define	mapexec_brand		mapexec32_brand
#define	setup_note_header	setup_note_header32
#define	write_elfnotes		write_elfnotes32
#define	setup_old_note_header	setup_old_note_header32
#define	write_old_elfnotes	write_old_elfnotes32

#if defined(__sparc)
#define	gwindows_t	gwindows32_t
#define	rwindow		rwindow32
#endif

#define	psinfo_t	psinfo32_t
#define	pstatus_t	pstatus32_t
#define	lwpsinfo_t	lwpsinfo32_t
#define	lwpstatus_t	lwpstatus32_t

#define	prgetpsinfo	prgetpsinfo32
#define	prgetstatus	prgetstatus32
#define	prgetlwpsinfo	prgetlwpsinfo32
#define	prgetlwpstatus	prgetlwpstatus32
#define	prgetwindows	prgetwindows32

#define	prpsinfo_t	prpsinfo32_t
#define	prstatus_t	prstatus32_t
#if defined(prfpregset_t)
#undef prfpregset_t
#endif
#define	prfpregset_t	prfpregset32_t

#define	oprgetstatus	oprgetstatus32
#define	oprgetpsinfo	oprgetpsinfo32
#define	prgetprfpregs	prgetprfpregs32

#endif	/*	_ELF32_COMPAT	*/

extern int elfnote(vnode_t *, offset_t *, int, int, void *, rlim64_t, cred_t *);
extern void setup_old_note_header(Phdr *, proc_t *);
extern void setup_note_header(Phdr *, proc_t *);

extern int write_old_elfnotes(proc_t *, int, vnode_t *, offset_t,
    rlim64_t, cred_t *);

extern int write_elfnotes(proc_t *, int, vnode_t *, offset_t,
    rlim64_t, cred_t *, core_content_t);

#ifdef	__cplusplus
}
#endif

#endif	/* _ELF_ELF_IMPL_H */