170651Sobrien/*-
270651Sobrien * Copyright (c) 2001 David E. O'Brien
370651Sobrien * Copyright (c) 1996-1997 John D. Polstra.
470651Sobrien * All rights reserved.
570651Sobrien *
670651Sobrien * Redistribution and use in source and binary forms, with or without
770651Sobrien * modification, are permitted provided that the following conditions
870651Sobrien * are met:
970651Sobrien * 1. Redistributions of source code must retain the above copyright
1070651Sobrien *    notice, this list of conditions and the following disclaimer.
1170651Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1270651Sobrien *    notice, this list of conditions and the following disclaimer in the
1370651Sobrien *    documentation and/or other materials provided with the distribution.
1470651Sobrien *
1570651Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1670651Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1770651Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1870651Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1970651Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2070651Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2170651Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2270651Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2370651Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2470651Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2570651Sobrien * SUCH DAMAGE.
2670651Sobrien *
2770651Sobrien * $FreeBSD$
2870651Sobrien */
2970651Sobrien
3070651Sobrien#ifndef _MACHINE_ELF_H_
3170651Sobrien#define	_MACHINE_ELF_H_ 1
3270651Sobrien
3370651Sobrien/*
3470651Sobrien * EABI ELF definitions for the StrongARM architecture.
3570651Sobrien * See "ARM ELF", document no. `SWS ESPC 0003 A-08' for details.
3670651Sobrien */
3770651Sobrien
3870651Sobrien#include <sys/elf32.h>	/* Definitions common to all 32 bit architectures. */
3970651Sobrien
4070651Sobrien#define	__ELF_WORD_SIZE	32	/* Used by <sys/elf_generic.h> */
4170651Sobrien#include <sys/elf_generic.h>
4270651Sobrien
43128937Scognettypedef struct {        /* Auxiliary vector entry on initial stack */
44128937Scognet	int     a_type;                 /* Entry type. */
45128937Scognet	union {
46128937Scognet		long    a_val;          /* Integer value. */
47128937Scognet		void    *a_ptr;         /* Address. */
48128937Scognet		void    (*a_fcn)(void); /* Function pointer (not used). */
49128937Scognet	} a_un;
50128937Scognet} Elf32_Auxinfo;
51128937Scognet
52128937Scognet__ElfType(Auxinfo);
53128937Scognet
5470651Sobrien#define	ELF_ARCH	EM_ARM
5570651Sobrien
5670651Sobrien#define	ELF_MACHINE_OK(x) ((x) == EM_ARM)
5770651Sobrien
5870651Sobrien/*
5970651Sobrien * Relocation types.
6070651Sobrien */
6170651Sobrien
62128937Scognet/* Values for a_type. */
63128937Scognet#define AT_NULL         0       /* Terminates the vector. */
64128937Scognet#define AT_IGNORE       1       /* Ignored entry. */
65128937Scognet#define AT_EXECFD       2       /* File descriptor of program to load. */
66128937Scognet#define AT_PHDR         3       /* Program header of program already loaded. */
67128937Scognet#define AT_PHENT        4       /* Size of each program header entry. */
68128937Scognet#define AT_PHNUM        5       /* Number of program header entries. */
69128937Scognet#define AT_PAGESZ       6       /* Page size in bytes. */
70128937Scognet#define AT_BASE         7       /* Interpreter's base address. */
71128937Scognet#define AT_FLAGS        8       /* Flags (unused). */
72128937Scognet#define AT_ENTRY        9       /* Where interpreter should transfer control. */
73128937Scognet#define AT_NOTELF       10      /* Program is not ELF ?? */
74128937Scognet#define AT_UID          11      /* Real uid. */
75128937Scognet#define AT_EUID         12      /* Effective uid. */
76128937Scognet#define AT_GID          13      /* Real gid. */
77128937Scognet#define AT_EGID         14      /* Effective gid. */
78189926Skib#define	AT_EXECPATH	15	/* Path to the executable. */
79211412Skib#define	AT_CANARY	16	/* Canary for SSP */
80211412Skib#define	AT_CANARYLEN	17	/* Length of the canary. */
81211412Skib#define	AT_OSRELDATE	18	/* OSRELDATE. */
82211412Skib#define	AT_NCPUS	19	/* Number of CPUs. */
83211412Skib#define	AT_PAGESIZES	20	/* Pagesizes. */
84211412Skib#define	AT_PAGESIZESLEN	21	/* Number of pagesizes. */
85237753Skib#define	AT_TIMEKEEP	22	/* Pointer to timehands. */
86217097Skib#define	AT_STACKPROT	23	/* Initial stack protection. */
87128937Scognet
88217097Skib#define AT_COUNT        24      /* Count of defined aux entry types. */
89128937Scognet
9077931Sobrien#define	R_ARM_COUNT		33	/* Count of defined relocation types. */
9170651Sobrien
9270651Sobrien
9370651Sobrien/* Define "machine" characteristics */
9470651Sobrien#define	ELF_TARG_CLASS	ELFCLASS32
95161591Scognet#ifdef __ARMEB__
96161591Scognet#define	ELF_TARG_DATA	ELFDATA2MSB
97161591Scognet#else
9870651Sobrien#define	ELF_TARG_DATA	ELFDATA2LSB
99161591Scognet#endif
10070651Sobrien#define	ELF_TARG_MACH	EM_ARM
10170651Sobrien#define	ELF_TARG_VER	1
10270651Sobrien
103152743Scognet/*
104152743Scognet * Magic number for the elf trampoline, chosen wisely to be an immediate
105152743Scognet * value.
106152743Scognet */
107152743Scognet#define MAGIC_TRAMP_NUMBER	0x5c000003
108197933Skib
109197933Skib#define	ET_DYN_LOAD_ADDR 0x12000
110197933Skib
11170651Sobrien#endif /* !_MACHINE_ELF_H_ */
112