| 1 | /* |
| 2 | * This program is free software; you can redistribute it and/or modify |
| 3 | * it under the terms of the GNU General Public License version 2 as |
| 4 | * published by the Free Software Foundation, or (at your option) any |
| 5 | * later version. See the COPYING file in the top-level directory. |
| 6 | */ |
| 7 | |
| 8 | #ifndef RISCV_TARGET_ELF_H |
| 9 | #define RISCV_TARGET_ELF_H |
| 10 | |
| 11 | #define ELF_MACHINE EM_RISCV |
| 12 | |
| 13 | #ifdef TARGET_RISCV32 |
| 14 | #define ELF_CLASS ELFCLASS32 |
| 15 | #define VDSO_HEADER "vdso-32.c.inc" |
| 16 | #else |
| 17 | #define ELF_CLASS ELFCLASS64 |
| 18 | #define VDSO_HEADER "vdso-64.c.inc" |
| 19 | #endif |
| 20 | |
| 21 | #define HAVE_ELF_HWCAP 1 |
| 22 | #define HAVE_ELF_CORE_DUMP 1 |
| 23 | |
| 24 | /* Mirrors struct user_regs_struct: pc followed by x1 (ra) .. x31 (t6). */ |
| 25 | typedef struct target_elf_gregset_t { |
| 26 | abi_ulong pc; |
| 27 | abi_ulong regs[31]; |
| 28 | } target_elf_gregset_t; |
| 29 | |
| 30 | #define HAVE_ELF_CORE_FPREGS 1 |
| 31 | |
| 32 | /* |
| 33 | * Matches struct __riscv_d_ext_state from uapi/asm/ptrace.h: |
| 34 | * f0-f31 as 64-bit values followed by fcsr. |
| 35 | */ |
| 36 | typedef struct target_elf_fpregset_t { |
| 37 | uint64_t fpr[32]; |
| 38 | uint32_t fcsr; |
| 39 | } target_elf_fpregset_t; |
| 40 | |
| 41 | #endif |