1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#ifndef _ASM_TILE_ELF_H
16#define _ASM_TILE_ELF_H
17
18
19
20
21
22#include <arch/chip.h>
23
24#include <linux/ptrace.h>
25#include <linux/elf-em.h>
26#include <asm/byteorder.h>
27#include <asm/page.h>
28
29typedef unsigned long elf_greg_t;
30
31#define ELF_NGREG (sizeof(struct pt_regs) / sizeof(elf_greg_t))
32typedef elf_greg_t elf_gregset_t[ELF_NGREG];
33
34
35#define ELF_NFPREG 0
36typedef double elf_fpreg_t;
37typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
38
39#ifdef __tilegx__
40#define ELF_CLASS ELFCLASS64
41#else
42#define ELF_CLASS ELFCLASS32
43#endif
44#ifdef __BIG_ENDIAN__
45#define ELF_DATA ELFDATA2MSB
46#else
47#define ELF_DATA ELFDATA2LSB
48#endif
49
50
51
52
53
54
55enum { ELF_ARCH = CHIP_ELF_TYPE() };
56#define ELF_ARCH ELF_ARCH
57
58
59
60
61#define elf_check_arch(x) \
62 ((x)->e_ident[EI_CLASS] == ELF_CLASS && \
63 (x)->e_ident[EI_DATA] == ELF_DATA && \
64 (x)->e_machine == CHIP_ELF_TYPE())
65
66
67#ifndef __tilegx__
68#define R_TILE_32 1
69#define R_TILE_JOFFLONG_X1 15
70#define R_TILE_IMM16_X0_LO 25
71#define R_TILE_IMM16_X1_LO 26
72#define R_TILE_IMM16_X0_HA 29
73#define R_TILE_IMM16_X1_HA 30
74#else
75#define R_TILEGX_64 1
76#define R_TILEGX_JUMPOFF_X1 21
77#define R_TILEGX_IMM16_X0_HW0 36
78#define R_TILEGX_IMM16_X1_HW0 37
79#define R_TILEGX_IMM16_X0_HW1 38
80#define R_TILEGX_IMM16_X1_HW1 39
81#define R_TILEGX_IMM16_X0_HW2_LAST 48
82#define R_TILEGX_IMM16_X1_HW2_LAST 49
83#endif
84
85
86#define ELF_EXEC_PAGESIZE PAGE_SIZE
87
88
89
90
91
92
93
94#define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2)
95
96#define ELF_CORE_COPY_REGS(_dest, _regs) \
97 memcpy((char *) &_dest, (char *) _regs, \
98 sizeof(struct pt_regs));
99
100
101#define ELF_CORE_COPY_FPREGS(t, fpu) 0
102
103
104
105
106
107
108#define ELF_HWCAP (0)
109
110
111
112
113
114
115#define ELF_PLATFORM (NULL)
116
117extern void elf_plat_init(struct pt_regs *regs, unsigned long load_addr);
118
119#define ELF_PLAT_INIT(_r, load_addr) elf_plat_init(_r, load_addr)
120
121extern int dump_task_regs(struct task_struct *, elf_gregset_t *);
122#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
123
124
125#define SET_PERSONALITY(ex) do { } while (0)
126
127#define ARCH_HAS_SETUP_ADDITIONAL_PAGES
128
129struct linux_binprm;
130extern int arch_setup_additional_pages(struct linux_binprm *bprm,
131 int executable_stack);
132
133#define ARCH_DLINFO \
134do { \
135 NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE); \
136} while (0)
137
138struct mm_struct;
139extern unsigned long arch_randomize_brk(struct mm_struct *mm);
140#define arch_randomize_brk arch_randomize_brk
141
142#ifdef CONFIG_COMPAT
143
144#define COMPAT_ELF_PLATFORM "tilegx-m32"
145
146
147
148
149
150
151#define compat_elf_check_arch(x) \
152 ((x)->e_ident[EI_CLASS] == ELFCLASS32 && \
153 (x)->e_machine == CHIP_ELF_TYPE())
154
155#define compat_start_thread(regs, ip, usp) do { \
156 regs->pc = ptr_to_compat_reg((void *)(ip)); \
157 regs->sp = ptr_to_compat_reg((void *)(usp)); \
158 single_step_execve(); \
159 } while (0)
160
161
162
163
164#undef SET_PERSONALITY
165#define SET_PERSONALITY(ex) \
166do { \
167 set_personality(PER_LINUX | (current->personality & (~PER_MASK))); \
168 current_thread_info()->status &= ~TS_COMPAT; \
169} while (0)
170#define COMPAT_SET_PERSONALITY(ex) \
171do { \
172 set_personality(PER_LINUX | (current->personality & (~PER_MASK))); \
173 current_thread_info()->status |= TS_COMPAT; \
174} while (0)
175
176#define COMPAT_ELF_ET_DYN_BASE (0xffffffff / 3 * 2)
177
178#endif
179
180#define CORE_DUMP_USE_REGSET
181
182#endif
183