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 27d5d97bedSMike Karels #ifdef __arm__ 28d5d97bedSMike Karels #include <arm/elf.h> 29d5d97bedSMike Karels #else /* !__arm__ */ 30d5d97bedSMike Karels 31412042e2SAndrew Turner #ifndef _MACHINE_ELF_H_ 32412042e2SAndrew Turner #define _MACHINE_ELF_H_ 33412042e2SAndrew Turner 34412042e2SAndrew Turner /* 35412042e2SAndrew Turner * ELF definitions for the AArch64 architecture. 36412042e2SAndrew Turner */ 37412042e2SAndrew Turner 38412042e2SAndrew Turner #include <sys/elf32.h> /* Definitions common to all 32 bit architectures. */ 39412042e2SAndrew Turner #include <sys/elf64.h> /* Definitions common to all 64 bit architectures. */ 40412042e2SAndrew Turner 419dcf90f8SEd Schouten #ifndef __ELF_WORD_SIZE 42412042e2SAndrew Turner #define __ELF_WORD_SIZE 64 /* Used by <sys/elf_generic.h> */ 439dcf90f8SEd Schouten #endif 449dcf90f8SEd Schouten 45412042e2SAndrew Turner #include <sys/elf_generic.h> 46412042e2SAndrew Turner 47412042e2SAndrew Turner /* 48412042e2SAndrew Turner * Auxiliary vector entries for passing information to the interpreter. 49412042e2SAndrew Turner */ 50412042e2SAndrew Turner 51412042e2SAndrew Turner typedef struct { /* Auxiliary vector entry on initial stack */ 52412042e2SAndrew Turner int a_type; /* Entry type. */ 53412042e2SAndrew Turner union { 54412042e2SAndrew Turner int a_val; /* Integer value. */ 55412042e2SAndrew Turner } a_un; 56412042e2SAndrew Turner } Elf32_Auxinfo; 57412042e2SAndrew Turner 58412042e2SAndrew Turner typedef struct { /* Auxiliary vector entry on initial stack */ 59412042e2SAndrew Turner long a_type; /* Entry type. */ 60412042e2SAndrew Turner union { 61412042e2SAndrew Turner long a_val; /* Integer value. */ 62412042e2SAndrew Turner void *a_ptr; /* Address. */ 63412042e2SAndrew Turner void (*a_fcn)(void); /* Function pointer (not used). */ 64412042e2SAndrew Turner } a_un; 65412042e2SAndrew Turner } Elf64_Auxinfo; 66412042e2SAndrew Turner 67412042e2SAndrew Turner __ElfType(Auxinfo); 68412042e2SAndrew Turner 6926517dcfSJustin Hibbits #ifdef _MACHINE_ELF_WANT_32BIT 7026517dcfSJustin Hibbits #define ELF_ARCH EM_ARM 7126517dcfSJustin Hibbits #else 72412042e2SAndrew Turner #define ELF_ARCH EM_AARCH64 7326517dcfSJustin Hibbits #endif 74412042e2SAndrew Turner 75412042e2SAndrew Turner #define ELF_MACHINE_OK(x) ((x) == (ELF_ARCH)) 76412042e2SAndrew Turner 77412042e2SAndrew Turner /* Define "machine" characteristics */ 789dcf90f8SEd Schouten #if __ELF_WORD_SIZE == 64 79412042e2SAndrew Turner #define ELF_TARG_CLASS ELFCLASS64 80412042e2SAndrew Turner #define ELF_TARG_DATA ELFDATA2LSB 81412042e2SAndrew Turner #define ELF_TARG_MACH EM_AARCH64 82412042e2SAndrew Turner #define ELF_TARG_VER 1 839dcf90f8SEd Schouten #else 849dcf90f8SEd Schouten #define ELF_TARG_CLASS ELFCLASS32 859dcf90f8SEd Schouten #define ELF_TARG_DATA ELFDATA2LSB 869dcf90f8SEd Schouten #define ELF_TARG_MACH EM_ARM 879dcf90f8SEd Schouten #define ELF_TARG_VER 1 889dcf90f8SEd Schouten #endif 89412042e2SAndrew Turner 908c9c3144SOlivier Houchard #if __ELF_WORD_SIZE == 32 91ca18304eSKonstantin Belousov #define ET_DYN_LOAD_ADDR 0x01001000 928c9c3144SOlivier Houchard #else 93412042e2SAndrew Turner #define ET_DYN_LOAD_ADDR 0x100000 948c9c3144SOlivier Houchard #endif 95412042e2SAndrew Turner 96d5fdfa2cSEmmanuel Vadot /* HWCAP */ 97d5fdfa2cSEmmanuel Vadot #define HWCAP_FP 0x00000001 98d5fdfa2cSEmmanuel Vadot #define HWCAP_ASIMD 0x00000002 99d5fdfa2cSEmmanuel Vadot #define HWCAP_EVTSTRM 0x00000004 100d5fdfa2cSEmmanuel Vadot #define HWCAP_AES 0x00000008 101d5fdfa2cSEmmanuel Vadot #define HWCAP_PMULL 0x00000010 102d5fdfa2cSEmmanuel Vadot #define HWCAP_SHA1 0x00000020 103d5fdfa2cSEmmanuel Vadot #define HWCAP_SHA2 0x00000040 104d5fdfa2cSEmmanuel Vadot #define HWCAP_CRC32 0x00000080 105d5fdfa2cSEmmanuel Vadot #define HWCAP_ATOMICS 0x00000100 106d5fdfa2cSEmmanuel Vadot #define HWCAP_FPHP 0x00000200 107d81d009cSMitchell Horne #define HWCAP_ASIMDHP 0x00000400 108d81d009cSMitchell Horne /* 109d81d009cSMitchell Horne * XXX: The following bits (from CPUID to FLAGM) were originally incorrect, 110d81d009cSMitchell Horne * but later changed to match the Linux definitions. No compatibility code is 111d81d009cSMitchell Horne * provided, as the fix was expected to result in near-zero fallout. 112d81d009cSMitchell Horne */ 113d81d009cSMitchell Horne #define HWCAP_CPUID 0x00000800 114d81d009cSMitchell Horne #define HWCAP_ASIMDRDM 0x00001000 115d81d009cSMitchell Horne #define HWCAP_JSCVT 0x00002000 116d81d009cSMitchell Horne #define HWCAP_FCMA 0x00004000 117d81d009cSMitchell Horne #define HWCAP_LRCPC 0x00008000 118d81d009cSMitchell Horne #define HWCAP_DCPOP 0x00010000 119d81d009cSMitchell Horne #define HWCAP_SHA3 0x00020000 120d81d009cSMitchell Horne #define HWCAP_SM3 0x00040000 121d81d009cSMitchell Horne #define HWCAP_SM4 0x00080000 122d81d009cSMitchell Horne #define HWCAP_ASIMDDP 0x00100000 123d81d009cSMitchell Horne #define HWCAP_SHA512 0x00200000 124d81d009cSMitchell Horne #define HWCAP_SVE 0x00400000 125d81d009cSMitchell Horne #define HWCAP_ASIMDFHM 0x00800000 126d81d009cSMitchell Horne #define HWCAP_DIT 0x01000000 127d81d009cSMitchell Horne #define HWCAP_USCAT 0x02000000 128d81d009cSMitchell Horne #define HWCAP_ILRCPC 0x04000000 129d81d009cSMitchell Horne #define HWCAP_FLAGM 0x08000000 1307ea40e1dSMitchell Horne #define HWCAP_SSBS 0x10000000 1317ea40e1dSMitchell Horne #define HWCAP_SB 0x20000000 1327ea40e1dSMitchell Horne #define HWCAP_PACA 0x40000000 1337ea40e1dSMitchell Horne #define HWCAP_PACG 0x80000000 1347ea40e1dSMitchell Horne 1357ea40e1dSMitchell Horne /* HWCAP2 */ 1360f093880SAndrew Turner #define HWCAP2_DCPODP 0x0000000000000001ul 1370f093880SAndrew Turner #define HWCAP2_SVE2 0x0000000000000002ul 1380f093880SAndrew Turner #define HWCAP2_SVEAES 0x0000000000000004ul 1390f093880SAndrew Turner #define HWCAP2_SVEPMULL 0x0000000000000008ul 1400f093880SAndrew Turner #define HWCAP2_SVEBITPERM 0x0000000000000010ul 1410f093880SAndrew Turner #define HWCAP2_SVESHA3 0x0000000000000020ul 1420f093880SAndrew Turner #define HWCAP2_SVESM4 0x0000000000000040ul 1430f093880SAndrew Turner #define HWCAP2_FLAGM2 0x0000000000000080ul 1440f093880SAndrew Turner #define HWCAP2_FRINT 0x0000000000000100ul 1450f093880SAndrew Turner #define HWCAP2_SVEI8MM 0x0000000000000200ul 1460f093880SAndrew Turner #define HWCAP2_SVEF32MM 0x0000000000000400ul 1470f093880SAndrew Turner #define HWCAP2_SVEF64MM 0x0000000000000800ul 1480f093880SAndrew Turner #define HWCAP2_SVEBF16 0x0000000000001000ul 1490f093880SAndrew Turner #define HWCAP2_I8MM 0x0000000000002000ul 1500f093880SAndrew Turner #define HWCAP2_BF16 0x0000000000004000ul 1510f093880SAndrew Turner #define HWCAP2_DGH 0x0000000000008000ul 1520f093880SAndrew Turner #define HWCAP2_RNG 0x0000000000010000ul 1530f093880SAndrew Turner #define HWCAP2_BTI 0x0000000000020000ul 154*2ee649c1SAndrew Turner #define HWCAP2_MTE 0x0000000000040000ul 155*2ee649c1SAndrew Turner #define HWCAP2_ECV 0x0000000000080000ul 156*2ee649c1SAndrew Turner #define HWCAP2_AFP 0x0000000000100000ul 157*2ee649c1SAndrew Turner #define HWCAP2_RPRES 0x0000000000200000ul 158*2ee649c1SAndrew Turner #define HWCAP2_MTE3 0x0000000000400000ul 159*2ee649c1SAndrew Turner #define HWCAP2_SME 0x0000000000800000ul 160*2ee649c1SAndrew Turner #define HWCAP2_SME_I16I64 0x0000000001000000ul 161*2ee649c1SAndrew Turner #define HWCAP2_SME_F64F64 0x0000000002000000ul 162*2ee649c1SAndrew Turner #define HWCAP2_SME_I8I32 0x0000000004000000ul 163*2ee649c1SAndrew Turner #define HWCAP2_SME_F16F32 0x0000000008000000ul 164*2ee649c1SAndrew Turner #define HWCAP2_SME_B16F32 0x0000000010000000ul 165*2ee649c1SAndrew Turner #define HWCAP2_SME_F32F32 0x0000000020000000ul 166*2ee649c1SAndrew Turner #define HWCAP2_SME_FA64 0x0000000040000000ul 167*2ee649c1SAndrew Turner #define HWCAP2_WFXT 0x0000000080000000ul 168*2ee649c1SAndrew Turner #define HWCAP2_EBF16 0x0000000100000000ul 169*2ee649c1SAndrew Turner #define HWCAP2_SVE_EBF16 0x0000000200000000ul 170*2ee649c1SAndrew Turner #define HWCAP2_CSSC 0x0000000400000000ul 171*2ee649c1SAndrew Turner #define HWCAP2_RPRFM 0x0000000800000000ul 172*2ee649c1SAndrew Turner #define HWCAP2_SVE2P1 0x0000001000000000ul 173*2ee649c1SAndrew Turner #define HWCAP2_SME2 0x0000002000000000ul 174*2ee649c1SAndrew Turner #define HWCAP2_SME2P1 0x0000004000000000ul 175*2ee649c1SAndrew Turner #define HWCAP2_SME_I16I32 0x0000008000000000ul 176*2ee649c1SAndrew Turner #define HWCAP2_SME_BI32I32 0x0000010000000000ul 177*2ee649c1SAndrew Turner #define HWCAP2_SME_B16B16 0x0000020000000000ul 178*2ee649c1SAndrew Turner #define HWCAP2_SME_F16F16 0x0000040000000000ul 179*2ee649c1SAndrew Turner #define HWCAP2_MOPS 0x0000080000000000ul 180*2ee649c1SAndrew Turner #define HWCAP2_HBC 0x0000100000000000ul 181d5fdfa2cSEmmanuel Vadot 182bbe80bffSPeter Grehan #ifdef COMPAT_FREEBSD32 183bbe80bffSPeter Grehan /* ARM HWCAP */ 184bbe80bffSPeter Grehan #define HWCAP32_HALF 0x00000002 /* Always set. */ 185bbe80bffSPeter Grehan #define HWCAP32_THUMB 0x00000004 /* Always set. */ 186bbe80bffSPeter Grehan #define HWCAP32_FAST_MULT 0x00000010 /* Always set. */ 187bbe80bffSPeter Grehan #define HWCAP32_VFP 0x00000040 188bbe80bffSPeter Grehan #define HWCAP32_EDSP 0x00000080 /* Always set. */ 189bbe80bffSPeter Grehan #define HWCAP32_NEON 0x00001000 190bbe80bffSPeter Grehan #define HWCAP32_VFPv3 0x00002000 191bbe80bffSPeter Grehan #define HWCAP32_TLS 0x00008000 /* Always set. */ 192bbe80bffSPeter Grehan #define HWCAP32_VFPv4 0x00010000 193bbe80bffSPeter Grehan #define HWCAP32_IDIVA 0x00020000 /* Always set. */ 194bbe80bffSPeter Grehan #define HWCAP32_IDIVT 0x00040000 /* Always set. */ 195bbe80bffSPeter Grehan #define HWCAP32_VFPD32 0x00080000 /* Always set. */ 196bbe80bffSPeter Grehan #define HWCAP32_LPAE 0x00100000 /* Always set. */ 197bbe80bffSPeter Grehan 198bbe80bffSPeter Grehan #define HWCAP32_DEFAULT \ 199bbe80bffSPeter Grehan (HWCAP32_HALF | HWCAP32_THUMB | HWCAP32_FAST_MULT | HWCAP32_EDSP |\ 200bbe80bffSPeter Grehan HWCAP32_TLS | HWCAP32_IDIVA | HWCAP32_IDIVT | HWCAP32_VFPD32 | \ 201bbe80bffSPeter Grehan HWCAP32_LPAE) 202bbe80bffSPeter Grehan 203bbe80bffSPeter Grehan /* ARM HWCAP2 */ 204bbe80bffSPeter Grehan #define HWCAP32_2_AES 0x00000001 205bbe80bffSPeter Grehan #define HWCAP32_2_PMULL 0x00000002 206bbe80bffSPeter Grehan #define HWCAP32_2_SHA1 0x00000004 207bbe80bffSPeter Grehan #define HWCAP32_2_SHA2 0x00000008 208bbe80bffSPeter Grehan #define HWCAP32_2_CRC32 0x00000010 209bbe80bffSPeter Grehan #endif 210bbe80bffSPeter Grehan 211412042e2SAndrew Turner #endif /* !_MACHINE_ELF_H_ */ 212d5d97bedSMike Karels 213d5d97bedSMike Karels #endif /* !__arm__ */ 214