1 /*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 */
6 #ifndef _ASM_ELF_H
7 #define _ASM_ELF_H
8
9 #include <asm/ptrace.h>
10 #include <asm/user.h>
11
12 #ifndef ELF_ARCH
13 /* ELF register definitions */
14 #define ELF_NGREG 45
15 #define ELF_NFPREG 33
16
17 typedef unsigned long elf_greg_t;
18 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
19
20 typedef double elf_fpreg_t;
21 typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
22
23 /*
24 * This is used to ensure we don't load something for the wrong
25 * architecture or OS.
26 */
27 #define elf_check_arch(hdr) \
28 ({ \
29 int __res = 1; \
30 struct elfhdr *__h = (hdr); \
31 \
32 if ((__h->e_machine != EM_MIPS) && \
33 (__h->e_machine != EM_MIPS_RS4_BE)) \
34 __res = 0; \
35 if (sizeof(elf_caddr_t) == 8 && \
36 __h->e_ident[EI_CLASS] == ELFCLASS32) \
37 __res = 0; \
38 \
39 __res; \
40 })
41
42 /*
43 * These are used to set parameters in the core dumps.
44 */
45 #define ELF_CLASS ELFCLASS64
46 #ifdef __MIPSEB__
47 #define ELF_DATA ELFDATA2MSB
48 #elif __MIPSEL__
49 #define ELF_DATA ELFDATA2LSB
50 #endif
51 #define ELF_ARCH EM_MIPS
52 #endif /* !defined(ELF_ARCH) */
53
54 #define USE_ELF_CORE_DUMP
55 #define ELF_EXEC_PAGESIZE 4096
56
57 #define ELF_CORE_COPY_REGS(_dest,_regs) \
58 memcpy((char *) &_dest, (char *) _regs, \
59 sizeof(struct pt_regs));
60
61 /* This yields a mask that user programs can use to figure out what
62 instruction set this cpu supports. This could be done in userspace,
63 but it's not easy, and we've already done it here. */
64
65 #define ELF_HWCAP (0)
66
67 /* This yields a string that ld.so will use to load implementation
68 specific libraries for optimization. This is more specific in
69 intent than poking at uname or /proc/cpuinfo.
70
71 For the moment, we have only optimizations for the Intel generations,
72 but that could change... */
73
74 #define ELF_PLATFORM (NULL)
75
76 /*
77 * See comments in asm-alpha/elf.h, this is the same thing
78 * on the MIPS.
79 */
80 #define ELF_PLAT_INIT(_r) do { \
81 _r->regs[1] = _r->regs[2] = _r->regs[3] = _r->regs[4] = 0; \
82 _r->regs[5] = _r->regs[6] = _r->regs[7] = _r->regs[8] = 0; \
83 _r->regs[9] = _r->regs[10] = _r->regs[11] = _r->regs[12] = 0; \
84 _r->regs[13] = _r->regs[14] = _r->regs[15] = _r->regs[16] = 0; \
85 _r->regs[17] = _r->regs[18] = _r->regs[19] = _r->regs[20] = 0; \
86 _r->regs[21] = _r->regs[22] = _r->regs[23] = _r->regs[24] = 0; \
87 _r->regs[25] = _r->regs[26] = _r->regs[27] = _r->regs[28] = 0; \
88 _r->regs[30] = _r->regs[31] = 0; \
89 } while (0)
90
91 /* This is the location that an ET_DYN program is loaded if exec'ed. Typical
92 use of this is to invoke "./ld.so someprog" to test out a new version of
93 the loader. We need to make sure that it is out of the way of the program
94 that it will "exec", and that there is sufficient room for the brk. */
95
96 #ifndef ELF_ET_DYN_BASE
97 #define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
98 #endif
99
100 #ifdef __KERNEL__
101 #define SET_PERSONALITY(ex, ibcs2) \
102 do { if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
103 current->thread.mflags |= MF_32BIT; \
104 else \
105 current->thread.mflags &= ~MF_32BIT; \
106 if (ibcs2) \
107 set_personality(PER_SVR4); \
108 else if (current->personality != PER_LINUX32) \
109 set_personality(PER_LINUX); \
110 } while (0)
111 #endif
112
113 #endif /* _ASM_ELF_H */
114
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.