xref: /freebsd/sys/arm64/include/elf.h (revision c2f37b92452cec6ab7fc5b9d2b682ac9af4bd436)
1412042e2SAndrew Turner /*-
2412042e2SAndrew Turner  * Copyright (c) 1996-1997 John D. Polstra.
3412042e2SAndrew Turner  * All rights reserved.
4412042e2SAndrew Turner  *
5412042e2SAndrew Turner  * Redistribution and use in source and binary forms, with or without
6412042e2SAndrew Turner  * modification, are permitted provided that the following conditions
7412042e2SAndrew Turner  * are met:
8412042e2SAndrew Turner  * 1. Redistributions of source code must retain the above copyright
9412042e2SAndrew Turner  *    notice, this list of conditions and the following disclaimer.
10412042e2SAndrew Turner  * 2. Redistributions in binary form must reproduce the above copyright
11412042e2SAndrew Turner  *    notice, this list of conditions and the following disclaimer in the
12412042e2SAndrew Turner  *    documentation and/or other materials provided with the distribution.
13412042e2SAndrew Turner  *
14412042e2SAndrew Turner  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15412042e2SAndrew Turner  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16412042e2SAndrew Turner  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17412042e2SAndrew Turner  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18412042e2SAndrew Turner  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19412042e2SAndrew Turner  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20412042e2SAndrew Turner  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21412042e2SAndrew Turner  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22412042e2SAndrew Turner  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23412042e2SAndrew Turner  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24412042e2SAndrew Turner  * SUCH DAMAGE.
25412042e2SAndrew Turner  *
26412042e2SAndrew Turner  * $FreeBSD$
27412042e2SAndrew Turner  */
28412042e2SAndrew Turner 
29412042e2SAndrew Turner #ifndef	_MACHINE_ELF_H_
30412042e2SAndrew Turner #define	_MACHINE_ELF_H_
31412042e2SAndrew Turner 
32412042e2SAndrew Turner /*
33412042e2SAndrew Turner  * ELF definitions for the AArch64 architecture.
34412042e2SAndrew Turner  */
35412042e2SAndrew Turner 
36412042e2SAndrew Turner #include <sys/elf32.h>	/* Definitions common to all 32 bit architectures. */
37412042e2SAndrew Turner #include <sys/elf64.h>	/* Definitions common to all 64 bit architectures. */
38412042e2SAndrew Turner 
39412042e2SAndrew Turner #define	__ELF_WORD_SIZE	64	/* Used by <sys/elf_generic.h> */
40412042e2SAndrew Turner #include <sys/elf_generic.h>
41412042e2SAndrew Turner 
42412042e2SAndrew Turner /*
43412042e2SAndrew Turner  * Auxiliary vector entries for passing information to the interpreter.
44412042e2SAndrew Turner  */
45412042e2SAndrew Turner 
46412042e2SAndrew Turner typedef struct {	/* Auxiliary vector entry on initial stack */
47412042e2SAndrew Turner 	int	a_type;			/* Entry type. */
48412042e2SAndrew Turner 	union {
49412042e2SAndrew Turner 		int	a_val;		/* Integer value. */
50412042e2SAndrew Turner 	} a_un;
51412042e2SAndrew Turner } Elf32_Auxinfo;
52412042e2SAndrew Turner 
53412042e2SAndrew Turner typedef struct {	/* Auxiliary vector entry on initial stack */
54412042e2SAndrew Turner 	long	a_type;			/* Entry type. */
55412042e2SAndrew Turner 	union {
56412042e2SAndrew Turner 		long	a_val;		/* Integer value. */
57412042e2SAndrew Turner 		void	*a_ptr;		/* Address. */
58412042e2SAndrew Turner 		void	(*a_fcn)(void);	/* Function pointer (not used). */
59412042e2SAndrew Turner 	} a_un;
60412042e2SAndrew Turner } Elf64_Auxinfo;
61412042e2SAndrew Turner 
62412042e2SAndrew Turner __ElfType(Auxinfo);
63412042e2SAndrew Turner 
64412042e2SAndrew Turner #define	ELF_ARCH	EM_AARCH64
65412042e2SAndrew Turner 
66412042e2SAndrew Turner #define	ELF_MACHINE_OK(x) ((x) == (ELF_ARCH))
67412042e2SAndrew Turner 
68412042e2SAndrew Turner /* Values for a_type. */
69412042e2SAndrew Turner #define	AT_NULL		0	/* Terminates the vector. */
70412042e2SAndrew Turner #define	AT_IGNORE	1	/* Ignored entry. */
71412042e2SAndrew Turner #define	AT_EXECFD	2	/* File descriptor of program to load. */
72412042e2SAndrew Turner #define	AT_PHDR		3	/* Program header of program already loaded. */
73412042e2SAndrew Turner #define	AT_PHENT	4	/* Size of each program header entry. */
74412042e2SAndrew Turner #define	AT_PHNUM	5	/* Number of program header entries. */
75412042e2SAndrew Turner #define	AT_PAGESZ	6	/* Page size in bytes. */
76412042e2SAndrew Turner #define	AT_BASE		7	/* Interpreter's base address. */
77412042e2SAndrew Turner #define	AT_FLAGS	8	/* Flags (unused). */
78412042e2SAndrew Turner #define	AT_ENTRY	9	/* Where interpreter should transfer control. */
79412042e2SAndrew Turner #define	AT_NOTELF	10	/* Program is not ELF ?? */
80412042e2SAndrew Turner #define	AT_UID		11	/* Real uid. */
81412042e2SAndrew Turner #define	AT_EUID		12	/* Effective uid. */
82412042e2SAndrew Turner #define	AT_GID		13	/* Real gid. */
83412042e2SAndrew Turner #define	AT_EGID		14	/* Effective gid. */
84412042e2SAndrew Turner #define	AT_EXECPATH	15	/* Path to the executable. */
85412042e2SAndrew Turner #define	AT_CANARY	16	/* Canary for SSP */
86412042e2SAndrew Turner #define	AT_CANARYLEN	17	/* Length of the canary. */
87412042e2SAndrew Turner #define	AT_OSRELDATE	18	/* OSRELDATE. */
88412042e2SAndrew Turner #define	AT_NCPUS	19	/* Number of CPUs. */
89412042e2SAndrew Turner #define	AT_PAGESIZES	20	/* Pagesizes. */
90412042e2SAndrew Turner #define	AT_PAGESIZESLEN	21	/* Number of pagesizes. */
91412042e2SAndrew Turner #define	AT_TIMEKEEP	22	/* Pointer to timehands. */
92412042e2SAndrew Turner #define	AT_STACKPROT	23	/* Initial stack protection. */
93*c2f37b92SJohn Baldwin #define	AT_EHDRFLAGS	24	/* e_flags field from elf hdr */
94*c2f37b92SJohn Baldwin #define	AT_HWCAP	25	/* CPU feature flags. */
95412042e2SAndrew Turner 
96*c2f37b92SJohn Baldwin #define	AT_COUNT	26	/* Count of defined aux entry types. */
97412042e2SAndrew Turner 
98412042e2SAndrew Turner /* Define "machine" characteristics */
99412042e2SAndrew Turner #define	ELF_TARG_CLASS	ELFCLASS64
100412042e2SAndrew Turner #define	ELF_TARG_DATA	ELFDATA2LSB
101412042e2SAndrew Turner #define	ELF_TARG_MACH	EM_AARCH64
102412042e2SAndrew Turner #define	ELF_TARG_VER	1
103412042e2SAndrew Turner 
104412042e2SAndrew Turner #define	ET_DYN_LOAD_ADDR 0x100000
105412042e2SAndrew Turner 
106412042e2SAndrew Turner #endif /* !_MACHINE_ELF_H_ */
107