aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-mips/elf.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-mips/elf.h')
-rw-r--r--include/asm-mips/elf.h81
1 files changed, 62 insertions, 19 deletions
diff --git a/include/asm-mips/elf.h b/include/asm-mips/elf.h
index bb031f3cd4db..a4db9ec95665 100644
--- a/include/asm-mips/elf.h
+++ b/include/asm-mips/elf.h
@@ -193,33 +193,76 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
193 193
194#ifdef __KERNEL__ 194#ifdef __KERNEL__
195 195
196struct mips_abi;
197
198extern struct mips_abi mips_abi;
199extern struct mips_abi mips_abi_32;
200extern struct mips_abi mips_abi_n32;
201
196#ifdef CONFIG_32BIT 202#ifdef CONFIG_32BIT
197 203
198#define SET_PERSONALITY(ex, ibcs2) \ 204#define SET_PERSONALITY(ex, ibcs2) \
199do { \ 205do { \
200 if (ibcs2) \ 206 if (ibcs2) \
201 set_personality(PER_SVR4); \ 207 set_personality(PER_SVR4); \
202 set_personality(PER_LINUX); \ 208 set_personality(PER_LINUX); \
209 \
210 current->thread.abi = &mips_abi; \
203} while (0) 211} while (0)
204 212
205#endif /* CONFIG_32BIT */ 213#endif /* CONFIG_32BIT */
206 214
207#ifdef CONFIG_64BIT 215#ifdef CONFIG_64BIT
208 216
209#define SET_PERSONALITY(ex, ibcs2) \ 217#ifdef CONFIG_MIPS32_N32
210do { current->thread.mflags &= ~MF_ABI_MASK; \ 218#define __SET_PERSONALITY32_N32() \
211 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) { \ 219 do { \
212 if ((((ex).e_flags & EF_MIPS_ABI2) != 0) && \ 220 current->thread.mflags |= MF_N32; \
213 ((ex).e_flags & EF_MIPS_ABI) == 0) \ 221 current->thread.abi = &mips_abi_n32; \
214 current->thread.mflags |= MF_N32; \ 222 } while (0)
215 else \ 223#else
216 current->thread.mflags |= MF_O32; \ 224#define __SET_PERSONALITY32_N32() \
217 } else \ 225 do { } while (0)
218 current->thread.mflags |= MF_N64; \ 226#endif
219 if (ibcs2) \ 227
220 set_personality(PER_SVR4); \ 228#ifdef CONFIG_MIPS32_O32
221 else if (current->personality != PER_LINUX32) \ 229#define __SET_PERSONALITY32_O32() \
222 set_personality(PER_LINUX); \ 230 do { \
231 current->thread.mflags |= MF_O32; \
232 current->thread.abi = &mips_abi_32; \
233 } while (0)
234#else
235#define __SET_PERSONALITY32_O32() \
236 do { } while (0)
237#endif
238
239#ifdef CONFIG_MIPS32_COMPAT
240#define __SET_PERSONALITY32(ex) \
241do { \
242 if ((((ex).e_flags & EF_MIPS_ABI2) != 0) && \
243 ((ex).e_flags & EF_MIPS_ABI) == 0) \
244 __SET_PERSONALITY32_N32(); \
245 else \
246 __SET_PERSONALITY32_O32(); \
247} while (0)
248#else
249#define __SET_PERSONALITY32(ex) do { } while (0)
250#endif
251
252#define SET_PERSONALITY(ex, ibcs2) \
253do { \
254 current->thread.mflags &= ~MF_ABI_MASK; \
255 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
256 __SET_PERSONALITY32(ex); \
257 else { \
258 current->thread.mflags |= MF_N64; \
259 current->thread.abi = &mips_abi; \
260 } \
261 \
262 if (ibcs2) \
263 set_personality(PER_SVR4); \
264 else if (current->personality != PER_LINUX32) \
265 set_personality(PER_LINUX); \
223} while (0) 266} while (0)
224 267
225#endif /* CONFIG_64BIT */ 268#endif /* CONFIG_64BIT */