xref: /freebsd/sys/powerpc/include/elf.h (revision 9336e0699bda8a301cd2bfa37106b6ec5e32012e)
1 /*-
2  * Copyright (c) 2001 David E. O'Brien
3  * Copyright (c) 1996-1997 John D. Polstra.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  *
27  * $FreeBSD$
28  */
29 
30 #ifndef _MACHINE_ELF_H_
31 #define	_MACHINE_ELF_H_ 1
32 
33 /*
34  * EABI ELF definitions for the PowerPC architecture.
35  * See "PowerPC Embedded Application Binary Interface, 32-Bit Impliementation"
36  * [ppc-eabi-1995-01.pdf] for details.
37  */
38 
39 #include <sys/elf32.h>	/* Definitions common to all 32 bit architectures. */
40 
41 #define	__ELF_WORD_SIZE	32	/* Used by <sys/elf_generic.h> */
42 #include <sys/elf_generic.h>
43 
44 #define	ELF_ARCH	EM_PPC
45 
46 #define	ELF_MACHINE_OK(x) ((x) == EM_PPC)
47 
48 /*
49  * Auxiliary vector entries for passing information to the interpreter.
50  *
51  * The PowerPC supplement to the SVR4 ABI specification names this "auxv_t",
52  * but POSIX lays claim to all symbols ending with "_t".
53  */
54 
55 typedef struct {	/* Auxiliary vector entry on initial stack */
56 	int	a_type;			/* Entry type. */
57 	union {
58 		long	a_val;		/* Integer value. */
59 		void	*a_ptr;		/* Address. */
60 		void	(*a_fcn)(void);	/* Function pointer (not used). */
61 	} a_un;
62 } Elf32_Auxinfo;
63 
64 __ElfType(Auxinfo);
65 
66 /* Values for a_type. */
67 #define	AT_NULL		0	/* Terminates the vector. */
68 #define	AT_IGNORE	1	/* Ignored entry. */
69 #define	AT_EXECFD	2	/* File descriptor of program to load. */
70 #define	AT_PHDR		3	/* Program header of program already loaded. */
71 #define	AT_PHENT	4	/* Size of each program header entry. */
72 #define	AT_PHNUM	5	/* Number of program header entries. */
73 #define	AT_PAGESZ	6	/* Page size in bytes. */
74 #define	AT_BASE		7	/* Interpreter's base address. */
75 #define	AT_FLAGS	8	/* Flags (unused for PowerPC). */
76 #define	AT_ENTRY	9	/* Where interpreter should transfer control. */
77 #define	AT_DCACHEBSIZE	10	/* Data cache block size for the processor. */
78 #define	AT_ICACHEBSIZE	11	/* Instruction cache block size for the uP. */
79 #define	AT_UCACHEBSIZE	12	/* Cache block size, or `0' if cache not unified. */
80 
81 #define	AT_COUNT	13	/* Count of defined aux entry types. */
82 
83 /* Used in John Polstra's testbed stuff. */
84 #define	AT_DEBUG	14	/* Debugging level. */
85 
86 /*
87  * Relocation types.
88  */
89 
90 #define	R_PPC_COUNT		37	/* Count of defined relocation types. */
91 
92 					/* Count of defined relocation types. */
93 #define	R_PPC_EMB_COUNT		(R_PPC_EMB_RELSDA - R_PPC_EMB_NADDR32 + 1)
94 
95 /* Define "machine" characteristics */
96 #define	ELF_TARG_CLASS	ELFCLASS32
97 #define	ELF_TARG_DATA	ELFDATA2MSB
98 #define	ELF_TARG_MACH	EM_PPC
99 #define	ELF_TARG_VER	1
100 
101 #endif /* !_MACHINE_ELF_H_ */
102