xref: /freebsd/contrib/file/src/readelf.h (revision 40427cca7a9ae77b095936fb1954417c290cfb17)
1b6cee71dSXin LI /*
2b6cee71dSXin LI  * Copyright (c) Christos Zoulas 2003.
3b6cee71dSXin LI  * All Rights Reserved.
4b6cee71dSXin LI  *
5b6cee71dSXin LI  * Redistribution and use in source and binary forms, with or without
6b6cee71dSXin LI  * modification, are permitted provided that the following conditions
7b6cee71dSXin LI  * are met:
8b6cee71dSXin LI  * 1. Redistributions of source code must retain the above copyright
9b6cee71dSXin LI  *    notice immediately at the beginning of the file, without modification,
10b6cee71dSXin LI  *    this list of conditions, and the following disclaimer.
11b6cee71dSXin LI  * 2. Redistributions in binary form must reproduce the above copyright
12b6cee71dSXin LI  *    notice, this list of conditions and the following disclaimer in the
13b6cee71dSXin LI  *    documentation and/or other materials provided with the distribution.
14b6cee71dSXin LI  *
15b6cee71dSXin LI  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16b6cee71dSXin LI  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17b6cee71dSXin LI  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18b6cee71dSXin LI  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
19b6cee71dSXin LI  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20b6cee71dSXin LI  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21b6cee71dSXin LI  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22b6cee71dSXin LI  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23b6cee71dSXin LI  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24b6cee71dSXin LI  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25b6cee71dSXin LI  * SUCH DAMAGE.
26b6cee71dSXin LI  */
27b6cee71dSXin LI /*
28b6cee71dSXin LI  * @(#)Id: readelf.h,v 1.9 2002/05/16 18:45:56 christos Exp
29b6cee71dSXin LI  *
30b6cee71dSXin LI  * Provide elf data structures for non-elf machines, allowing file
31b6cee71dSXin LI  * non-elf hosts to determine if an elf binary is stripped.
32b6cee71dSXin LI  * Note: cobbled from the linux header file, with modifications
33b6cee71dSXin LI  */
34b6cee71dSXin LI #ifndef __fake_elf_h__
35b6cee71dSXin LI #define	__fake_elf_h__
36b6cee71dSXin LI 
37b6cee71dSXin LI #if HAVE_STDINT_H
38b6cee71dSXin LI #include <stdint.h>
39b6cee71dSXin LI #endif
40b6cee71dSXin LI 
41b6cee71dSXin LI typedef uint32_t	Elf32_Addr;
42b6cee71dSXin LI typedef uint32_t	Elf32_Off;
43b6cee71dSXin LI typedef uint16_t	Elf32_Half;
44b6cee71dSXin LI typedef uint32_t	Elf32_Word;
45b6cee71dSXin LI typedef uint8_t		Elf32_Char;
46b6cee71dSXin LI 
47b6cee71dSXin LI typedef	uint64_t 	Elf64_Addr;
48b6cee71dSXin LI typedef	uint64_t 	Elf64_Off;
49b6cee71dSXin LI typedef uint64_t 	Elf64_Xword;
50b6cee71dSXin LI typedef uint16_t	Elf64_Half;
51b6cee71dSXin LI typedef uint32_t	Elf64_Word;
52b6cee71dSXin LI typedef uint8_t		Elf64_Char;
53b6cee71dSXin LI 
54b6cee71dSXin LI #define	EI_NIDENT	16
55b6cee71dSXin LI 
56b6cee71dSXin LI typedef struct {
573e41d09dSXin LI 	Elf32_Word	a_type;		/* 32-bit id */
583e41d09dSXin LI 	Elf32_Word	a_v;		/* 32-bit id */
593e41d09dSXin LI } Aux32Info;
603e41d09dSXin LI 
613e41d09dSXin LI typedef struct {
623e41d09dSXin LI 	Elf64_Xword	a_type;		/* 64-bit id */
633e41d09dSXin LI 	Elf64_Xword	a_v;		/* 64-bit id */
643e41d09dSXin LI } Aux64Info;
653e41d09dSXin LI 
663e41d09dSXin LI #define AT_NULL   0     /* end of vector */
673e41d09dSXin LI #define AT_IGNORE 1     /* entry should be ignored */
683e41d09dSXin LI #define AT_EXECFD 2     /* file descriptor of program */
693e41d09dSXin LI #define AT_PHDR   3     /* program headers for program */
703e41d09dSXin LI #define AT_PHENT  4     /* size of program header entry */
713e41d09dSXin LI #define AT_PHNUM  5     /* number of program headers */
723e41d09dSXin LI #define AT_PAGESZ 6     /* system page size */
733e41d09dSXin LI #define AT_BASE   7     /* base address of interpreter */
743e41d09dSXin LI #define AT_FLAGS  8     /* flags */
753e41d09dSXin LI #define AT_ENTRY  9     /* entry point of program */
763e41d09dSXin LI #define AT_LINUX_NOTELF 10    /* program is not ELF */
773e41d09dSXin LI #define AT_LINUX_UID    11    /* real uid */
783e41d09dSXin LI #define AT_LINUX_EUID   12    /* effective uid */
793e41d09dSXin LI #define AT_LINUX_GID    13    /* real gid */
803e41d09dSXin LI #define AT_LINUX_EGID   14    /* effective gid */
813e41d09dSXin LI #define AT_LINUX_PLATFORM 15  /* string identifying CPU for optimizations */
823e41d09dSXin LI #define AT_LINUX_HWCAP  16    /* arch dependent hints at CPU capabilities */
833e41d09dSXin LI #define AT_LINUX_CLKTCK 17    /* frequency at which times() increments */
843e41d09dSXin LI /* AT_* values 18 through 22 are reserved */
853e41d09dSXin LI #define AT_LINUX_SECURE 23   /* secure mode boolean */
863e41d09dSXin LI #define AT_LINUX_BASE_PLATFORM 24     /* string identifying real platform, may
873e41d09dSXin LI                                  * differ from AT_PLATFORM. */
883e41d09dSXin LI #define AT_LINUX_RANDOM 25    /* address of 16 random bytes */
893e41d09dSXin LI #define AT_LINUX_HWCAP2 26    /* extension of AT_HWCAP */
903e41d09dSXin LI #define AT_LINUX_EXECFN 31   /* filename of program */
913e41d09dSXin LI 
923e41d09dSXin LI typedef struct {
93b6cee71dSXin LI     Elf32_Char	e_ident[EI_NIDENT];
94b6cee71dSXin LI     Elf32_Half	e_type;
95b6cee71dSXin LI     Elf32_Half	e_machine;
96b6cee71dSXin LI     Elf32_Word	e_version;
97b6cee71dSXin LI     Elf32_Addr	e_entry;  /* Entry point */
98b6cee71dSXin LI     Elf32_Off	e_phoff;
99b6cee71dSXin LI     Elf32_Off	e_shoff;
100b6cee71dSXin LI     Elf32_Word	e_flags;
101b6cee71dSXin LI     Elf32_Half	e_ehsize;
102b6cee71dSXin LI     Elf32_Half	e_phentsize;
103b6cee71dSXin LI     Elf32_Half	e_phnum;
104b6cee71dSXin LI     Elf32_Half	e_shentsize;
105b6cee71dSXin LI     Elf32_Half	e_shnum;
106b6cee71dSXin LI     Elf32_Half	e_shstrndx;
107b6cee71dSXin LI } Elf32_Ehdr;
108b6cee71dSXin LI 
109b6cee71dSXin LI typedef struct {
110b6cee71dSXin LI     Elf64_Char	e_ident[EI_NIDENT];
111b6cee71dSXin LI     Elf64_Half	e_type;
112b6cee71dSXin LI     Elf64_Half	e_machine;
113b6cee71dSXin LI     Elf64_Word	e_version;
114b6cee71dSXin LI     Elf64_Addr	e_entry;  /* Entry point */
115b6cee71dSXin LI     Elf64_Off	e_phoff;
116b6cee71dSXin LI     Elf64_Off	e_shoff;
117b6cee71dSXin LI     Elf64_Word	e_flags;
118b6cee71dSXin LI     Elf64_Half	e_ehsize;
119b6cee71dSXin LI     Elf64_Half	e_phentsize;
120b6cee71dSXin LI     Elf64_Half	e_phnum;
121b6cee71dSXin LI     Elf64_Half	e_shentsize;
122b6cee71dSXin LI     Elf64_Half	e_shnum;
123b6cee71dSXin LI     Elf64_Half	e_shstrndx;
124b6cee71dSXin LI } Elf64_Ehdr;
125b6cee71dSXin LI 
126b6cee71dSXin LI /* e_type */
127b6cee71dSXin LI #define	ET_REL		1
128b6cee71dSXin LI #define	ET_EXEC		2
129b6cee71dSXin LI #define	ET_DYN		3
130b6cee71dSXin LI #define	ET_CORE		4
131b6cee71dSXin LI 
132b6cee71dSXin LI /* e_machine (used only for SunOS 5.x hardware capabilities) */
133b6cee71dSXin LI #define	EM_SPARC	2
134b6cee71dSXin LI #define	EM_386		3
135b6cee71dSXin LI #define	EM_SPARC32PLUS	18
136b6cee71dSXin LI #define	EM_SPARCV9	43
137b6cee71dSXin LI #define	EM_IA_64	50
138b6cee71dSXin LI #define	EM_AMD64	62
139b6cee71dSXin LI 
140b6cee71dSXin LI /* sh_type */
141b6cee71dSXin LI #define	SHT_SYMTAB	2
142b6cee71dSXin LI #define	SHT_NOTE	7
143b6cee71dSXin LI #define	SHT_DYNSYM	11
144*40427ccaSGordon Tetlow #define	SHT_SUNW_cap	0x6ffffff5	/* SunOS 5.x hw/sw capabilities */
145b6cee71dSXin LI 
146b6cee71dSXin LI /* elf type */
147b6cee71dSXin LI #define	ELFDATANONE	0		/* e_ident[EI_DATA] */
148b6cee71dSXin LI #define	ELFDATA2LSB	1
149b6cee71dSXin LI #define	ELFDATA2MSB	2
150b6cee71dSXin LI 
151b6cee71dSXin LI /* elf class */
152b6cee71dSXin LI #define	ELFCLASSNONE	0
153b6cee71dSXin LI #define	ELFCLASS32	1
154b6cee71dSXin LI #define	ELFCLASS64	2
155b6cee71dSXin LI 
156b6cee71dSXin LI /* magic number */
157b6cee71dSXin LI #define	EI_MAG0		0		/* e_ident[] indexes */
158b6cee71dSXin LI #define	EI_MAG1		1
159b6cee71dSXin LI #define	EI_MAG2		2
160b6cee71dSXin LI #define	EI_MAG3		3
161b6cee71dSXin LI #define	EI_CLASS	4
162b6cee71dSXin LI #define	EI_DATA		5
163b6cee71dSXin LI #define	EI_VERSION	6
164b6cee71dSXin LI #define	EI_PAD		7
165b6cee71dSXin LI 
166b6cee71dSXin LI #define	ELFMAG0		0x7f		/* EI_MAG */
167b6cee71dSXin LI #define	ELFMAG1		'E'
168b6cee71dSXin LI #define	ELFMAG2		'L'
169b6cee71dSXin LI #define	ELFMAG3		'F'
170b6cee71dSXin LI #define	ELFMAG		"\177ELF"
171b6cee71dSXin LI 
172b6cee71dSXin LI #define	OLFMAG1		'O'
173b6cee71dSXin LI #define	OLFMAG		"\177OLF"
174b6cee71dSXin LI 
175b6cee71dSXin LI typedef struct {
176b6cee71dSXin LI     Elf32_Word	p_type;
177b6cee71dSXin LI     Elf32_Off	p_offset;
178b6cee71dSXin LI     Elf32_Addr	p_vaddr;
179b6cee71dSXin LI     Elf32_Addr	p_paddr;
180b6cee71dSXin LI     Elf32_Word	p_filesz;
181b6cee71dSXin LI     Elf32_Word	p_memsz;
182b6cee71dSXin LI     Elf32_Word	p_flags;
183b6cee71dSXin LI     Elf32_Word	p_align;
184b6cee71dSXin LI } Elf32_Phdr;
185b6cee71dSXin LI 
186b6cee71dSXin LI typedef struct {
187b6cee71dSXin LI     Elf64_Word	p_type;
188b6cee71dSXin LI     Elf64_Word	p_flags;
189b6cee71dSXin LI     Elf64_Off	p_offset;
190b6cee71dSXin LI     Elf64_Addr	p_vaddr;
191b6cee71dSXin LI     Elf64_Addr	p_paddr;
192b6cee71dSXin LI     Elf64_Xword	p_filesz;
193b6cee71dSXin LI     Elf64_Xword	p_memsz;
194b6cee71dSXin LI     Elf64_Xword	p_align;
195b6cee71dSXin LI } Elf64_Phdr;
196b6cee71dSXin LI 
197b6cee71dSXin LI #define	PT_NULL		0		/* p_type */
198b6cee71dSXin LI #define	PT_LOAD		1
199b6cee71dSXin LI #define	PT_DYNAMIC	2
200b6cee71dSXin LI #define	PT_INTERP	3
201b6cee71dSXin LI #define	PT_NOTE		4
202b6cee71dSXin LI #define	PT_SHLIB	5
203b6cee71dSXin LI #define	PT_PHDR		6
204b6cee71dSXin LI #define	PT_NUM		7
205b6cee71dSXin LI 
206b6cee71dSXin LI typedef struct {
207b6cee71dSXin LI     Elf32_Word	sh_name;
208b6cee71dSXin LI     Elf32_Word	sh_type;
209b6cee71dSXin LI     Elf32_Word	sh_flags;
210b6cee71dSXin LI     Elf32_Addr	sh_addr;
211b6cee71dSXin LI     Elf32_Off	sh_offset;
212b6cee71dSXin LI     Elf32_Word	sh_size;
213b6cee71dSXin LI     Elf32_Word	sh_link;
214b6cee71dSXin LI     Elf32_Word	sh_info;
215b6cee71dSXin LI     Elf32_Word	sh_addralign;
216b6cee71dSXin LI     Elf32_Word	sh_entsize;
217b6cee71dSXin LI } Elf32_Shdr;
218b6cee71dSXin LI 
219b6cee71dSXin LI typedef struct {
220b6cee71dSXin LI     Elf64_Word	sh_name;
221b6cee71dSXin LI     Elf64_Word	sh_type;
222b6cee71dSXin LI     Elf64_Off	sh_flags;
223b6cee71dSXin LI     Elf64_Addr	sh_addr;
224b6cee71dSXin LI     Elf64_Off	sh_offset;
225b6cee71dSXin LI     Elf64_Off	sh_size;
226b6cee71dSXin LI     Elf64_Word	sh_link;
227b6cee71dSXin LI     Elf64_Word	sh_info;
228b6cee71dSXin LI     Elf64_Off	sh_addralign;
229b6cee71dSXin LI     Elf64_Off	sh_entsize;
230b6cee71dSXin LI } Elf64_Shdr;
231b6cee71dSXin LI 
232b6cee71dSXin LI #define	NT_NETBSD_CORE_PROCINFO		1
233*40427ccaSGordon Tetlow #define	NT_NETBSD_CORE_AUXV		2
234*40427ccaSGordon Tetlow 
235*40427ccaSGordon Tetlow struct NetBSD_elfcore_procinfo {
236*40427ccaSGordon Tetlow 	/* Version 1 fields start here. */
237*40427ccaSGordon Tetlow 	uint32_t	cpi_version;		/* our version */
238*40427ccaSGordon Tetlow 	uint32_t	cpi_cpisize;		/* sizeof(this struct) */
239*40427ccaSGordon Tetlow 	uint32_t	cpi_signo;		/* killing signal */
240*40427ccaSGordon Tetlow 	uint32_t	cpi_sigcode;		/* signal code */
241*40427ccaSGordon Tetlow 	uint32_t	cpi_sigpend[4];		/* pending signals */
242*40427ccaSGordon Tetlow 	uint32_t	cpi_sigmask[4];		/* blocked signals */
243*40427ccaSGordon Tetlow 	uint32_t	cpi_sigignore[4];	/* ignored signals */
244*40427ccaSGordon Tetlow 	uint32_t	cpi_sigcatch[4];	/* caught signals */
245*40427ccaSGordon Tetlow 	int32_t		cpi_pid;		/* process ID */
246*40427ccaSGordon Tetlow 	int32_t		cpi_ppid;		/* parent process ID */
247*40427ccaSGordon Tetlow 	int32_t		cpi_pgrp;		/* process group ID */
248*40427ccaSGordon Tetlow 	int32_t		cpi_sid;		/* session ID */
249*40427ccaSGordon Tetlow 	uint32_t	cpi_ruid;		/* real user ID */
250*40427ccaSGordon Tetlow 	uint32_t	cpi_euid;		/* effective user ID */
251*40427ccaSGordon Tetlow 	uint32_t	cpi_svuid;		/* saved user ID */
252*40427ccaSGordon Tetlow 	uint32_t	cpi_rgid;		/* real group ID */
253*40427ccaSGordon Tetlow 	uint32_t	cpi_egid;		/* effective group ID */
254*40427ccaSGordon Tetlow 	uint32_t	cpi_svgid;		/* saved group ID */
255*40427ccaSGordon Tetlow 	uint32_t	cpi_nlwps;		/* number of LWPs */
256*40427ccaSGordon Tetlow 	int8_t		cpi_name[32];		/* copy of p->p_comm */
257*40427ccaSGordon Tetlow 	/* Add version 2 fields below here. */
258*40427ccaSGordon Tetlow 	int32_t		cpi_siglwp;	/* LWP target of killing signal */
259*40427ccaSGordon Tetlow };
260b6cee71dSXin LI 
261b6cee71dSXin LI /* Note header in a PT_NOTE section */
262b6cee71dSXin LI typedef struct elf_note {
263b6cee71dSXin LI     Elf32_Word	n_namesz;	/* Name size */
264b6cee71dSXin LI     Elf32_Word	n_descsz;	/* Content size */
265b6cee71dSXin LI     Elf32_Word	n_type;		/* Content type */
266b6cee71dSXin LI } Elf32_Nhdr;
267b6cee71dSXin LI 
268b6cee71dSXin LI typedef struct {
269b6cee71dSXin LI     Elf64_Word	n_namesz;
270b6cee71dSXin LI     Elf64_Word	n_descsz;
271b6cee71dSXin LI     Elf64_Word	n_type;
272b6cee71dSXin LI } Elf64_Nhdr;
273b6cee71dSXin LI 
274b6cee71dSXin LI /* Notes used in ET_CORE */
275b6cee71dSXin LI #define	NT_PRSTATUS	1
276b6cee71dSXin LI #define	NT_PRFPREG	2
277b6cee71dSXin LI #define	NT_PRPSINFO	3
278b6cee71dSXin LI #define	NT_PRXREG	4
279b6cee71dSXin LI #define	NT_TASKSTRUCT	4
280b6cee71dSXin LI #define	NT_PLATFORM	5
281b6cee71dSXin LI #define	NT_AUXV		6
282b6cee71dSXin LI 
283b6cee71dSXin LI /* Note types used in executables */
284b6cee71dSXin LI /* NetBSD executables (name = "NetBSD") */
285b6cee71dSXin LI #define	NT_NETBSD_VERSION	1
286b6cee71dSXin LI #define	NT_NETBSD_EMULATION	2
287b6cee71dSXin LI #define	NT_FREEBSD_VERSION	1
288b6cee71dSXin LI #define	NT_OPENBSD_VERSION	1
289b6cee71dSXin LI #define	NT_DRAGONFLY_VERSION	1
290b6cee71dSXin LI /*
291b6cee71dSXin LI  * GNU executables (name = "GNU")
292b6cee71dSXin LI  * word[0]: GNU OS tags
293b6cee71dSXin LI  * word[1]: major version
294b6cee71dSXin LI  * word[2]: minor version
295b6cee71dSXin LI  * word[3]: tiny version
296b6cee71dSXin LI  */
297b6cee71dSXin LI #define	NT_GNU_VERSION		1
298b6cee71dSXin LI 
299b6cee71dSXin LI /* GNU OS tags */
300b6cee71dSXin LI #define	GNU_OS_LINUX	0
301b6cee71dSXin LI #define	GNU_OS_HURD	1
302b6cee71dSXin LI #define	GNU_OS_SOLARIS	2
303b6cee71dSXin LI #define	GNU_OS_KFREEBSD	3
304b6cee71dSXin LI #define	GNU_OS_KNETBSD	4
305b6cee71dSXin LI 
306b6cee71dSXin LI /*
307b6cee71dSXin LI  * GNU Hardware capability information
308b6cee71dSXin LI  * word[0]: Number of entries
309b6cee71dSXin LI  * word[1]: Bitmask of enabled entries
310b6cee71dSXin LI  * Followed by a byte id, and a NUL terminated string per entry
311b6cee71dSXin LI  */
312b6cee71dSXin LI #define	NT_GNU_HWCAP		2
313b6cee71dSXin LI 
314b6cee71dSXin LI /*
315b6cee71dSXin LI  * GNU Build ID generated by ld
316b6cee71dSXin LI  * 160 bit SHA1 [default]
317b6cee71dSXin LI  * 128 bit md5 or uuid
318b6cee71dSXin LI  */
319b6cee71dSXin LI #define	NT_GNU_BUILD_ID		3
320b6cee71dSXin LI 
321b6cee71dSXin LI /*
322b6cee71dSXin LI  * NetBSD-specific note type: PaX.
323b6cee71dSXin LI  * There should be 1 NOTE per executable.
324b6cee71dSXin LI  * name: PaX\0
325b6cee71dSXin LI  * namesz: 4
326b6cee71dSXin LI  * desc:
327b6cee71dSXin LI  *	word[0]: capability bitmask
328b6cee71dSXin LI  * descsz: 4
329b6cee71dSXin LI  */
330b6cee71dSXin LI #define NT_NETBSD_PAX		3
331b6cee71dSXin LI #define NT_NETBSD_PAX_MPROTECT		0x01	/* Force enable Mprotect */
332b6cee71dSXin LI #define NT_NETBSD_PAX_NOMPROTECT	0x02	/* Force disable Mprotect */
333b6cee71dSXin LI #define NT_NETBSD_PAX_GUARD		0x04	/* Force enable Segvguard */
334b6cee71dSXin LI #define NT_NETBSD_PAX_NOGUARD		0x08	/* Force disable Servguard */
335b6cee71dSXin LI #define NT_NETBSD_PAX_ASLR		0x10	/* Force enable ASLR */
336b6cee71dSXin LI #define NT_NETBSD_PAX_NOASLR		0x20	/* Force disable ASLR */
337b6cee71dSXin LI 
338b6cee71dSXin LI /*
339b6cee71dSXin LI  * NetBSD-specific note type: MACHINE_ARCH.
340b6cee71dSXin LI  * There should be 1 NOTE per executable.
341b6cee71dSXin LI  * name:	NetBSD\0
342b6cee71dSXin LI  * namesz:	7
343b6cee71dSXin LI  * desc:	string
344b6cee71dSXin LI  * descsz:	variable
345b6cee71dSXin LI  */
346b6cee71dSXin LI #define NT_NETBSD_MARCH		5
347b6cee71dSXin LI 
348b6cee71dSXin LI /*
349b6cee71dSXin LI  * NetBSD-specific note type: COMPILER MODEL.
350b6cee71dSXin LI  * There should be 1 NOTE per executable.
351b6cee71dSXin LI  * name:	NetBSD\0
352b6cee71dSXin LI  * namesz:	7
353b6cee71dSXin LI  * desc:	string
354b6cee71dSXin LI  * descsz:	variable
355b6cee71dSXin LI  */
356b6cee71dSXin LI #define NT_NETBSD_CMODEL	6
357b6cee71dSXin LI 
358*40427ccaSGordon Tetlow /*
359*40427ccaSGordon Tetlow  * FreeBSD specific notes
360*40427ccaSGordon Tetlow  */
361*40427ccaSGordon Tetlow #define NT_FREEBSD_PROCSTAT_AUXV	16
362*40427ccaSGordon Tetlow 
363b6cee71dSXin LI #if !defined(ELFSIZE) && defined(ARCH_ELFSIZE)
364b6cee71dSXin LI #define ELFSIZE ARCH_ELFSIZE
365b6cee71dSXin LI #endif
366b6cee71dSXin LI /* SunOS 5.x hardware/software capabilities */
367b6cee71dSXin LI typedef struct {
368b6cee71dSXin LI 	Elf32_Word	c_tag;
369b6cee71dSXin LI 	union {
370b6cee71dSXin LI 		Elf32_Word	c_val;
371b6cee71dSXin LI 		Elf32_Addr	c_ptr;
372b6cee71dSXin LI 	} c_un;
373b6cee71dSXin LI } Elf32_Cap;
374b6cee71dSXin LI 
375b6cee71dSXin LI typedef struct {
376b6cee71dSXin LI 	Elf64_Xword	c_tag;
377b6cee71dSXin LI 	union {
378b6cee71dSXin LI 		Elf64_Xword	c_val;
379b6cee71dSXin LI 		Elf64_Addr	c_ptr;
380b6cee71dSXin LI 	} c_un;
381b6cee71dSXin LI } Elf64_Cap;
382b6cee71dSXin LI 
383b6cee71dSXin LI /* SunOS 5.x hardware/software capability tags */
384b6cee71dSXin LI #define	CA_SUNW_NULL	0
385b6cee71dSXin LI #define	CA_SUNW_HW_1	1
386b6cee71dSXin LI #define	CA_SUNW_SF_1	2
387b6cee71dSXin LI 
388b6cee71dSXin LI /* SunOS 5.x software capabilities */
389b6cee71dSXin LI #define	SF1_SUNW_FPKNWN	0x01
390b6cee71dSXin LI #define	SF1_SUNW_FPUSED	0x02
391b6cee71dSXin LI #define	SF1_SUNW_MASK	0x03
392b6cee71dSXin LI 
393b6cee71dSXin LI /* SunOS 5.x hardware capabilities: sparc */
394b6cee71dSXin LI #define	AV_SPARC_MUL32		0x0001
395b6cee71dSXin LI #define	AV_SPARC_DIV32		0x0002
396b6cee71dSXin LI #define	AV_SPARC_FSMULD		0x0004
397b6cee71dSXin LI #define	AV_SPARC_V8PLUS		0x0008
398b6cee71dSXin LI #define	AV_SPARC_POPC		0x0010
399b6cee71dSXin LI #define	AV_SPARC_VIS		0x0020
400b6cee71dSXin LI #define	AV_SPARC_VIS2		0x0040
401b6cee71dSXin LI #define	AV_SPARC_ASI_BLK_INIT	0x0080
402b6cee71dSXin LI #define	AV_SPARC_FMAF		0x0100
403b6cee71dSXin LI #define	AV_SPARC_FJFMAU		0x4000
404b6cee71dSXin LI #define	AV_SPARC_IMA		0x8000
405b6cee71dSXin LI 
406b6cee71dSXin LI /* SunOS 5.x hardware capabilities: 386 */
407b6cee71dSXin LI #define	AV_386_FPU		0x00000001
408b6cee71dSXin LI #define	AV_386_TSC		0x00000002
409b6cee71dSXin LI #define	AV_386_CX8		0x00000004
410b6cee71dSXin LI #define	AV_386_SEP		0x00000008
411b6cee71dSXin LI #define	AV_386_AMD_SYSC		0x00000010
412b6cee71dSXin LI #define	AV_386_CMOV		0x00000020
413b6cee71dSXin LI #define	AV_386_MMX		0x00000040
414b6cee71dSXin LI #define	AV_386_AMD_MMX		0x00000080
415b6cee71dSXin LI #define	AV_386_AMD_3DNow	0x00000100
416b6cee71dSXin LI #define	AV_386_AMD_3DNowx	0x00000200
417b6cee71dSXin LI #define	AV_386_FXSR		0x00000400
418b6cee71dSXin LI #define	AV_386_SSE		0x00000800
419b6cee71dSXin LI #define	AV_386_SSE2		0x00001000
420b6cee71dSXin LI #define	AV_386_PAUSE		0x00002000
421b6cee71dSXin LI #define	AV_386_SSE3		0x00004000
422b6cee71dSXin LI #define	AV_386_MON		0x00008000
423b6cee71dSXin LI #define	AV_386_CX16		0x00010000
424b6cee71dSXin LI #define	AV_386_AHF		0x00020000
425b6cee71dSXin LI #define	AV_386_TSCP		0x00040000
426b6cee71dSXin LI #define	AV_386_AMD_SSE4A	0x00080000
427b6cee71dSXin LI #define	AV_386_POPCNT		0x00100000
428b6cee71dSXin LI #define	AV_386_AMD_LZCNT	0x00200000
429b6cee71dSXin LI #define	AV_386_SSSE3		0x00400000
430b6cee71dSXin LI #define	AV_386_SSE4_1		0x00800000
431b6cee71dSXin LI #define	AV_386_SSE4_2		0x01000000
432b6cee71dSXin LI 
433b6cee71dSXin LI #endif
434