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