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