aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/include/asm/elf.h91
-rw-r--r--arch/mips/kernel/binfmt_elfn32.c16
-rw-r--r--arch/mips/kernel/binfmt_elfo32.c20
3 files changed, 62 insertions, 65 deletions
diff --git a/arch/mips/include/asm/elf.h b/arch/mips/include/asm/elf.h
index 68705a0a8014..f5f45717968e 100644
--- a/arch/mips/include/asm/elf.h
+++ b/arch/mips/include/asm/elf.h
@@ -214,25 +214,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
214/* 214/*
215 * This is used to ensure we don't load something for the wrong architecture. 215 * This is used to ensure we don't load something for the wrong architecture.
216 */ 216 */
217#define elf_check_arch(hdr) \ 217#define elf_check_arch elfo32_check_arch
218({ \
219 int __res = 1; \
220 struct elfhdr *__h = (hdr); \
221 \
222 if (!mips_elf_check_machine(__h)) \
223 __res = 0; \
224 if (__h->e_ident[EI_CLASS] != ELFCLASS32) \
225 __res = 0; \
226 if ((__h->e_flags & EF_MIPS_ABI2) != 0) \
227 __res = 0; \
228 if (((__h->e_flags & EF_MIPS_ABI) != 0) && \
229 ((__h->e_flags & EF_MIPS_ABI) != EF_MIPS_ABI_O32)) \
230 __res = 0; \
231 if (__h->e_flags & __MIPS_O32_FP64_MUST_BE_ZERO) \
232 __res = 0; \
233 \
234 __res; \
235})
236 218
237/* 219/*
238 * These are used to set parameters in the core dumps. 220 * These are used to set parameters in the core dumps.
@@ -245,18 +227,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
245/* 227/*
246 * This is used to ensure we don't load something for the wrong architecture. 228 * This is used to ensure we don't load something for the wrong architecture.
247 */ 229 */
248#define elf_check_arch(hdr) \ 230#define elf_check_arch elfn64_check_arch
249({ \
250 int __res = 1; \
251 struct elfhdr *__h = (hdr); \
252 \
253 if (!mips_elf_check_machine(__h)) \
254 __res = 0; \
255 if (__h->e_ident[EI_CLASS] != ELFCLASS64) \
256 __res = 0; \
257 \
258 __res; \
259})
260 231
261/* 232/*
262 * These are used to set parameters in the core dumps. 233 * These are used to set parameters in the core dumps.
@@ -294,6 +265,64 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
294#define vmcore_elf32_check_arch mips_elf_check_machine 265#define vmcore_elf32_check_arch mips_elf_check_machine
295#define vmcore_elf64_check_arch mips_elf_check_machine 266#define vmcore_elf64_check_arch mips_elf_check_machine
296 267
268/*
269 * Return non-zero if HDR identifies an o32 ELF binary.
270 */
271#define elfo32_check_arch(hdr) \
272({ \
273 int __res = 1; \
274 struct elfhdr *__h = (hdr); \
275 \
276 if (!mips_elf_check_machine(__h)) \
277 __res = 0; \
278 if (__h->e_ident[EI_CLASS] != ELFCLASS32) \
279 __res = 0; \
280 if ((__h->e_flags & EF_MIPS_ABI2) != 0) \
281 __res = 0; \
282 if (((__h->e_flags & EF_MIPS_ABI) != 0) && \
283 ((__h->e_flags & EF_MIPS_ABI) != EF_MIPS_ABI_O32)) \
284 __res = 0; \
285 if (__h->e_flags & __MIPS_O32_FP64_MUST_BE_ZERO) \
286 __res = 0; \
287 \
288 __res; \
289})
290
291/*
292 * Return non-zero if HDR identifies an n64 ELF binary.
293 */
294#define elfn64_check_arch(hdr) \
295({ \
296 int __res = 1; \
297 struct elfhdr *__h = (hdr); \
298 \
299 if (!mips_elf_check_machine(__h)) \
300 __res = 0; \
301 if (__h->e_ident[EI_CLASS] != ELFCLASS64) \
302 __res = 0; \
303 \
304 __res; \
305})
306
307/*
308 * Return non-zero if HDR identifies an n32 ELF binary.
309 */
310#define elfn32_check_arch(hdr) \
311({ \
312 int __res = 1; \
313 struct elfhdr *__h = (hdr); \
314 \
315 if (!mips_elf_check_machine(__h)) \
316 __res = 0; \
317 if (__h->e_ident[EI_CLASS] != ELFCLASS32) \
318 __res = 0; \
319 if (((__h->e_flags & EF_MIPS_ABI2) == 0) || \
320 ((__h->e_flags & EF_MIPS_ABI) != 0)) \
321 __res = 0; \
322 \
323 __res; \
324})
325
297struct mips_abi; 326struct mips_abi;
298 327
299extern struct mips_abi mips_abi; 328extern struct mips_abi mips_abi;
diff --git a/arch/mips/kernel/binfmt_elfn32.c b/arch/mips/kernel/binfmt_elfn32.c
index 1b992c6e3d8e..58ad63d7eb42 100644
--- a/arch/mips/kernel/binfmt_elfn32.c
+++ b/arch/mips/kernel/binfmt_elfn32.c
@@ -30,21 +30,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
30/* 30/*
31 * This is used to ensure we don't load something for the wrong architecture. 31 * This is used to ensure we don't load something for the wrong architecture.
32 */ 32 */
33#define elf_check_arch(hdr) \ 33#define elf_check_arch elfn32_check_arch
34({ \
35 int __res = 1; \
36 struct elfhdr *__h = (hdr); \
37 \
38 if (!mips_elf_check_machine(__h)) \
39 __res = 0; \
40 if (__h->e_ident[EI_CLASS] != ELFCLASS32) \
41 __res = 0; \
42 if (((__h->e_flags & EF_MIPS_ABI2) == 0) || \
43 ((__h->e_flags & EF_MIPS_ABI) != 0)) \
44 __res = 0; \
45 \
46 __res; \
47})
48 34
49#define TASK32_SIZE 0x7fff8000UL 35#define TASK32_SIZE 0x7fff8000UL
50#undef ELF_ET_DYN_BASE 36#undef ELF_ET_DYN_BASE
diff --git a/arch/mips/kernel/binfmt_elfo32.c b/arch/mips/kernel/binfmt_elfo32.c
index ca43eaf1734b..49fb881481f7 100644
--- a/arch/mips/kernel/binfmt_elfo32.c
+++ b/arch/mips/kernel/binfmt_elfo32.c
@@ -30,25 +30,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
30/* 30/*
31 * This is used to ensure we don't load something for the wrong architecture. 31 * This is used to ensure we don't load something for the wrong architecture.
32 */ 32 */
33#define elf_check_arch(hdr) \ 33#define elf_check_arch elfo32_check_arch
34({ \
35 int __res = 1; \
36 struct elfhdr *__h = (hdr); \
37 \
38 if (!mips_elf_check_machine(__h)) \
39 __res = 0; \
40 if (__h->e_ident[EI_CLASS] != ELFCLASS32) \
41 __res = 0; \
42 if ((__h->e_flags & EF_MIPS_ABI2) != 0) \
43 __res = 0; \
44 if (((__h->e_flags & EF_MIPS_ABI) != 0) && \
45 ((__h->e_flags & EF_MIPS_ABI) != EF_MIPS_ABI_O32)) \
46 __res = 0; \
47 if (__h->e_flags & __MIPS_O32_FP64_MUST_BE_ZERO) \
48 __res = 0; \
49 \
50 __res; \
51})
52 34
53#ifdef CONFIG_KVM_GUEST 35#ifdef CONFIG_KVM_GUEST
54#define TASK32_SIZE 0x3fff8000UL 36#define TASK32_SIZE 0x3fff8000UL