Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
fork
Configure Feed
Select the types of activity you want to include in your feed.
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * S390 version
4 *
5 * Derived from "include/asm-i386/elf.h"
6 */
7
8#ifndef __ASMS390_ELF_H
9#define __ASMS390_ELF_H
10
11/* s390 relocations defined by the ABIs */
12#define R_390_NONE 0 /* No reloc. */
13#define R_390_8 1 /* Direct 8 bit. */
14#define R_390_12 2 /* Direct 12 bit. */
15#define R_390_16 3 /* Direct 16 bit. */
16#define R_390_32 4 /* Direct 32 bit. */
17#define R_390_PC32 5 /* PC relative 32 bit. */
18#define R_390_GOT12 6 /* 12 bit GOT offset. */
19#define R_390_GOT32 7 /* 32 bit GOT offset. */
20#define R_390_PLT32 8 /* 32 bit PC relative PLT address. */
21#define R_390_COPY 9 /* Copy symbol at runtime. */
22#define R_390_GLOB_DAT 10 /* Create GOT entry. */
23#define R_390_JMP_SLOT 11 /* Create PLT entry. */
24#define R_390_RELATIVE 12 /* Adjust by program base. */
25#define R_390_GOTOFF32 13 /* 32 bit offset to GOT. */
26#define R_390_GOTPC 14 /* 32 bit PC rel. offset to GOT. */
27#define R_390_GOT16 15 /* 16 bit GOT offset. */
28#define R_390_PC16 16 /* PC relative 16 bit. */
29#define R_390_PC16DBL 17 /* PC relative 16 bit shifted by 1. */
30#define R_390_PLT16DBL 18 /* 16 bit PC rel. PLT shifted by 1. */
31#define R_390_PC32DBL 19 /* PC relative 32 bit shifted by 1. */
32#define R_390_PLT32DBL 20 /* 32 bit PC rel. PLT shifted by 1. */
33#define R_390_GOTPCDBL 21 /* 32 bit PC rel. GOT shifted by 1. */
34#define R_390_64 22 /* Direct 64 bit. */
35#define R_390_PC64 23 /* PC relative 64 bit. */
36#define R_390_GOT64 24 /* 64 bit GOT offset. */
37#define R_390_PLT64 25 /* 64 bit PC relative PLT address. */
38#define R_390_GOTENT 26 /* 32 bit PC rel. to GOT entry >> 1. */
39#define R_390_GOTOFF16 27 /* 16 bit offset to GOT. */
40#define R_390_GOTOFF64 28 /* 64 bit offset to GOT. */
41#define R_390_GOTPLT12 29 /* 12 bit offset to jump slot. */
42#define R_390_GOTPLT16 30 /* 16 bit offset to jump slot. */
43#define R_390_GOTPLT32 31 /* 32 bit offset to jump slot. */
44#define R_390_GOTPLT64 32 /* 64 bit offset to jump slot. */
45#define R_390_GOTPLTENT 33 /* 32 bit rel. offset to jump slot. */
46#define R_390_PLTOFF16 34 /* 16 bit offset from GOT to PLT. */
47#define R_390_PLTOFF32 35 /* 32 bit offset from GOT to PLT. */
48#define R_390_PLTOFF64 36 /* 16 bit offset from GOT to PLT. */
49#define R_390_TLS_LOAD 37 /* Tag for load insn in TLS code. */
50#define R_390_TLS_GDCALL 38 /* Tag for function call in general
51 dynamic TLS code. */
52#define R_390_TLS_LDCALL 39 /* Tag for function call in local
53 dynamic TLS code. */
54#define R_390_TLS_GD32 40 /* Direct 32 bit for general dynamic
55 thread local data. */
56#define R_390_TLS_GD64 41 /* Direct 64 bit for general dynamic
57 thread local data. */
58#define R_390_TLS_GOTIE12 42 /* 12 bit GOT offset for static TLS
59 block offset. */
60#define R_390_TLS_GOTIE32 43 /* 32 bit GOT offset for static TLS
61 block offset. */
62#define R_390_TLS_GOTIE64 44 /* 64 bit GOT offset for static TLS
63 block offset. */
64#define R_390_TLS_LDM32 45 /* Direct 32 bit for local dynamic
65 thread local data in LD code. */
66#define R_390_TLS_LDM64 46 /* Direct 64 bit for local dynamic
67 thread local data in LD code. */
68#define R_390_TLS_IE32 47 /* 32 bit address of GOT entry for
69 negated static TLS block offset. */
70#define R_390_TLS_IE64 48 /* 64 bit address of GOT entry for
71 negated static TLS block offset. */
72#define R_390_TLS_IEENT 49 /* 32 bit rel. offset to GOT entry for
73 negated static TLS block offset. */
74#define R_390_TLS_LE32 50 /* 32 bit negated offset relative to
75 static TLS block. */
76#define R_390_TLS_LE64 51 /* 64 bit negated offset relative to
77 static TLS block. */
78#define R_390_TLS_LDO32 52 /* 32 bit offset relative to TLS
79 block. */
80#define R_390_TLS_LDO64 53 /* 64 bit offset relative to TLS
81 block. */
82#define R_390_TLS_DTPMOD 54 /* ID of module containing symbol. */
83#define R_390_TLS_DTPOFF 55 /* Offset in TLS block. */
84#define R_390_TLS_TPOFF 56 /* Negate offset in static TLS
85 block. */
86#define R_390_20 57 /* Direct 20 bit. */
87#define R_390_GOT20 58 /* 20 bit GOT offset. */
88#define R_390_GOTPLT20 59 /* 20 bit offset to jump slot. */
89#define R_390_TLS_GOTIE20 60 /* 20 bit GOT offset for static TLS
90 block offset. */
91/* Keep this the last entry. */
92#define R_390_NUM 61
93
94/*
95 * HWCAP flags - for AT_HWCAP
96 *
97 * Bits 32-63 are reserved for use by libc.
98 * Bit 31 is reserved and will be used by libc to determine if a second
99 * argument is passed to IFUNC resolvers. This will be implemented when
100 * there is a need for AT_HWCAP2.
101 */
102enum {
103 HWCAP_NR_ESAN3 = 0,
104 HWCAP_NR_ZARCH = 1,
105 HWCAP_NR_STFLE = 2,
106 HWCAP_NR_MSA = 3,
107 HWCAP_NR_LDISP = 4,
108 HWCAP_NR_EIMM = 5,
109 HWCAP_NR_DFP = 6,
110 HWCAP_NR_HPAGE = 7,
111 HWCAP_NR_ETF3EH = 8,
112 HWCAP_NR_HIGH_GPRS = 9,
113 HWCAP_NR_TE = 10,
114 HWCAP_NR_VXRS = 11,
115 HWCAP_NR_VXRS_BCD = 12,
116 HWCAP_NR_VXRS_EXT = 13,
117 HWCAP_NR_GS = 14,
118 HWCAP_NR_VXRS_EXT2 = 15,
119 HWCAP_NR_VXRS_PDE = 16,
120 HWCAP_NR_SORT = 17,
121 HWCAP_NR_DFLT = 18,
122 HWCAP_NR_VXRS_PDE2 = 19,
123 HWCAP_NR_NNPA = 20,
124 HWCAP_NR_PCI_MIO = 21,
125 HWCAP_NR_SIE = 22,
126 HWCAP_NR_MAX
127};
128
129/* Bits present in AT_HWCAP. */
130#define HWCAP_ESAN3 BIT(HWCAP_NR_ESAN3)
131#define HWCAP_ZARCH BIT(HWCAP_NR_ZARCH)
132#define HWCAP_STFLE BIT(HWCAP_NR_STFLE)
133#define HWCAP_MSA BIT(HWCAP_NR_MSA)
134#define HWCAP_LDISP BIT(HWCAP_NR_LDISP)
135#define HWCAP_EIMM BIT(HWCAP_NR_EIMM)
136#define HWCAP_DFP BIT(HWCAP_NR_DFP)
137#define HWCAP_HPAGE BIT(HWCAP_NR_HPAGE)
138#define HWCAP_ETF3EH BIT(HWCAP_NR_ETF3EH)
139#define HWCAP_HIGH_GPRS BIT(HWCAP_NR_HIGH_GPRS)
140#define HWCAP_TE BIT(HWCAP_NR_TE)
141#define HWCAP_VXRS BIT(HWCAP_NR_VXRS)
142#define HWCAP_VXRS_BCD BIT(HWCAP_NR_VXRS_BCD)
143#define HWCAP_VXRS_EXT BIT(HWCAP_NR_VXRS_EXT)
144#define HWCAP_GS BIT(HWCAP_NR_GS)
145#define HWCAP_VXRS_EXT2 BIT(HWCAP_NR_VXRS_EXT2)
146#define HWCAP_VXRS_PDE BIT(HWCAP_NR_VXRS_PDE)
147#define HWCAP_SORT BIT(HWCAP_NR_SORT)
148#define HWCAP_DFLT BIT(HWCAP_NR_DFLT)
149#define HWCAP_VXRS_PDE2 BIT(HWCAP_NR_VXRS_PDE2)
150#define HWCAP_NNPA BIT(HWCAP_NR_NNPA)
151#define HWCAP_PCI_MIO BIT(HWCAP_NR_PCI_MIO)
152#define HWCAP_SIE BIT(HWCAP_NR_SIE)
153
154/*
155 * These are used to set parameters in the core dumps.
156 */
157#define ELF_CLASS ELFCLASS64
158#define ELF_DATA ELFDATA2MSB
159#define ELF_ARCH EM_S390
160
161/*
162 * ELF register definitions..
163 */
164
165#include <asm/ptrace.h>
166#include <asm/syscall.h>
167#include <asm/user.h>
168
169typedef s390_fp_regs elf_fpregset_t;
170typedef s390_regs elf_gregset_t;
171
172#include <linux/sched/mm.h> /* for task_struct */
173#include <asm/mmu_context.h>
174
175/*
176 * This is used to ensure we don't load something for the wrong architecture.
177 */
178#define elf_check_arch(x) \
179 (((x)->e_machine == EM_S390 || (x)->e_machine == EM_S390_OLD) \
180 && (x)->e_ident[EI_CLASS] == ELF_CLASS)
181
182/* For SVR4/S390 the function pointer to be registered with `atexit` is
183 passed in R14. */
184#define ELF_PLAT_INIT(_r, load_addr) \
185 do { \
186 _r->gprs[14] = 0; \
187 } while (0)
188
189#define CORE_DUMP_USE_REGSET
190#define ELF_EXEC_PAGESIZE PAGE_SIZE
191
192/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
193 use of this is to invoke "./ld.so someprog" to test out a new version of
194 the loader. We need to make sure that it is out of the way of the program
195 that it will "exec", and that there is sufficient room for the brk. 64-bit
196 tasks are aligned to 4GB. */
197#define ELF_ET_DYN_BASE ((STACK_TOP / 3 * 2) & ~((1UL << 32) - 1))
198
199/* This yields a mask that user programs can use to figure out what
200 instruction set this CPU supports. */
201
202extern unsigned long elf_hwcap;
203#define ELF_HWCAP (elf_hwcap)
204
205/* This yields a string that ld.so will use to load implementation
206 specific libraries for optimization. This is more specific in
207 intent than poking at uname or /proc/cpuinfo.
208
209 For the moment, we have only optimizations for the Intel generations,
210 but that could change... */
211
212#define ELF_PLATFORM_SIZE 8
213extern char elf_platform[];
214#define ELF_PLATFORM (elf_platform)
215
216#define SET_PERSONALITY(ex) \
217do { \
218 set_personality(PER_LINUX | \
219 (current->personality & (~PER_MASK))); \
220} while (0)
221
222/*
223 * Cache aliasing on the latest machines calls for a mapping granularity
224 * of 512KB for the anonymous mapping base. Use a 512KB alignment and a
225 * randomization of up to 1GB.
226 * For the additional randomization of the program break use 32MB.
227 */
228#define BRK_RND_MASK (0x1fffUL)
229#define MMAP_RND_MASK (0x3ff80UL)
230#define MMAP_ALIGN_MASK (0x7fUL)
231#define STACK_RND_MASK MMAP_RND_MASK
232
233/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
234#define ARCH_DLINFO \
235do { \
236 NEW_AUX_ENT(AT_SYSINFO_EHDR, \
237 (unsigned long)current->mm->context.vdso_base); \
238} while (0)
239
240struct linux_binprm;
241
242#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
243int arch_setup_additional_pages(struct linux_binprm *, int);
244
245#endif