Linux Audio

Check our new training course

Real-Time Linux with PREEMPT_RT training

Feb 18-20, 2025
Register
Loading...
v3.1
  1#ifndef __ASM_ALPHA_ELF_H
  2#define __ASM_ALPHA_ELF_H
  3
  4#include <asm/auxvec.h>
 
  5
  6/* Special values for the st_other field in the symbol table.  */
  7
  8#define STO_ALPHA_NOPV		0x80
  9#define STO_ALPHA_STD_GPLOAD	0x88
 10
 11/*
 12 * Alpha ELF relocation types
 13 */
 14#define R_ALPHA_NONE            0       /* No reloc */
 15#define R_ALPHA_REFLONG         1       /* Direct 32 bit */
 16#define R_ALPHA_REFQUAD         2       /* Direct 64 bit */
 17#define R_ALPHA_GPREL32         3       /* GP relative 32 bit */
 18#define R_ALPHA_LITERAL         4       /* GP relative 16 bit w/optimization */
 19#define R_ALPHA_LITUSE          5       /* Optimization hint for LITERAL */
 20#define R_ALPHA_GPDISP          6       /* Add displacement to GP */
 21#define R_ALPHA_BRADDR          7       /* PC+4 relative 23 bit shifted */
 22#define R_ALPHA_HINT            8       /* PC+4 relative 16 bit shifted */
 23#define R_ALPHA_SREL16          9       /* PC relative 16 bit */
 24#define R_ALPHA_SREL32          10      /* PC relative 32 bit */
 25#define R_ALPHA_SREL64          11      /* PC relative 64 bit */
 26#define R_ALPHA_GPRELHIGH       17      /* GP relative 32 bit, high 16 bits */
 27#define R_ALPHA_GPRELLOW        18      /* GP relative 32 bit, low 16 bits */
 28#define R_ALPHA_GPREL16         19      /* GP relative 16 bit */
 29#define R_ALPHA_COPY            24      /* Copy symbol at runtime */
 30#define R_ALPHA_GLOB_DAT        25      /* Create GOT entry */
 31#define R_ALPHA_JMP_SLOT        26      /* Create PLT entry */
 32#define R_ALPHA_RELATIVE        27      /* Adjust by program base */
 33#define R_ALPHA_BRSGP		28
 34#define R_ALPHA_TLSGD           29
 35#define R_ALPHA_TLS_LDM         30
 36#define R_ALPHA_DTPMOD64        31
 37#define R_ALPHA_GOTDTPREL       32
 38#define R_ALPHA_DTPREL64        33
 39#define R_ALPHA_DTPRELHI        34
 40#define R_ALPHA_DTPRELLO        35
 41#define R_ALPHA_DTPREL16        36
 42#define R_ALPHA_GOTTPREL        37
 43#define R_ALPHA_TPREL64         38
 44#define R_ALPHA_TPRELHI         39
 45#define R_ALPHA_TPRELLO         40
 46#define R_ALPHA_TPREL16         41
 47
 48#define SHF_ALPHA_GPREL		0x10000000
 49
 50/* Legal values for e_flags field of Elf64_Ehdr.  */
 51
 52#define EF_ALPHA_32BIT		1	/* All addresses are below 2GB */
 53
 54/*
 55 * ELF register definitions..
 56 */
 57
 58/*
 59 * The OSF/1 version of <sys/procfs.h> makes gregset_t 46 entries long.
 60 * I have no idea why that is so.  For now, we just leave it at 33
 61 * (32 general regs + processor status word). 
 62 */
 63#define ELF_NGREG	33
 64#define ELF_NFPREG	32
 65
 66typedef unsigned long elf_greg_t;
 67typedef elf_greg_t elf_gregset_t[ELF_NGREG];
 68
 69typedef double elf_fpreg_t;
 70typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
 71
 72/*
 73 * This is used to ensure we don't load something for the wrong architecture.
 74 */
 75#define elf_check_arch(x) ((x)->e_machine == EM_ALPHA)
 76
 77/*
 78 * These are used to set parameters in the core dumps.
 79 */
 80#define ELF_CLASS	ELFCLASS64
 81#define ELF_DATA	ELFDATA2LSB
 82#define ELF_ARCH	EM_ALPHA
 83
 84#define ELF_EXEC_PAGESIZE	8192
 85
 86/* This is the location that an ET_DYN program is loaded if exec'ed.  Typical
 87   use of this is to invoke "./ld.so someprog" to test out a new version of
 88   the loader.  We need to make sure that it is out of the way of the program
 89   that it will "exec", and that there is sufficient room for the brk.  */
 90
 91#define ELF_ET_DYN_BASE		(TASK_UNMAPPED_BASE + 0x1000000)
 92
 93/* $0 is set by ld.so to a pointer to a function which might be 
 94   registered using atexit.  This provides a mean for the dynamic
 95   linker to call DT_FINI functions for shared libraries that have
 96   been loaded before the code runs.
 97
 98   So that we can use the same startup file with static executables,
 99   we start programs with a value of 0 to indicate that there is no
100   such function.  */
101
102#define ELF_PLAT_INIT(_r, load_addr)	_r->r0 = 0
103
104/* The registers are laid out in pt_regs for PAL and syscall
105   convenience.  Re-order them for the linear elf_gregset_t.  */
106
107struct pt_regs;
108struct thread_info;
109struct task_struct;
110extern void dump_elf_thread(elf_greg_t *dest, struct pt_regs *pt,
111			    struct thread_info *ti);
112#define ELF_CORE_COPY_REGS(DEST, REGS) \
113	dump_elf_thread(DEST, REGS, current_thread_info());
114
115/* Similar, but for a thread other than current.  */
116
117extern int dump_elf_task(elf_greg_t *dest, struct task_struct *task);
118#define ELF_CORE_COPY_TASK_REGS(TASK, DEST) \
119	dump_elf_task(*(DEST), TASK)
120
121/* Similar, but for the FP registers.  */
122
123extern int dump_elf_task_fp(elf_fpreg_t *dest, struct task_struct *task);
124#define ELF_CORE_COPY_FPREGS(TASK, DEST) \
125	dump_elf_task_fp(*(DEST), TASK)
126
127/* This yields a mask that user programs can use to figure out what
128   instruction set this CPU supports.  This is trivial on Alpha, 
129   but not so on other machines. */
130
131#define ELF_HWCAP  (~amask(-1))
132
133/* This yields a string that ld.so will use to load implementation
134   specific libraries for optimization.  This is more specific in
135   intent than poking at uname or /proc/cpuinfo.  */
136
137#define ELF_PLATFORM				\
138({						\
139	enum implver_enum i_ = implver();	\
140	( i_ == IMPLVER_EV4 ? "ev4"		\
141	: i_ == IMPLVER_EV5			\
142	  ? (amask(AMASK_BWX) ? "ev5" : "ev56")	\
143	: amask (AMASK_CIX) ? "ev6" : "ev67");	\
144})
145
146#define SET_PERSONALITY(EX)					\
147	set_personality(((EX).e_flags & EF_ALPHA_32BIT)		\
148	   ? PER_LINUX_32BIT : PER_LINUX)
149
150extern int alpha_l1i_cacheshape;
151extern int alpha_l1d_cacheshape;
152extern int alpha_l2_cacheshape;
153extern int alpha_l3_cacheshape;
154
155/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
156#define ARCH_DLINFO						\
157  do {								\
158    NEW_AUX_ENT(AT_L1I_CACHESHAPE, alpha_l1i_cacheshape);	\
159    NEW_AUX_ENT(AT_L1D_CACHESHAPE, alpha_l1d_cacheshape);	\
160    NEW_AUX_ENT(AT_L2_CACHESHAPE, alpha_l2_cacheshape);		\
161    NEW_AUX_ENT(AT_L3_CACHESHAPE, alpha_l3_cacheshape);		\
162  } while (0)
163
164#endif /* __ASM_ALPHA_ELF_H */
v4.6
  1#ifndef __ASM_ALPHA_ELF_H
  2#define __ASM_ALPHA_ELF_H
  3
  4#include <asm/auxvec.h>
  5#include <asm/special_insns.h>
  6
  7/* Special values for the st_other field in the symbol table.  */
  8
  9#define STO_ALPHA_NOPV		0x80
 10#define STO_ALPHA_STD_GPLOAD	0x88
 11
 12/*
 13 * Alpha ELF relocation types
 14 */
 15#define R_ALPHA_NONE            0       /* No reloc */
 16#define R_ALPHA_REFLONG         1       /* Direct 32 bit */
 17#define R_ALPHA_REFQUAD         2       /* Direct 64 bit */
 18#define R_ALPHA_GPREL32         3       /* GP relative 32 bit */
 19#define R_ALPHA_LITERAL         4       /* GP relative 16 bit w/optimization */
 20#define R_ALPHA_LITUSE          5       /* Optimization hint for LITERAL */
 21#define R_ALPHA_GPDISP          6       /* Add displacement to GP */
 22#define R_ALPHA_BRADDR          7       /* PC+4 relative 23 bit shifted */
 23#define R_ALPHA_HINT            8       /* PC+4 relative 16 bit shifted */
 24#define R_ALPHA_SREL16          9       /* PC relative 16 bit */
 25#define R_ALPHA_SREL32          10      /* PC relative 32 bit */
 26#define R_ALPHA_SREL64          11      /* PC relative 64 bit */
 27#define R_ALPHA_GPRELHIGH       17      /* GP relative 32 bit, high 16 bits */
 28#define R_ALPHA_GPRELLOW        18      /* GP relative 32 bit, low 16 bits */
 29#define R_ALPHA_GPREL16         19      /* GP relative 16 bit */
 30#define R_ALPHA_COPY            24      /* Copy symbol at runtime */
 31#define R_ALPHA_GLOB_DAT        25      /* Create GOT entry */
 32#define R_ALPHA_JMP_SLOT        26      /* Create PLT entry */
 33#define R_ALPHA_RELATIVE        27      /* Adjust by program base */
 34#define R_ALPHA_BRSGP		28
 35#define R_ALPHA_TLSGD           29
 36#define R_ALPHA_TLS_LDM         30
 37#define R_ALPHA_DTPMOD64        31
 38#define R_ALPHA_GOTDTPREL       32
 39#define R_ALPHA_DTPREL64        33
 40#define R_ALPHA_DTPRELHI        34
 41#define R_ALPHA_DTPRELLO        35
 42#define R_ALPHA_DTPREL16        36
 43#define R_ALPHA_GOTTPREL        37
 44#define R_ALPHA_TPREL64         38
 45#define R_ALPHA_TPRELHI         39
 46#define R_ALPHA_TPRELLO         40
 47#define R_ALPHA_TPREL16         41
 48
 49#define SHF_ALPHA_GPREL		0x10000000
 50
 51/* Legal values for e_flags field of Elf64_Ehdr.  */
 52
 53#define EF_ALPHA_32BIT		1	/* All addresses are below 2GB */
 54
 55/*
 56 * ELF register definitions..
 57 */
 58
 59/*
 60 * The OSF/1 version of <sys/procfs.h> makes gregset_t 46 entries long.
 61 * I have no idea why that is so.  For now, we just leave it at 33
 62 * (32 general regs + processor status word). 
 63 */
 64#define ELF_NGREG	33
 65#define ELF_NFPREG	32
 66
 67typedef unsigned long elf_greg_t;
 68typedef elf_greg_t elf_gregset_t[ELF_NGREG];
 69
 70typedef double elf_fpreg_t;
 71typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
 72
 73/*
 74 * This is used to ensure we don't load something for the wrong architecture.
 75 */
 76#define elf_check_arch(x) ((x)->e_machine == EM_ALPHA)
 77
 78/*
 79 * These are used to set parameters in the core dumps.
 80 */
 81#define ELF_CLASS	ELFCLASS64
 82#define ELF_DATA	ELFDATA2LSB
 83#define ELF_ARCH	EM_ALPHA
 84
 85#define ELF_EXEC_PAGESIZE	8192
 86
 87/* This is the location that an ET_DYN program is loaded if exec'ed.  Typical
 88   use of this is to invoke "./ld.so someprog" to test out a new version of
 89   the loader.  We need to make sure that it is out of the way of the program
 90   that it will "exec", and that there is sufficient room for the brk.  */
 91
 92#define ELF_ET_DYN_BASE		(TASK_UNMAPPED_BASE + 0x1000000)
 93
 94/* $0 is set by ld.so to a pointer to a function which might be 
 95   registered using atexit.  This provides a mean for the dynamic
 96   linker to call DT_FINI functions for shared libraries that have
 97   been loaded before the code runs.
 98
 99   So that we can use the same startup file with static executables,
100   we start programs with a value of 0 to indicate that there is no
101   such function.  */
102
103#define ELF_PLAT_INIT(_r, load_addr)	_r->r0 = 0
104
105/* The registers are laid out in pt_regs for PAL and syscall
106   convenience.  Re-order them for the linear elf_gregset_t.  */
107
108struct pt_regs;
109struct thread_info;
110struct task_struct;
111extern void dump_elf_thread(elf_greg_t *dest, struct pt_regs *pt,
112			    struct thread_info *ti);
113#define ELF_CORE_COPY_REGS(DEST, REGS) \
114	dump_elf_thread(DEST, REGS, current_thread_info());
115
116/* Similar, but for a thread other than current.  */
117
118extern int dump_elf_task(elf_greg_t *dest, struct task_struct *task);
119#define ELF_CORE_COPY_TASK_REGS(TASK, DEST) \
120	dump_elf_task(*(DEST), TASK)
121
122/* Similar, but for the FP registers.  */
123
124extern int dump_elf_task_fp(elf_fpreg_t *dest, struct task_struct *task);
125#define ELF_CORE_COPY_FPREGS(TASK, DEST) \
126	dump_elf_task_fp(*(DEST), TASK)
127
128/* This yields a mask that user programs can use to figure out what
129   instruction set this CPU supports.  This is trivial on Alpha, 
130   but not so on other machines. */
131
132#define ELF_HWCAP  (~amask(-1))
133
134/* This yields a string that ld.so will use to load implementation
135   specific libraries for optimization.  This is more specific in
136   intent than poking at uname or /proc/cpuinfo.  */
137
138#define ELF_PLATFORM				\
139({						\
140	enum implver_enum i_ = implver();	\
141	( i_ == IMPLVER_EV4 ? "ev4"		\
142	: i_ == IMPLVER_EV5			\
143	  ? (amask(AMASK_BWX) ? "ev5" : "ev56")	\
144	: amask (AMASK_CIX) ? "ev6" : "ev67");	\
145})
146
147#define SET_PERSONALITY(EX)					\
148	set_personality(((EX).e_flags & EF_ALPHA_32BIT)		\
149	   ? PER_LINUX_32BIT : PER_LINUX)
150
151extern int alpha_l1i_cacheshape;
152extern int alpha_l1d_cacheshape;
153extern int alpha_l2_cacheshape;
154extern int alpha_l3_cacheshape;
155
156/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
157#define ARCH_DLINFO						\
158  do {								\
159    NEW_AUX_ENT(AT_L1I_CACHESHAPE, alpha_l1i_cacheshape);	\
160    NEW_AUX_ENT(AT_L1D_CACHESHAPE, alpha_l1d_cacheshape);	\
161    NEW_AUX_ENT(AT_L2_CACHESHAPE, alpha_l2_cacheshape);		\
162    NEW_AUX_ENT(AT_L3_CACHESHAPE, alpha_l3_cacheshape);		\
163  } while (0)
164
165#endif /* __ASM_ALPHA_ELF_H */