elf.h (498495dba268b20e8eadd7fe93c140c68b6cc9d2) | elf.h (71d577db01a5177c7807a2f3d3df9bab9d21c500) |
---|---|
1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef __ASMPARISC_ELF_H 3#define __ASMPARISC_ELF_H 4 5/* 6 * ELF register definitions.. 7 */ 8 | 1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef __ASMPARISC_ELF_H 3#define __ASMPARISC_ELF_H 4 5/* 6 * ELF register definitions.. 7 */ 8 |
9#include <asm/ptrace.h> | 9#include <linux/types.h> |
10 11#define EM_PARISC 15 12 13/* HPPA specific definitions. */ 14 15/* Legal values for e_flags field of Elf32_Ehdr. */ 16 17#define EF_PARISC_TRAPNIL 0x00010000 /* Trap nil pointer dereference. */ --- 146 unchanged lines hidden (view full) --- 164/* Format for the Elf64 Function descriptor */ 165typedef struct elf64_fdesc { 166 __u64 dummy[2]; /* FIXME: nothing uses these, why waste 167 * the space */ 168 __u64 addr; 169 __u64 gp; 170} Elf64_Fdesc; 171 | 10 11#define EM_PARISC 15 12 13/* HPPA specific definitions. */ 14 15/* Legal values for e_flags field of Elf32_Ehdr. */ 16 17#define EF_PARISC_TRAPNIL 0x00010000 /* Trap nil pointer dereference. */ --- 146 unchanged lines hidden (view full) --- 164/* Format for the Elf64 Function descriptor */ 165typedef struct elf64_fdesc { 166 __u64 dummy[2]; /* FIXME: nothing uses these, why waste 167 * the space */ 168 __u64 addr; 169 __u64 gp; 170} Elf64_Fdesc; 171 |
172#ifdef __KERNEL__ 173 | |
174#ifdef CONFIG_64BIT 175#define Elf_Fdesc Elf64_Fdesc 176#else 177#define Elf_Fdesc Elf32_Fdesc 178#endif /*CONFIG_64BIT*/ 179 | 172#ifdef CONFIG_64BIT 173#define Elf_Fdesc Elf64_Fdesc 174#else 175#define Elf_Fdesc Elf32_Fdesc 176#endif /*CONFIG_64BIT*/ 177 |
180#endif /*__KERNEL__*/ 181 | |
182/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */ 183 184#define PT_HP_TLS (PT_LOOS + 0x0) 185#define PT_HP_CORE_NONE (PT_LOOS + 0x1) 186#define PT_HP_CORE_VERSION (PT_LOOS + 0x2) 187#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3) 188#define PT_HP_CORE_COMM (PT_LOOS + 0x4) 189#define PT_HP_CORE_PROC (PT_LOOS + 0x5) --- 18 unchanged lines hidden (view full) --- 208#define PF_HP_FAR_SHARED 0x00200000 209#define PF_HP_NEAR_SHARED 0x00400000 210#define PF_HP_CODE 0x01000000 211#define PF_HP_MODIFY 0x02000000 212#define PF_HP_LAZYSWAP 0x04000000 213#define PF_HP_SBP 0x08000000 214 215/* | 178/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */ 179 180#define PT_HP_TLS (PT_LOOS + 0x0) 181#define PT_HP_CORE_NONE (PT_LOOS + 0x1) 182#define PT_HP_CORE_VERSION (PT_LOOS + 0x2) 183#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3) 184#define PT_HP_CORE_COMM (PT_LOOS + 0x4) 185#define PT_HP_CORE_PROC (PT_LOOS + 0x5) --- 18 unchanged lines hidden (view full) --- 204#define PF_HP_FAR_SHARED 0x00200000 205#define PF_HP_NEAR_SHARED 0x00400000 206#define PF_HP_CODE 0x01000000 207#define PF_HP_MODIFY 0x02000000 208#define PF_HP_LAZYSWAP 0x04000000 209#define PF_HP_SBP 0x08000000 210 211/* |
212 * This yields a string that ld.so will use to load implementation 213 * specific libraries for optimization. This is more specific in 214 * intent than poking at uname or /proc/cpuinfo. 215 */ 216 217#define ELF_PLATFORM ("PARISC") 218 219/* |
|
216 * The following definitions are those for 32-bit ELF binaries on a 32-bit 217 * kernel and for 64-bit binaries on a 64-bit kernel. To run 32-bit binaries | 220 * The following definitions are those for 32-bit ELF binaries on a 32-bit 221 * kernel and for 64-bit binaries on a 64-bit kernel. To run 32-bit binaries |
218 * on a 64-bit kernel, arch/parisc/kernel/binfmt_elf32.c defines these 219 * macros appropriately and then #includes binfmt_elf.c, which then includes 220 * this file. | 222 * on a 64-bit kernel, fs/compat_binfmt_elf.c defines ELF_CLASS and then 223 * #includes binfmt_elf.c, which then includes this file. |
221 */ 222#ifndef ELF_CLASS 223 | 224 */ 225#ifndef ELF_CLASS 226 |
224/* 225 * This is used to ensure we don't load something for the wrong architecture. 226 * 227 * Note that this header file is used by default in fs/binfmt_elf.c. So 228 * the following macros are for the default case. However, for the 64 229 * bit kernel we also support 32 bit parisc binaries. To do that 230 * arch/parisc/kernel/binfmt_elf32.c defines its own set of these 231 * macros, and then it includes fs/binfmt_elf.c to provide an alternate 232 * elf binary handler for 32 bit binaries (on the 64 bit kernel). 233 */ | |
234#ifdef CONFIG_64BIT | 227#ifdef CONFIG_64BIT |
235#define ELF_CLASS ELFCLASS64 | 228#define ELF_CLASS ELFCLASS64 |
236#else 237#define ELF_CLASS ELFCLASS32 238#endif 239 240typedef unsigned long elf_greg_t; 241 | 229#else 230#define ELF_CLASS ELFCLASS32 231#endif 232 233typedef unsigned long elf_greg_t; 234 |
242/* 243 * This yields a string that ld.so will use to load implementation 244 * specific libraries for optimization. This is more specific in 245 * intent than poking at uname or /proc/cpuinfo. 246 */ 247 248#define ELF_PLATFORM ("PARISC\0") 249 | |
250#define SET_PERSONALITY(ex) \ | 235#define SET_PERSONALITY(ex) \ |
236({ \ |
|
251 set_personality((current->personality & ~PER_MASK) | PER_LINUX); \ 252 current->thread.map_base = DEFAULT_MAP_BASE; \ | 237 set_personality((current->personality & ~PER_MASK) | PER_LINUX); \ 238 current->thread.map_base = DEFAULT_MAP_BASE; \ |
253 current->thread.task_size = DEFAULT_TASK_SIZE \ | 239 current->thread.task_size = DEFAULT_TASK_SIZE; \ 240 }) |
254 | 241 |
242#endif /* ! ELF_CLASS */ 243 244#define COMPAT_SET_PERSONALITY(ex) \ 245({ \ 246 set_thread_flag(TIF_32BIT); \ 247 current->thread.map_base = DEFAULT_MAP_BASE32; \ 248 current->thread.task_size = DEFAULT_TASK_SIZE32; \ 249 }) 250 |
|
255/* 256 * Fill in general registers in a core dump. This saves pretty 257 * much the same registers as hp-ux, although in a different order. 258 * Registers marked # below are not currently saved in pt_regs, so 259 * we use their current values here. 260 * 261 * gr0..gr31 262 * sr0..sr7 --- 9 unchanged lines hidden (view full) --- 272 * # cr8,9,12,13 (protection IDs) 273 * # cr10 (scr/ccr) 274 * # cr15 (ext int enable mask) 275 * 276 */ 277 278#define ELF_CORE_COPY_REGS(dst, pt) \ 279 memset(dst, 0, sizeof(dst)); /* don't leak any "random" bits */ \ | 251/* 252 * Fill in general registers in a core dump. This saves pretty 253 * much the same registers as hp-ux, although in a different order. 254 * Registers marked # below are not currently saved in pt_regs, so 255 * we use their current values here. 256 * 257 * gr0..gr31 258 * sr0..sr7 --- 9 unchanged lines hidden (view full) --- 268 * # cr8,9,12,13 (protection IDs) 269 * # cr10 (scr/ccr) 270 * # cr15 (ext int enable mask) 271 * 272 */ 273 274#define ELF_CORE_COPY_REGS(dst, pt) \ 275 memset(dst, 0, sizeof(dst)); /* don't leak any "random" bits */ \ |
280 memcpy(dst + 0, pt->gr, 32 * sizeof(elf_greg_t)); \ 281 memcpy(dst + 32, pt->sr, 8 * sizeof(elf_greg_t)); \ 282 memcpy(dst + 40, pt->iaoq, 2 * sizeof(elf_greg_t)); \ 283 memcpy(dst + 42, pt->iasq, 2 * sizeof(elf_greg_t)); \ | 276 { int i; \ 277 for (i = 0; i < 32; i++) dst[i] = pt->gr[i]; \ 278 for (i = 0; i < 8; i++) dst[32 + i] = pt->sr[i]; \ 279 } \ 280 dst[40] = pt->iaoq[0]; dst[41] = pt->iaoq[1]; \ 281 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 | 282 dst[44] = pt->sar; dst[45] = pt->iir; \ 283 dst[46] = pt->isr; dst[47] = pt->ior; \ 284 dst[48] = mfctl(22); dst[49] = mfctl(0); \ 285 dst[50] = mfctl(24); dst[51] = mfctl(25); \ 286 dst[52] = mfctl(26); dst[53] = mfctl(27); \ 287 dst[54] = mfctl(28); dst[55] = mfctl(29); \ 288 dst[56] = mfctl(30); dst[57] = mfctl(31); \ 289 dst[58] = mfctl( 8); dst[59] = mfctl( 9); \ 290 dst[60] = mfctl(12); dst[61] = mfctl(13); \ 291 dst[62] = mfctl(10); dst[63] = mfctl(15); 292 |
295#endif /* ! ELF_CLASS */ | 293#define CORE_DUMP_USE_REGSET |
296 297#define ELF_NGREG 80 /* We only need 64 at present, but leave space 298 for expansion. */ 299typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 300 301#define ELF_NFPREG 32 302typedef double elf_fpreg_t; 303typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; 304 305struct task_struct; 306 307extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *); 308#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs) 309 310struct pt_regs; /* forward declaration... */ 311 312 | 294 295#define ELF_NGREG 80 /* We only need 64 at present, but leave space 296 for expansion. */ 297typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 298 299#define ELF_NFPREG 32 300typedef double elf_fpreg_t; 301typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; 302 303struct task_struct; 304 305extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *); 306#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs) 307 308struct pt_regs; /* forward declaration... */ 309 310 |
313#define elf_check_arch(x) ((x)->e_machine == EM_PARISC && (x)->e_ident[EI_CLASS] == ELF_CLASS) | 311#define elf_check_arch(x) \ 312 ((x)->e_machine == EM_PARISC && (x)->e_ident[EI_CLASS] == ELF_CLASS) 313#define compat_elf_check_arch(x) \ 314 ((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 --- 40 unchanged lines hidden --- | 315 316/* 317 * These are used to set parameters in the core dumps. 318 */ 319#define ELF_DATA ELFDATA2MSB 320#define ELF_ARCH EM_PARISC 321#define ELF_OSABI ELFOSABI_LINUX 322 --- 40 unchanged lines hidden --- |