1*8951b87dSMark Corbin /* 2*8951b87dSMark Corbin * RISC-V ELF definitions 3*8951b87dSMark Corbin * 4*8951b87dSMark Corbin * Copyright (c) 2019 Mark Corbin 5*8951b87dSMark Corbin * 6*8951b87dSMark Corbin * This program is free software; you can redistribute it and/or modify 7*8951b87dSMark Corbin * it under the terms of the GNU General Public License as published by 8*8951b87dSMark Corbin * the Free Software Foundation; either version 2 of the License, or 9*8951b87dSMark Corbin * (at your option) any later version. 10*8951b87dSMark Corbin * 11*8951b87dSMark Corbin * This program is distributed in the hope that it will be useful, 12*8951b87dSMark Corbin * but WITHOUT ANY WARRANTY; without even the implied warranty of 13*8951b87dSMark Corbin * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14*8951b87dSMark Corbin * GNU General Public License for more details. 15*8951b87dSMark Corbin * 16*8951b87dSMark Corbin * You should have received a copy of the GNU General Public License 17*8951b87dSMark Corbin * along with this program; if not, see <http://www.gnu.org/licenses/>. 18*8951b87dSMark Corbin */ 19*8951b87dSMark Corbin 20*8951b87dSMark Corbin #ifndef TARGET_ARCH_ELF_H 21*8951b87dSMark Corbin #define TARGET_ARCH_ELF_H 22*8951b87dSMark Corbin 23*8951b87dSMark Corbin #define elf_check_arch(x) ((x) == EM_RISCV) 24*8951b87dSMark Corbin #define ELF_START_MMAP 0x80000000 25*8951b87dSMark Corbin #define ELF_ET_DYN_LOAD_ADDR 0x100000 26*8951b87dSMark Corbin #define ELF_CLASS ELFCLASS64 27*8951b87dSMark Corbin 28*8951b87dSMark Corbin #define ELF_DATA ELFDATA2LSB 29*8951b87dSMark Corbin #define ELF_ARCH EM_RISCV 30*8951b87dSMark Corbin 31*8951b87dSMark Corbin #define ELF_HWCAP get_elf_hwcap() get_elf_hwcap(void)32*8951b87dSMark Corbinstatic uint32_t get_elf_hwcap(void) 33*8951b87dSMark Corbin { 34*8951b87dSMark Corbin RISCVCPU *cpu = RISCV_CPU(thread_cpu); 35*8951b87dSMark Corbin 36*8951b87dSMark Corbin return cpu->env.misa_ext_mask; 37*8951b87dSMark Corbin } 38*8951b87dSMark Corbin 39*8951b87dSMark Corbin #define USE_ELF_CORE_DUMP 40*8951b87dSMark Corbin #define ELF_EXEC_PAGESIZE 4096 41*8951b87dSMark Corbin 42*8951b87dSMark Corbin #endif /* TARGET_ARCH_ELF_H */ 43