Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* elf.h: FR-V ELF definitions |
| 2 | * |
| 3 | * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. |
| 4 | * Written by David Howells (dhowells@redhat.com) |
| 5 | * - Derived from include/asm-m68knommu/elf.h |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU General Public License |
| 9 | * as published by the Free Software Foundation; either version |
| 10 | * 2 of the License, or (at your option) any later version. |
| 11 | */ |
| 12 | #ifndef __ASM_ELF_H |
| 13 | #define __ASM_ELF_H |
| 14 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | #include <asm/ptrace.h> |
| 16 | #include <asm/user.h> |
| 17 | |
| 18 | struct elf32_hdr; |
| 19 | |
| 20 | /* |
| 21 | * ELF header e_flags defines. |
| 22 | */ |
| 23 | #define EF_FRV_GPR_MASK 0x00000003 /* mask for # of gprs */ |
| 24 | #define EF_FRV_GPR32 0x00000001 /* Only uses GR on 32-register */ |
| 25 | #define EF_FRV_GPR64 0x00000002 /* Only uses GR on 64-register */ |
| 26 | #define EF_FRV_FPR_MASK 0x0000000c /* mask for # of fprs */ |
| 27 | #define EF_FRV_FPR32 0x00000004 /* Only uses FR on 32-register */ |
| 28 | #define EF_FRV_FPR64 0x00000008 /* Only uses FR on 64-register */ |
| 29 | #define EF_FRV_FPR_NONE 0x0000000C /* Uses software floating-point */ |
| 30 | #define EF_FRV_DWORD_MASK 0x00000030 /* mask for dword support */ |
| 31 | #define EF_FRV_DWORD_YES 0x00000010 /* Assumes stack aligned to 8-byte boundaries. */ |
| 32 | #define EF_FRV_DWORD_NO 0x00000020 /* Assumes stack aligned to 4-byte boundaries. */ |
| 33 | #define EF_FRV_DOUBLE 0x00000040 /* Uses double instructions. */ |
| 34 | #define EF_FRV_MEDIA 0x00000080 /* Uses media instructions. */ |
| 35 | #define EF_FRV_PIC 0x00000100 /* Uses position independent code. */ |
| 36 | #define EF_FRV_NON_PIC_RELOCS 0x00000200 /* Does not use position Independent code. */ |
| 37 | #define EF_FRV_MULADD 0x00000400 /* -mmuladd */ |
| 38 | #define EF_FRV_BIGPIC 0x00000800 /* -fPIC */ |
| 39 | #define EF_FRV_LIBPIC 0x00001000 /* -mlibrary-pic */ |
| 40 | #define EF_FRV_G0 0x00002000 /* -G 0, no small data ptr */ |
| 41 | #define EF_FRV_NOPACK 0x00004000 /* -mnopack */ |
| 42 | #define EF_FRV_FDPIC 0x00008000 /* -mfdpic */ |
| 43 | #define EF_FRV_CPU_MASK 0xff000000 /* specific cpu bits */ |
| 44 | #define EF_FRV_CPU_GENERIC 0x00000000 /* Set CPU type is FR-V */ |
| 45 | #define EF_FRV_CPU_FR500 0x01000000 /* Set CPU type is FR500 */ |
| 46 | #define EF_FRV_CPU_FR300 0x02000000 /* Set CPU type is FR300 */ |
| 47 | #define EF_FRV_CPU_SIMPLE 0x03000000 /* SIMPLE */ |
| 48 | #define EF_FRV_CPU_TOMCAT 0x04000000 /* Tomcat, FR500 prototype */ |
| 49 | #define EF_FRV_CPU_FR400 0x05000000 /* Set CPU type is FR400 */ |
| 50 | #define EF_FRV_CPU_FR550 0x06000000 /* Set CPU type is FR550 */ |
| 51 | #define EF_FRV_CPU_FR405 0x07000000 /* Set CPU type is FR405 */ |
| 52 | #define EF_FRV_CPU_FR450 0x08000000 /* Set CPU type is FR450 */ |
| 53 | |
| 54 | /* |
| 55 | * FR-V ELF relocation types |
| 56 | */ |
| 57 | |
| 58 | |
| 59 | /* |
| 60 | * ELF register definitions.. |
| 61 | */ |
| 62 | typedef unsigned long elf_greg_t; |
| 63 | |
| 64 | #define ELF_NGREG (sizeof(struct pt_regs) / sizeof(elf_greg_t)) |
| 65 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; |
| 66 | |
David Howells | 6d8c4e3 | 2006-07-10 04:44:55 -0700 | [diff] [blame] | 67 | typedef struct user_fpmedia_regs elf_fpregset_t; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | |
| 69 | /* |
| 70 | * This is used to ensure we don't load something for the wrong architecture. |
| 71 | */ |
| 72 | extern int elf_check_arch(const struct elf32_hdr *hdr); |
| 73 | |
| 74 | #define elf_check_fdpic(x) ((x)->e_flags & EF_FRV_FDPIC && !((x)->e_flags & EF_FRV_NON_PIC_RELOCS)) |
| 75 | #define elf_check_const_displacement(x) ((x)->e_flags & EF_FRV_PIC) |
| 76 | |
| 77 | /* |
| 78 | * These are used to set parameters in the core dumps. |
| 79 | */ |
| 80 | #define ELF_CLASS ELFCLASS32 |
| 81 | #define ELF_DATA ELFDATA2MSB |
| 82 | #define ELF_ARCH EM_FRV |
| 83 | |
| 84 | #define ELF_PLAT_INIT(_r) \ |
| 85 | do { \ |
| 86 | __kernel_frame0_ptr->gr16 = 0; \ |
| 87 | __kernel_frame0_ptr->gr17 = 0; \ |
| 88 | __kernel_frame0_ptr->gr18 = 0; \ |
| 89 | __kernel_frame0_ptr->gr19 = 0; \ |
| 90 | __kernel_frame0_ptr->gr20 = 0; \ |
| 91 | __kernel_frame0_ptr->gr21 = 0; \ |
| 92 | __kernel_frame0_ptr->gr22 = 0; \ |
| 93 | __kernel_frame0_ptr->gr23 = 0; \ |
| 94 | __kernel_frame0_ptr->gr24 = 0; \ |
| 95 | __kernel_frame0_ptr->gr25 = 0; \ |
| 96 | __kernel_frame0_ptr->gr26 = 0; \ |
| 97 | __kernel_frame0_ptr->gr27 = 0; \ |
| 98 | __kernel_frame0_ptr->gr29 = 0; \ |
| 99 | } while(0) |
| 100 | |
| 101 | #define ELF_FDPIC_PLAT_INIT(_regs, _exec_map_addr, _interp_map_addr, _dynamic_addr) \ |
| 102 | do { \ |
| 103 | __kernel_frame0_ptr->gr16 = _exec_map_addr; \ |
| 104 | __kernel_frame0_ptr->gr17 = _interp_map_addr; \ |
| 105 | __kernel_frame0_ptr->gr18 = _dynamic_addr; \ |
| 106 | __kernel_frame0_ptr->gr19 = 0; \ |
| 107 | __kernel_frame0_ptr->gr20 = 0; \ |
| 108 | __kernel_frame0_ptr->gr21 = 0; \ |
| 109 | __kernel_frame0_ptr->gr22 = 0; \ |
| 110 | __kernel_frame0_ptr->gr23 = 0; \ |
| 111 | __kernel_frame0_ptr->gr24 = 0; \ |
| 112 | __kernel_frame0_ptr->gr25 = 0; \ |
| 113 | __kernel_frame0_ptr->gr26 = 0; \ |
| 114 | __kernel_frame0_ptr->gr27 = 0; \ |
| 115 | __kernel_frame0_ptr->gr29 = 0; \ |
| 116 | } while(0) |
| 117 | |
| 118 | #define USE_ELF_CORE_DUMP |
David Howells | 6d8c4e3 | 2006-07-10 04:44:55 -0700 | [diff] [blame] | 119 | #define ELF_FDPIC_CORE_EFLAGS EF_FRV_FDPIC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | #define ELF_EXEC_PAGESIZE 16384 |
| 121 | |
| 122 | /* This is the location that an ET_DYN program is loaded if exec'ed. Typical |
| 123 | use of this is to invoke "./ld.so someprog" to test out a new version of |
| 124 | the loader. We need to make sure that it is out of the way of the program |
| 125 | that it will "exec", and that there is sufficient room for the brk. */ |
| 126 | |
| 127 | #define ELF_ET_DYN_BASE 0x08000000UL |
| 128 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | /* This yields a mask that user programs can use to figure out what |
| 130 | instruction set this cpu supports. */ |
| 131 | |
| 132 | #define ELF_HWCAP (0) |
| 133 | |
| 134 | /* This yields a string that ld.so will use to load implementation |
| 135 | specific libraries for optimization. This is more specific in |
| 136 | intent than poking at uname or /proc/cpuinfo. */ |
| 137 | |
| 138 | #define ELF_PLATFORM (NULL) |
| 139 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 140 | #define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 141 | |
| 142 | #endif |