1
2
3
4
5
6
7
8#ifndef _ASM_RISCV_ELF_H
9#define _ASM_RISCV_ELF_H
10
11#include <uapi/asm/elf.h>
12#include <asm/auxvec.h>
13#include <asm/byteorder.h>
14#include <asm/cacheinfo.h>
15
16
17
18
19#define ELF_ARCH EM_RISCV
20
21#ifdef CONFIG_64BIT
22#define ELF_CLASS ELFCLASS64
23#else
24#define ELF_CLASS ELFCLASS32
25#endif
26
27#define ELF_DATA ELFDATA2LSB
28
29
30
31
32#define elf_check_arch(x) ((x)->e_machine == EM_RISCV)
33
34#define CORE_DUMP_USE_REGSET
35#define ELF_EXEC_PAGESIZE (PAGE_SIZE)
36
37
38
39
40
41
42
43#define ELF_ET_DYN_BASE ((TASK_SIZE / 3) * 2)
44
45#ifdef CONFIG_64BIT
46#define STACK_RND_MASK (0x3ffff >> (PAGE_SHIFT - 12))
47#endif
48
49
50
51
52
53#define ELF_HWCAP (elf_hwcap)
54extern unsigned long elf_hwcap;
55
56
57
58
59
60
61#define ELF_PLATFORM (NULL)
62
63#ifdef CONFIG_MMU
64#define ARCH_DLINFO \
65do { \
66 NEW_AUX_ENT(AT_SYSINFO_EHDR, \
67 (elf_addr_t)current->mm->context.vdso); \
68 NEW_AUX_ENT(AT_L1I_CACHESIZE, \
69 get_cache_size(1, CACHE_TYPE_INST)); \
70 NEW_AUX_ENT(AT_L1I_CACHEGEOMETRY, \
71 get_cache_geometry(1, CACHE_TYPE_INST)); \
72 NEW_AUX_ENT(AT_L1D_CACHESIZE, \
73 get_cache_size(1, CACHE_TYPE_DATA)); \
74 NEW_AUX_ENT(AT_L1D_CACHEGEOMETRY, \
75 get_cache_geometry(1, CACHE_TYPE_DATA)); \
76 NEW_AUX_ENT(AT_L2_CACHESIZE, \
77 get_cache_size(2, CACHE_TYPE_UNIFIED)); \
78 NEW_AUX_ENT(AT_L2_CACHEGEOMETRY, \
79 get_cache_geometry(2, CACHE_TYPE_UNIFIED)); \
80} while (0)
81#define ARCH_HAS_SETUP_ADDITIONAL_PAGES
82struct linux_binprm;
83extern int arch_setup_additional_pages(struct linux_binprm *bprm,
84 int uses_interp);
85#endif
86
87#define ELF_CORE_COPY_REGS(dest, regs) \
88do { \
89 *(struct user_regs_struct *)&(dest) = \
90 *(struct user_regs_struct *)regs; \
91} while (0);
92
93#endif
94