xref: /titanic_51/usr/src/uts/common/exec/elf/elf_impl.h (revision 9acbbeaf2a1ffe5c14b244867d427714fab43c5c)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*9acbbeafSnn35248  * Common Development and Distribution License (the "License").
6*9acbbeafSnn35248  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*9acbbeafSnn35248  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef _ELF_ELF_IMPL_H
277c478bd9Sstevel@tonic-gate #define	_ELF_ELF_IMPL_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #if	!defined(_LP64) || defined(_ELF32_COMPAT)
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate /*
387c478bd9Sstevel@tonic-gate  * Definitions for ELF32, native 32-bit or 32-bit compatibility mode.
397c478bd9Sstevel@tonic-gate  */
407c478bd9Sstevel@tonic-gate #define	ELFCLASS	ELFCLASS32
417c478bd9Sstevel@tonic-gate typedef	unsigned int	aux_val_t;
427c478bd9Sstevel@tonic-gate typedef	auxv32_t	aux_entry_t;
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate #define	USR_LIB_RTLD	"/usr/lib/ld.so.1"
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate #else	/* !_LP64 || _ELF32_COMPAT */
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate /*
497c478bd9Sstevel@tonic-gate  * Definitions for native 64-bit ELF
507c478bd9Sstevel@tonic-gate  */
517c478bd9Sstevel@tonic-gate #define	ELFCLASS	ELFCLASS64
527c478bd9Sstevel@tonic-gate typedef	unsigned long	aux_val_t;
537c478bd9Sstevel@tonic-gate typedef	auxv_t		aux_entry_t;
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate /* put defines for 64-bit architectures here */
567c478bd9Sstevel@tonic-gate #if defined(__sparcv9)
577c478bd9Sstevel@tonic-gate #define	USR_LIB_RTLD	"/usr/lib/sparcv9/ld.so.1"
587c478bd9Sstevel@tonic-gate #endif
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate #if defined(__amd64)
617c478bd9Sstevel@tonic-gate #define	USR_LIB_RTLD	"/usr/lib/amd64/ld.so.1"
627c478bd9Sstevel@tonic-gate #endif
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate #endif	/* !_LP64 || _ELF32_COMPAT */
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate /*
677c478bd9Sstevel@tonic-gate  * Start of an ELF Note.
687c478bd9Sstevel@tonic-gate  */
697c478bd9Sstevel@tonic-gate typedef struct {
707c478bd9Sstevel@tonic-gate 	Nhdr	nhdr;
717c478bd9Sstevel@tonic-gate 	char	name[8];
727c478bd9Sstevel@tonic-gate } Note;
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate #ifdef	_ELF32_COMPAT
757c478bd9Sstevel@tonic-gate /*
767c478bd9Sstevel@tonic-gate  * These are defined only for the 32-bit compatibility
777c478bd9Sstevel@tonic-gate  * compilation mode of the 64-bit kernel.
787c478bd9Sstevel@tonic-gate  */
797c478bd9Sstevel@tonic-gate #define	elfexec	elf32exec
807c478bd9Sstevel@tonic-gate #define	elfnote	elf32note
817c478bd9Sstevel@tonic-gate #define	elfcore	elf32core
82*9acbbeafSnn35248 #define	mapexec_brand		mapexec32_brand
837c478bd9Sstevel@tonic-gate #define	setup_note_header	setup_note_header32
847c478bd9Sstevel@tonic-gate #define	write_elfnotes		write_elfnotes32
857c478bd9Sstevel@tonic-gate #define	setup_old_note_header	setup_old_note_header32
867c478bd9Sstevel@tonic-gate #define	write_old_elfnotes	write_old_elfnotes32
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate #if defined(__sparc)
897c478bd9Sstevel@tonic-gate #define	gwindows_t	gwindows32_t
907c478bd9Sstevel@tonic-gate #define	rwindow		rwindow32
917c478bd9Sstevel@tonic-gate #endif
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate #define	psinfo_t	psinfo32_t
947c478bd9Sstevel@tonic-gate #define	pstatus_t	pstatus32_t
957c478bd9Sstevel@tonic-gate #define	lwpsinfo_t	lwpsinfo32_t
967c478bd9Sstevel@tonic-gate #define	lwpstatus_t	lwpstatus32_t
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate #define	prgetpsinfo	prgetpsinfo32
997c478bd9Sstevel@tonic-gate #define	prgetstatus	prgetstatus32
1007c478bd9Sstevel@tonic-gate #define	prgetlwpsinfo	prgetlwpsinfo32
1017c478bd9Sstevel@tonic-gate #define	prgetlwpstatus	prgetlwpstatus32
1027c478bd9Sstevel@tonic-gate #define	prgetwindows	prgetwindows32
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate #define	prpsinfo_t	prpsinfo32_t
1057c478bd9Sstevel@tonic-gate #define	prstatus_t	prstatus32_t
1067c478bd9Sstevel@tonic-gate #if defined(prfpregset_t)
1077c478bd9Sstevel@tonic-gate #undef prfpregset_t
1087c478bd9Sstevel@tonic-gate #endif
1097c478bd9Sstevel@tonic-gate #define	prfpregset_t	prfpregset32_t
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate #define	oprgetstatus	oprgetstatus32
1127c478bd9Sstevel@tonic-gate #define	oprgetpsinfo	oprgetpsinfo32
1137c478bd9Sstevel@tonic-gate #define	prgetprfpregs	prgetprfpregs32
1147c478bd9Sstevel@tonic-gate 
1157c478bd9Sstevel@tonic-gate #endif	/*	_ELF32_COMPAT	*/
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate extern int elfnote(vnode_t *, offset_t *, int, int, void *, rlim64_t, cred_t *);
1187c478bd9Sstevel@tonic-gate extern void setup_old_note_header(Phdr *, proc_t *);
1197c478bd9Sstevel@tonic-gate extern void setup_note_header(Phdr *, proc_t *);
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate extern int write_old_elfnotes(proc_t *, int, vnode_t *, offset_t,
1227c478bd9Sstevel@tonic-gate     rlim64_t, cred_t *);
1237c478bd9Sstevel@tonic-gate 
1247c478bd9Sstevel@tonic-gate extern int write_elfnotes(proc_t *, int, vnode_t *, offset_t,
1257c478bd9Sstevel@tonic-gate     rlim64_t, cred_t *, core_content_t);
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1287c478bd9Sstevel@tonic-gate }
1297c478bd9Sstevel@tonic-gate #endif
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate #endif	/* _ELF_ELF_IMPL_H */
132