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