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