| 1 |
|
| 2 | #ifndef __ASMPARISC_ELF_H
|
| 3 | #define __ASMPARISC_ELF_H
|
| 4 |
|
| 5 | |
| 6 | * ELF register definitions..
|
| 7 |
|
| 8 |
|
| 9 | #include <linux/types.h>
|
| 10 |
|
| 11 | #define EM_PARISC 15
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 | #define EF_PARISC_TRAPNIL 0x00010000
|
| 18 | #define EF_PARISC_EXT 0x00020000
|
| 19 | #define EF_PARISC_LSB 0x00040000
|
| 20 | #define EF_PARISC_WIDE 0x00080000
|
| 21 | #define EF_PARISC_NO_KABP 0x00100000 |
| 22 | prediction.
|
| 23 | #define EF_PARISC_LAZYSWAP 0x00400000
|
| 24 | #define EF_PARISC_ARCH 0x0000ffff
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 | #define EFA_PARISC_1_0 0x020b
|
| 29 | #define EFA_PARISC_1_1 0x0210
|
| 30 | #define EFA_PARISC_2_0 0x0214
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 | #define SHN_PARISC_ANSI_COMMON 0xff00 |
| 35 | symbols in ANSI C.
|
| 36 | #define SHN_PARISC_HUGE_COMMON 0xff01
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 | #define SHT_PARISC_EXT 0x70000000
|
| 41 | #define SHT_PARISC_UNWIND 0x70000001
|
| 42 | #define SHT_PARISC_DOC 0x70000002
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 | #define SHF_PARISC_SHORT 0x20000000
|
| 47 | #define SHF_PARISC_HUGE 0x40000000
|
| 48 | #define SHF_PARISC_SBP 0x80000000
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 | #define STT_PARISC_MILLICODE 13
|
| 53 |
|
| 54 | #define STT_HP_OPAQUE (STT_LOOS + 0x1)
|
| 55 | #define STT_HP_STUB (STT_LOOS + 0x2)
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 | #define R_PARISC_NONE 0
|
| 60 | #define R_PARISC_DIR32 1
|
| 61 | #define R_PARISC_DIR21L 2
|
| 62 | #define R_PARISC_DIR17R 3
|
| 63 | #define R_PARISC_DIR17F 4
|
| 64 | #define R_PARISC_DIR14R 6
|
| 65 | #define R_PARISC_PCREL32 9
|
| 66 | #define R_PARISC_PCREL21L 10
|
| 67 | #define R_PARISC_PCREL17R 11
|
| 68 | #define R_PARISC_PCREL17F 12
|
| 69 | #define R_PARISC_PCREL14R 14
|
| 70 | #define R_PARISC_DPREL21L 18
|
| 71 | #define R_PARISC_DPREL14R 22
|
| 72 | #define R_PARISC_GPREL21L 26
|
| 73 | #define R_PARISC_GPREL14R 30
|
| 74 | #define R_PARISC_LTOFF21L 34
|
| 75 | #define R_PARISC_LTOFF14R 38
|
| 76 | #define R_PARISC_SECREL32 41
|
| 77 | #define R_PARISC_SEGBASE 48
|
| 78 | #define R_PARISC_SEGREL32 49
|
| 79 | #define R_PARISC_PLTOFF21L 50
|
| 80 | #define R_PARISC_PLTOFF14R 54
|
| 81 | #define R_PARISC_LTOFF_FPTR32 57
|
| 82 | #define R_PARISC_LTOFF_FPTR21L 58
|
| 83 | #define R_PARISC_LTOFF_FPTR14R 62
|
| 84 | #define R_PARISC_FPTR64 64
|
| 85 | #define R_PARISC_PLABEL32 65
|
| 86 | #define R_PARISC_PCREL64 72
|
| 87 | #define R_PARISC_PCREL22F 74
|
| 88 | #define R_PARISC_PCREL14WR 75
|
| 89 | #define R_PARISC_PCREL14DR 76
|
| 90 | #define R_PARISC_PCREL16F 77
|
| 91 | #define R_PARISC_PCREL16WF 78
|
| 92 | #define R_PARISC_PCREL16DF 79
|
| 93 | #define R_PARISC_DIR64 80
|
| 94 | #define R_PARISC_DIR14WR 83
|
| 95 | #define R_PARISC_DIR14DR 84
|
| 96 | #define R_PARISC_DIR16F 85
|
| 97 | #define R_PARISC_DIR16WF 86
|
| 98 | #define R_PARISC_DIR16DF 87
|
| 99 | #define R_PARISC_GPREL64 88
|
| 100 | #define R_PARISC_GPREL14WR 91
|
| 101 | #define R_PARISC_GPREL14DR 92
|
| 102 | #define R_PARISC_GPREL16F 93
|
| 103 | #define R_PARISC_GPREL16WF 94
|
| 104 | #define R_PARISC_GPREL16DF 95
|
| 105 | #define R_PARISC_LTOFF64 96
|
| 106 | #define R_PARISC_LTOFF14WR 99
|
| 107 | #define R_PARISC_LTOFF14DR 100
|
| 108 | #define R_PARISC_LTOFF16F 101
|
| 109 | #define R_PARISC_LTOFF16WF 102
|
| 110 | #define R_PARISC_LTOFF16DF 103
|
| 111 | #define R_PARISC_SECREL64 104
|
| 112 | #define R_PARISC_SEGREL64 112
|
| 113 | #define R_PARISC_PLTOFF14WR 115
|
| 114 | #define R_PARISC_PLTOFF14DR 116
|
| 115 | #define R_PARISC_PLTOFF16F 117
|
| 116 | #define R_PARISC_PLTOFF16WF 118
|
| 117 | #define R_PARISC_PLTOFF16DF 119
|
| 118 | #define R_PARISC_LTOFF_FPTR64 120
|
| 119 | #define R_PARISC_LTOFF_FPTR14WR 123
|
| 120 | #define R_PARISC_LTOFF_FPTR14DR 124
|
| 121 | #define R_PARISC_LTOFF_FPTR16F 125
|
| 122 | #define R_PARISC_LTOFF_FPTR16WF 126
|
| 123 | #define R_PARISC_LTOFF_FPTR16DF 127
|
| 124 | #define R_PARISC_LORESERVE 128
|
| 125 | #define R_PARISC_COPY 128
|
| 126 | #define R_PARISC_IPLT 129
|
| 127 | #define R_PARISC_EPLT 130
|
| 128 | #define R_PARISC_TPREL32 153
|
| 129 | #define R_PARISC_TPREL21L 154
|
| 130 | #define R_PARISC_TPREL14R 158
|
| 131 | #define R_PARISC_LTOFF_TP21L 162
|
| 132 | #define R_PARISC_LTOFF_TP14R 166
|
| 133 | #define R_PARISC_LTOFF_TP14F 167
|
| 134 | #define R_PARISC_TPREL64 216
|
| 135 | #define R_PARISC_TPREL14WR 219
|
| 136 | #define R_PARISC_TPREL14DR 220
|
| 137 | #define R_PARISC_TPREL16F 221
|
| 138 | #define R_PARISC_TPREL16WF 222
|
| 139 | #define R_PARISC_TPREL16DF 223
|
| 140 | #define R_PARISC_LTOFF_TP64 224
|
| 141 | #define R_PARISC_LTOFF_TP14WR 227
|
| 142 | #define R_PARISC_LTOFF_TP14DR 228
|
| 143 | #define R_PARISC_LTOFF_TP16F 229
|
| 144 | #define R_PARISC_LTOFF_TP16WF 230
|
| 145 | #define R_PARISC_LTOFF_TP16DF 231
|
| 146 | #define R_PARISC_HIRESERVE 255
|
| 147 |
|
| 148 | #define PA_PLABEL_FDESC 0x02 |
| 149 | * a function descriptor, not
|
| 150 | * an address
|
| 151 |
|
| 152 | |
| 153 | *
|
| 154 | * addr: the absolute address of the function
|
| 155 | * gp: either the data pointer (r27) for non-PIC code or
|
| 156 | * the PLT pointer (r19) for PIC code
|
| 157 |
|
| 158 |
|
| 159 | typedef struct elf32_fdesc {
|
| 160 | __u32 addr;
|
| 161 | __u32 gp;
|
| 162 | } Elf32_Fdesc;
|
| 163 |
|
| 164 |
|
| 165 | typedef struct elf64_fdesc {
|
| 166 | __u64 dummy[2];
|
| 167 | __u64 addr;
|
| 168 | __u64 gp;
|
| 169 | } Elf64_Fdesc;
|
| 170 |
|
| 171 | #ifdef CONFIG_64BIT
|
| 172 | #define Elf_Fdesc Elf64_Fdesc
|
| 173 | #else
|
| 174 | #define Elf_Fdesc Elf32_Fdesc
|
| 175 | #endif
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 | #define PT_HP_TLS (PT_LOOS + 0x0)
|
| 180 | #define PT_HP_CORE_NONE (PT_LOOS + 0x1)
|
| 181 | #define PT_HP_CORE_VERSION (PT_LOOS + 0x2)
|
| 182 | #define PT_HP_CORE_KERNEL (PT_LOOS + 0x3)
|
| 183 | #define PT_HP_CORE_COMM (PT_LOOS + 0x4)
|
| 184 | #define PT_HP_CORE_PROC (PT_LOOS + 0x5)
|
| 185 | #define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6)
|
| 186 | #define PT_HP_CORE_STACK (PT_LOOS + 0x7)
|
| 187 | #define PT_HP_CORE_SHM (PT_LOOS + 0x8)
|
| 188 | #define PT_HP_CORE_MMF (PT_LOOS + 0x9)
|
| 189 | #define PT_HP_PARALLEL (PT_LOOS + 0x10)
|
| 190 | #define PT_HP_FASTBIND (PT_LOOS + 0x11)
|
| 191 | #define PT_HP_OPT_ANNOT (PT_LOOS + 0x12)
|
| 192 | #define PT_HP_HSL_ANNOT (PT_LOOS + 0x13)
|
| 193 | #define PT_HP_STACK (PT_LOOS + 0x14)
|
| 194 |
|
| 195 | #define PT_PARISC_ARCHEXT 0x70000000
|
| 196 | #define PT_PARISC_UNWIND 0x70000001
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 | #define PF_PARISC_SBP 0x08000000
|
| 201 |
|
| 202 | #define PF_HP_PAGE_SIZE 0x00100000
|
| 203 | #define PF_HP_FAR_SHARED 0x00200000
|
| 204 | #define PF_HP_NEAR_SHARED 0x00400000
|
| 205 | #define PF_HP_CODE 0x01000000
|
| 206 | #define PF_HP_MODIFY 0x02000000
|
| 207 | #define PF_HP_LAZYSWAP 0x04000000
|
| 208 | #define PF_HP_SBP 0x08000000
|
| 209 |
|
| 210 | |
| 211 | * This yields a string that ld.so will use to load implementation
|
| 212 | * specific libraries for optimization. This is more specific in
|
| 213 | * intent than poking at uname or /proc/cpuinfo.
|
| 214 |
|
| 215 |
|
| 216 | #define ELF_PLATFORM ("PARISC")
|
| 217 |
|
| 218 | |
| 219 | * The following definitions are those for 32-bit ELF binaries on a 32-bit
|
| 220 | * kernel and for 64-bit binaries on a 64-bit kernel. To run 32-bit binaries
|
| 221 | * on a 64-bit kernel, fs/compat_binfmt_elf.c defines ELF_CLASS and then
|
| 222 | * #includes binfmt_elf.c, which then includes this file.
|
| 223 |
|
| 224 | #ifndef ELF_CLASS
|
| 225 |
|
| 226 | #ifdef CONFIG_64BIT
|
| 227 | #define ELF_CLASS ELFCLASS64
|
| 228 | #else
|
| 229 | #define ELF_CLASS ELFCLASS32
|
| 230 | #endif
|
| 231 |
|
| 232 | typedef unsigned long elf_greg_t;
|
| 233 |
|
| 234 | #define SET_PERSONALITY(ex) \
|
| 235 | ({ \
|
| 236 | set_personality((current->personality & ~PER_MASK) | PER_LINUX); \
|
| 237 | clear_thread_flag(TIF_32BIT); \
|
| 238 | current->thread.map_base = DEFAULT_MAP_BASE; \
|
| 239 | current->thread.task_size = DEFAULT_TASK_SIZE; \
|
| 240 | })
|
| 241 |
|
| 242 | #endif
|
| 243 |
|
| 244 | #define COMPAT_SET_PERSONALITY(ex) \
|
| 245 | ({ \
|
| 246 | if ((ex).e_ident[EI_CLASS] == ELFCLASS32) { \
|
| 247 | set_thread_flag(TIF_32BIT); \
|
| 248 | current->thread.map_base = DEFAULT_MAP_BASE32; \
|
| 249 | current->thread.task_size = DEFAULT_TASK_SIZE32; \
|
| 250 | } else clear_thread_flag(TIF_32BIT); \
|
| 251 | })
|
| 252 |
|
| 253 | |
| 254 | * Fill in general registers in a core dump. This saves pretty
|
| 255 | * much the same registers as hp-ux, although in a different order.
|
| 256 | * Registers marked # below are not currently saved in pt_regs, so
|
| 257 | * we use their current values here.
|
| 258 | *
|
| 259 | * gr0..gr31
|
| 260 | * sr0..sr7
|
| 261 | * iaoq0..iaoq1
|
| 262 | * iasq0..iasq1
|
| 263 | * cr11 (sar)
|
| 264 | * cr19 (iir)
|
| 265 | * cr20 (isr)
|
| 266 | * cr21 (ior)
|
| 267 | * # cr22 (ipsw)
|
| 268 | * # cr0 (recovery counter)
|
| 269 | * # cr24..cr31 (temporary registers)
|
| 270 | * # cr8,9,12,13 (protection IDs)
|
| 271 | * # cr10 (scr/ccr)
|
| 272 | * # cr15 (ext int enable mask)
|
| 273 | *
|
| 274 |
|
| 275 |
|
| 276 | #define ELF_CORE_COPY_REGS(dst, pt) \
|
| 277 | memset(dst, 0, sizeof(dst)); \
|
| 278 | { int i; \
|
| 279 | for (i = 0; i < 32; i++) dst[i] = pt->gr[i]; \
|
| 280 | for (i = 0; i < 8; i++) dst[32 + i] = pt->sr[i]; \
|
| 281 | } \
|
| 282 | dst[40] = pt->iaoq[0]; dst[41] = pt->iaoq[1]; \
|
| 283 | dst[42] = pt->iasq[0]; dst[43] = pt->iasq[1]; \
|
| 284 | dst[44] = pt->sar; dst[45] = pt->iir; \
|
| 285 | dst[46] = pt->isr; dst[47] = pt->ior; \
|
| 286 | dst[48] = mfctl(22); dst[49] = mfctl(0); \
|
| 287 | dst[50] = mfctl(24); dst[51] = mfctl(25); \
|
| 288 | dst[52] = mfctl(26); dst[53] = mfctl(27); \
|
| 289 | dst[54] = mfctl(28); dst[55] = mfctl(29); \
|
| 290 | dst[56] = mfctl(30); dst[57] = mfctl(31); \
|
| 291 | dst[58] = mfctl( 8); dst[59] = mfctl( 9); \
|
| 292 | dst[60] = mfctl(12); dst[61] = mfctl(13); \
|
| 293 | dst[62] = mfctl(10); dst[63] = mfctl(15);
|
| 294 |
|
| 295 | #define CORE_DUMP_USE_REGSET
|
| 296 |
|
| 297 | #define ELF_NGREG 80 |
| 298 | for expansion.
|
| 299 | typedef elf_greg_t elf_gregset_t[ELF_NGREG];
|
| 300 |
|
| 301 | #define ELF_NFPREG 32
|
| 302 | typedef double elf_fpreg_t;
|
| 303 | typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
|
| 304 |
|
| 305 | struct task_struct;
|
| 306 |
|
| 307 | struct pt_regs;
|
| 308 |
|
| 309 |
|
| 310 | #define elf_check_arch(x) \
|
| 311 | ((x)->e_machine == EM_PARISC && (x)->e_ident[EI_CLASS] == ELF_CLASS)
|
| 312 | #define compat_elf_check_arch(x) \
|
| 313 | ((x)->e_machine == EM_PARISC && (x)->e_ident[EI_CLASS] == ELFCLASS32)
|
| 314 |
|
| 315 | |
| 316 | * These are used to set parameters in the core dumps.
|
| 317 |
|
| 318 | #define ELF_DATA ELFDATA2MSB
|
| 319 | #define ELF_ARCH EM_PARISC
|
| 320 | #define ELF_OSABI ELFOSABI_LINUX
|
| 321 |
|
| 322 | |
| 323 | registered using atexit. This provides a means for the dynamic
|
| 324 | linker to call DT_FINI functions for shared libraries that have
|
| 325 | been loaded before the code runs.
|
| 326 |
|
| 327 | So that we can use the same startup file with static executables,
|
| 328 | we start programs with a value of 0 to indicate that there is no
|
| 329 | such function.
|
| 330 | #define ELF_PLAT_INIT(_r, load_addr) _r->gr[23] = 0
|
| 331 |
|
| 332 | #define ELF_EXEC_PAGESIZE 4096
|
| 333 |
|
| 334 | |
| 335 | use of this is to invoke "./ld.so someprog" to test out a new version of
|
| 336 | the loader. We need to make sure that it is out of the way of the program
|
| 337 | that it will "exec", and that there is sufficient room for the brk.
|
| 338 |
|
| 339 | (2 * TASK_SIZE / 3) turns into something undefined when run through a
|
| 340 | 32 bit preprocessor and in some cases results in the kernel trying to map
|
| 341 | ld.so to the kernel virtual base. Use a sane value instead. /Jes
|
| 342 |
|
| 343 |
|
| 344 | #define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE + 0x01000000)
|
| 345 |
|
| 346 | |
| 347 | instruction set this CPU supports. This could be done in user space,
|
| 348 | but it's not easy, and we've already done it here.
|
| 349 |
|
| 350 | #define ELF_HWCAP 0
|
| 351 |
|
| 352 | #define STACK_RND_MASK 0x7ff
|
| 353 |
|
| 354 | #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
|
| 355 | struct linux_binprm;
|
| 356 | extern int arch_setup_additional_pages(struct linux_binprm *bprm,
|
| 357 | int executable_stack);
|
| 358 | #define VDSO_AUX_ENT(a, b) NEW_AUX_ENT(a, b)
|
| 359 | #define VDSO_CURRENT_BASE current->mm->context.vdso_base
|
| 360 |
|
| 361 | #define ARCH_DLINFO \
|
| 362 | do { \
|
| 363 | if (VDSO_CURRENT_BASE) { \
|
| 364 | NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_CURRENT_BASE);\
|
| 365 | } \
|
| 366 | } while (0)
|
| 367 |
|
| 368 | #endif
|