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: stable/11/sys/arm/include/elf.h 340556 2018-11-18 09:58:36Z kib $ 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. */ 63283297Simp#define AT_NULL 0 /* Terminates the vector. */ 64283297Simp#define AT_IGNORE 1 /* Ignored entry. */ 65283297Simp#define AT_EXECFD 2 /* File descriptor of program to load. */ 66283297Simp#define AT_PHDR 3 /* Program header of program already loaded. */ 67283297Simp#define AT_PHENT 4 /* Size of each program header entry. */ 68283297Simp#define AT_PHNUM 5 /* Number of program header entries. */ 69283297Simp#define AT_PAGESZ 6 /* Page size in bytes. */ 70283297Simp#define AT_BASE 7 /* Interpreter's base address. */ 71283297Simp#define AT_FLAGS 8 /* Flags (unused). */ 72283297Simp#define AT_ENTRY 9 /* Where interpreter should transfer control. */ 73283297Simp#define AT_NOTELF 10 /* Program is not ELF ?? */ 74283297Simp#define AT_UID 11 /* Real uid. */ 75283297Simp#define AT_EUID 12 /* Effective uid. */ 76283297Simp#define AT_GID 13 /* Real gid. */ 77283297Simp#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. */ 85237430Skib#define AT_TIMEKEEP 22 /* Pointer to timehands. */ 86217097Skib#define AT_STACKPROT 23 /* Initial stack protection. */ 87283297Simp#define AT_EHDRFLAGS 24 /* e_flags field from elf hdr */ 88324687Sjhb#define AT_HWCAP 25 /* CPU feature flags. */ 89325810Sjhb#define AT_HWCAP2 26 /* CPU feature flags 2. */ 90128937Scognet 91325810Sjhb#define AT_COUNT 27 /* Count of defined aux entry types. */ 92128937Scognet 93283297Simp#define R_ARM_COUNT 33 /* Count of defined relocation types. */ 9470651Sobrien 9570651Sobrien 9670651Sobrien/* Define "machine" characteristics */ 9770651Sobrien#define ELF_TARG_CLASS ELFCLASS32 98161591Scognet#ifdef __ARMEB__ 99161591Scognet#define ELF_TARG_DATA ELFDATA2MSB 100161591Scognet#else 10170651Sobrien#define ELF_TARG_DATA ELFDATA2LSB 102161591Scognet#endif 10370651Sobrien#define ELF_TARG_MACH EM_ARM 10470651Sobrien#define ELF_TARG_VER 1 10570651Sobrien 106270123Simp/* Defines specific for arm headers */ 107283297Simp#define EF_ARM_EABI_VERSION(x) (((x) & EF_ARM_EABIMASK) >> 24) 108283297Simp#define EF_ARM_EABI_VERSION_UNKNOWN 0 109283297Simp#define EF_ARM_EABI_FREEBSD_MIN 4 110270123Simp 111236992Simp/* 112236992Simp * Magic number for the elf trampoline, chosen wisely to be an immediate 113152743Scognet * value. 114152743Scognet */ 115283297Simp#define MAGIC_TRAMP_NUMBER 0x5c000003 116197933Skib 117340556Skib#define ET_DYN_LOAD_ADDR 0x500000 118197933Skib 119325810Sjhb/* Flags passed in AT_HWCAP. */ 120325810Sjhb#define HWCAP_SWP 0x00000001 /* Unsupported, never set. */ 121325810Sjhb#define HWCAP_HALF 0x00000002 /* Always set. */ 122325810Sjhb#define HWCAP_THUMB 0x00000004 123325810Sjhb#define HWCAP_26BIT 0x00000008 /* Unsupported, never set. */ 124325810Sjhb#define HWCAP_FAST_MULT 0x00000010 /* Always set. */ 125325810Sjhb#define HWCAP_FPA 0x00000020 /* Unsupported, never set. */ 126325810Sjhb#define HWCAP_VFP 0x00000040 127325810Sjhb#define HWCAP_EDSP 0x00000080 /* Always set for ARMv6+. */ 128325810Sjhb#define HWCAP_JAVA 0x00000100 /* Unsupported, never set. */ 129325810Sjhb#define HWCAP_IWMMXT 0x00000200 /* Unsupported, never set. */ 130325810Sjhb#define HWCAP_CRUNCH 0x00000400 /* Unsupported, never set. */ 131325810Sjhb#define HWCAP_THUMBEE 0x00000800 132325810Sjhb#define HWCAP_NEON 0x00001000 133325810Sjhb#define HWCAP_VFPv3 0x00002000 134325810Sjhb#define HWCAP_VFPv3D16 0x00004000 135325810Sjhb#define HWCAP_TLS 0x00008000 /* Always set for ARMv6+. */ 136325810Sjhb#define HWCAP_VFPv4 0x00010000 137325810Sjhb#define HWCAP_IDIVA 0x00020000 138325810Sjhb#define HWCAP_IDIVT 0x00040000 139325810Sjhb#define HWCAP_VFPD32 0x00080000 140325810Sjhb#define HWCAP_IDIV (HWCAP_IDIVA | HWCAP_IDIVT) 141325810Sjhb#define HWCAP_LPAE 0x00100000 142325810Sjhb#define HWCAP_EVTSTRM 0x00200000 /* Not implemented yet. */ 143325810Sjhb 144325810Sjhb 145325810Sjhb/* Flags passed in AT_HWCAP2. */ 146325810Sjhb#define HWCAP2_AES 0x00000001 147325810Sjhb#define HWCAP2_PMULL 0x00000002 148325810Sjhb#define HWCAP2_SHA1 0x00000004 149325810Sjhb#define HWCAP2_SHA2 0x00000008 150325810Sjhb#define HWCAP2_CRC32 0x00000010 151325810Sjhb 15270651Sobrien#endif /* !_MACHINE_ELF_H_ */ 153