File: /usr/src/linux/include/asm-mips/elf.h
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 /* ELF register definitions */
10 #define ELF_NGREG 45
11 #define ELF_NFPREG 33
12
13 typedef unsigned long elf_greg_t;
14 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
15
16 typedef double elf_fpreg_t;
17 typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
18
19 /*
20 * This is used to ensure we don't load something for the wrong architecture
21 * and also rejects IRIX binaries.
22 */
23 #define elf_check_arch(hdr) \
24 ({ \
25 int __res = 1; \
26 struct elfhdr *__h = (hdr); \
27 \
28 if (__h->e_machine != EM_MIPS) \
29 __res = 0; \
30 if (__h->e_flags & EF_MIPS_ARCH) \
31 __res = 0; \
32 \
33 __res; \
34 })
35
36 /* This one accepts IRIX binaries. */
37 #define irix_elf_check_arch(hdr) ((hdr)->e_machine == EM_MIPS)
38
39 /*
40 * These are used to set parameters in the core dumps.
41 */
42 #define ELF_CLASS ELFCLASS32
43 #ifdef __MIPSEB__
44 #define ELF_DATA ELFDATA2MSB
45 #elif __MIPSEL__
46 #define ELF_DATA ELFDATA2LSB
47 #endif
48 #define ELF_ARCH EM_MIPS
49
50 #define USE_ELF_CORE_DUMP
51 #define ELF_EXEC_PAGESIZE 4096
52
53 #define ELF_CORE_COPY_REGS(_dest,_regs) \
54 memcpy((char *) &_dest, (char *) _regs, \
55 sizeof(struct pt_regs));
56
57 /* This yields a mask that user programs can use to figure out what
58 instruction set this cpu supports. This could be done in userspace,
59 but it's not easy, and we've already done it here. */
60
61 #define ELF_HWCAP (0)
62
63 /* This yields a string that ld.so will use to load implementation
64 specific libraries for optimization. This is more specific in
65 intent than poking at uname or /proc/cpuinfo.
66
67 For the moment, we have only optimizations for the Intel generations,
68 but that could change... */
69
70 #define ELF_PLATFORM (NULL)
71
72 /*
73 * See comments in asm-alpha/elf.h, this is the same thing
74 * on the MIPS.
75 */
76 #define ELF_PLAT_INIT(_r) do { \
77 _r->regs[1] = _r->regs[2] = _r->regs[3] = _r->regs[4] = 0; \
78 _r->regs[5] = _r->regs[6] = _r->regs[7] = _r->regs[8] = 0; \
79 _r->regs[9] = _r->regs[10] = _r->regs[11] = _r->regs[12] = 0; \
80 _r->regs[13] = _r->regs[14] = _r->regs[15] = _r->regs[16] = 0; \
81 _r->regs[17] = _r->regs[18] = _r->regs[19] = _r->regs[20] = 0; \
82 _r->regs[21] = _r->regs[22] = _r->regs[23] = _r->regs[24] = 0; \
83 _r->regs[25] = _r->regs[26] = _r->regs[27] = _r->regs[28] = 0; \
84 _r->regs[30] = _r->regs[31] = 0; \
85 } while (0)
86
87 /* This is the location that an ET_DYN program is loaded if exec'ed. Typical
88 use of this is to invoke "./ld.so someprog" to test out a new version of
89 the loader. We need to make sure that it is out of the way of the program
90 that it will "exec", and that there is sufficient room for the brk. */
91
92 #define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2)
93
94 #ifdef __KERNEL__
95 #define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
96 #endif
97
98 #endif /* __ASM_ELF_H */
99