166458Sdfr/*-
266458Sdfr * Copyright (c) 1996-1997 John D. Polstra.
366458Sdfr * All rights reserved.
466458Sdfr *
566458Sdfr * Redistribution and use in source and binary forms, with or without
666458Sdfr * modification, are permitted provided that the following conditions
766458Sdfr * are met:
866458Sdfr * 1. Redistributions of source code must retain the above copyright
966458Sdfr *    notice, this list of conditions and the following disclaimer.
1066458Sdfr * 2. Redistributions in binary form must reproduce the above copyright
1166458Sdfr *    notice, this list of conditions and the following disclaimer in the
1266458Sdfr *    documentation and/or other materials provided with the distribution.
1366458Sdfr *
1466458Sdfr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1566458Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1666458Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1766458Sdfr * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1866458Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1966458Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2066458Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2166458Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2266458Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2366458Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2466458Sdfr * SUCH DAMAGE.
2566458Sdfr *
2666458Sdfr * $FreeBSD$
2766458Sdfr */
2866458Sdfr
2966458Sdfr#ifndef _MACHINE_ELF_H_
3077931Sobrien#define	_MACHINE_ELF_H_ 1
3166458Sdfr
3266458Sdfr/*
3366458Sdfr * ELF definitions for the IA-64 architecture.
3466458Sdfr */
3566458Sdfr
36100384Speter#ifndef __ELF_WORD_SIZE
37154496Smarcel#define	__ELF_WORD_SIZE	64
38100384Speter#endif
39100384Speter
4066458Sdfr#include <sys/elf64.h>	/* Definitions common to all 64 bit architectures. */
41100384Speter#include <sys/elf32.h>	/* Definitions common to all 32 bit architectures. */
4266458Sdfr
4366458Sdfr#include <sys/elf_generic.h>
4466458Sdfr
4577931Sobrien#define	ELF_ARCH	EM_IA_64
46205014Snwhitehorn#define	ELF_ARCH32	EM_386
4766458Sdfr
4877931Sobrien#define	ELF_MACHINE_OK(x) ((x) == EM_IA_64)
4966458Sdfr
5066458Sdfr/*
5166458Sdfr * Auxiliary vector entries for passing information to the interpreter.
5266458Sdfr *
5366458Sdfr * The i386 supplement to the SVR4 ABI specification names this "auxv_t",
5466458Sdfr * but POSIX lays claim to all symbols ending with "_t".
5566458Sdfr */
5666458Sdfr
5766458Sdfrtypedef struct {	/* Auxiliary vector entry on initial stack */
5866458Sdfr	int	a_type;			/* Entry type. */
5966458Sdfr	union {
60100384Speter		int	a_val;		/* Integer value. */
61100384Speter	} a_un;
62100384Speter} Elf32_Auxinfo;
63100384Speter
64100384Spetertypedef struct {	/* Auxiliary vector entry on initial stack */
65100384Speter	int	a_type;			/* Entry type. */
66100384Speter	union {
6766458Sdfr		long	a_val;		/* Integer value. */
6866458Sdfr		void	*a_ptr;		/* Address. */
6966458Sdfr		void	(*a_fcn)(void);	/* Function pointer (not used). */
7066458Sdfr	} a_un;
7166458Sdfr} Elf64_Auxinfo;
7266458Sdfr
7366458Sdfr__ElfType(Auxinfo);
7466458Sdfr
7566458Sdfr/* Values for a_type. */
7677931Sobrien#define	AT_NULL		0	/* Terminates the vector. */
7777931Sobrien#define	AT_IGNORE	1	/* Ignored entry. */
7877931Sobrien#define	AT_EXECFD	2	/* File descriptor of program to load. */
7977931Sobrien#define	AT_PHDR		3	/* Program header of program already loaded. */
8077931Sobrien#define	AT_PHENT	4	/* Size of each program header entry. */
8177931Sobrien#define	AT_PHNUM	5	/* Number of program header entries. */
8277931Sobrien#define	AT_PAGESZ	6	/* Page size in bytes. */
8377931Sobrien#define	AT_BASE		7	/* Interpreter's base address. */
8477931Sobrien#define	AT_FLAGS	8	/* Flags (unused for i386). */
8577931Sobrien#define	AT_ENTRY	9	/* Where interpreter should transfer control. */
8677931Sobrien#define	AT_NOTELF	10	/* Program is not ELF ?? */
8777931Sobrien#define	AT_UID		11	/* Real uid. */
8877931Sobrien#define	AT_EUID		12	/* Effective uid. */
8977931Sobrien#define	AT_GID		13	/* Real gid. */
9077931Sobrien#define	AT_EGID		14	/* Effective gid. */
91189926Skib#define	AT_EXECPATH	15	/* Path to the executable. */
92211412Skib#define	AT_CANARY	16	/* Canary for SSP */
93211412Skib#define	AT_CANARYLEN	17	/* Length of the canary. */
94211412Skib#define	AT_OSRELDATE	18	/* OSRELDATE. */
95211412Skib#define	AT_NCPUS	19	/* Number of CPUs. */
96211412Skib#define	AT_PAGESIZES	20	/* Pagesizes. */
97211412Skib#define	AT_PAGESIZESLEN	21	/* Number of pagesizes. */
98237430Skib#define	AT_TIMEKEEP	22	/* Pointer to timehands. */
99217097Skib#define	AT_STACKPROT	23	/* Initial stack protection. */
10066458Sdfr
101217097Skib#define	AT_COUNT	24	/* Count of defined aux entry types. */
10266458Sdfr
10366458Sdfr/*
10466458Sdfr * Values for e_flags.
10566458Sdfr */
10677931Sobrien#define	EF_IA_64_MASKOS		0x00ff000f
10777931Sobrien#define	EF_IA_64_ABI64		0x00000010
10877931Sobrien#define	EF_IA_64_REDUCEDFP	0x00000020
10977931Sobrien#define	EF_IA_64_CONS_GP	0x00000040
11077931Sobrien#define	EF_IA_64_NOFUNCDESC_CONS_GP 0x00000080
11177931Sobrien#define	EF_IA_64_ABSOLUTE	0x00000100
11277931Sobrien#define	EF_IA_64_ARCH		0xff000000
11366458Sdfr
11466458Sdfr/*
11593757Smarcel * Segment types.
11693757Smarcel */
11793757Smarcel#define	PT_IA_64_ARCHEXT	0x70000000
11893757Smarcel#define	PT_IA_64_UNWIND		0x70000001
11993757Smarcel
12093757Smarcel/*
12193757Smarcel * Segment attributes.
12293757Smarcel */
12393757Smarcel#define	PF_IA_64_NORECOV	0x80000000
12493757Smarcel
12593757Smarcel/*
12666458Sdfr * Section types.
12766458Sdfr */
12877931Sobrien#define	SHT_IA_64_EXT		0x70000000
12977931Sobrien#define	SHT_IA_64_UNWIND	0x70000001
13077931Sobrien#define	SHT_IA_64_LOPSREG	0x78000000
13177931Sobrien#define	SHT_IA_64_HIPSREG	0x7fffffff
13266458Sdfr
13366458Sdfr/*
13466458Sdfr * Section attribute flags.
13566458Sdfr */
13677931Sobrien#define	SHF_IA_64_SHORT		0x10000000
13777931Sobrien#define	SHF_IA_64_NORECOV	0x20000000
13866458Sdfr
13966458Sdfr/* Define "machine" characteristics */
140100384Speter#if __ELF_WORD_SIZE == 32
141100384Speter#define	ELF_TARG_CLASS	ELFCLASS32
142100384Speter#else
14377931Sobrien#define	ELF_TARG_CLASS	ELFCLASS64
144100384Speter#endif
14577931Sobrien#define	ELF_TARG_DATA	ELFDATA2LSB
14677931Sobrien#define	ELF_TARG_MACH	EM_IA_64
14777931Sobrien#define	ELF_TARG_VER	1
14866458Sdfr
14984751Sdfr/* Processor specific dynmamic section tags. */
15084751Sdfr
151154958Smarcel#define	DT_IA_64_PLT_RESERVE	0x70000000
15284751Sdfr
153197933Skib#define	ET_DYN_LOAD_ADDR 0x2500000000000000
154197933Skib
15566458Sdfr#endif /* !_MACHINE_ELF_H_ */
156