cleanup
[linux-2.4.21-pre4.git] / include / asm-alpha / elf.h
1 #ifndef __ASM_ALPHA_ELF_H
2 #define __ASM_ALPHA_ELF_H
3
4 /*
5  * ELF register definitions..
6  */
7
8 /*
9  * The OSF/1 version of <sys/procfs.h> makes gregset_t 46 entries long.
10  * I have no idea why that is so.  For now, we just leave it at 33
11  * (32 general regs + processor status word). 
12  */
13 #define ELF_NGREG       33
14 #define ELF_NFPREG      32
15
16 typedef unsigned long elf_greg_t;
17 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
18
19 typedef double elf_fpreg_t;
20 typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
21
22 /*
23  * This is used to ensure we don't load something for the wrong architecture.
24  */
25 #define elf_check_arch(x) ((x)->e_machine == EM_ALPHA)
26
27 /*
28  * These are used to set parameters in the core dumps.
29  */
30 #define ELF_CLASS       ELFCLASS64
31 #define ELF_DATA        ELFDATA2LSB
32 #define ELF_ARCH        EM_ALPHA
33
34 #define USE_ELF_CORE_DUMP
35 #define ELF_EXEC_PAGESIZE       8192
36
37 /* This is the location that an ET_DYN program is loaded if exec'ed.  Typical
38    use of this is to invoke "./ld.so someprog" to test out a new version of
39    the loader.  We need to make sure that it is out of the way of the program
40    that it will "exec", and that there is sufficient room for the brk.  */
41
42 #define ELF_ET_DYN_BASE         (TASK_UNMAPPED_BASE + 0x1000000)
43
44 /* $0 is set by ld.so to a pointer to a function which might be 
45    registered using atexit.  This provides a mean for the dynamic
46    linker to call DT_FINI functions for shared libraries that have
47    been loaded before the code runs.
48
49    So that we can use the same startup file with static executables,
50    we start programs with a value of 0 to indicate that there is no
51    such function.  */
52
53 #define ELF_PLAT_INIT(_r)       _r->r0 = 0
54
55 /* The registers are layed out in pt_regs for PAL and syscall
56    convenience.  Re-order them for the linear elf_gregset_t.  */
57
58 extern void dump_elf_thread(elf_greg_t *, struct pt_regs *,
59                             struct task_struct *);
60 #define ELF_CORE_COPY_REGS(DEST, REGS) \
61         dump_elf_thread(DEST, REGS, current);
62
63 /* This yields a mask that user programs can use to figure out what
64    instruction set this CPU supports.  This is trivial on Alpha, 
65    but not so on other machines. */
66
67 #define ELF_HWCAP                                                       \
68 ({                                                                      \
69         /* Sadly, most folks don't yet have assemblers that know about  \
70            amask.  This is "amask v0, v0" */                            \
71         register long _v0 __asm("$0") = -1;                             \
72         __asm(".long 0x47e00c20" : "=r"(_v0) : "0"(_v0));               \
73         ~_v0;                                                           \
74 })
75
76 /* This yields a string that ld.so will use to load implementation
77    specific libraries for optimization.  This is more specific in
78    intent than poking at uname or /proc/cpuinfo.  
79
80    This might do with checking bwx simultaneously...  */
81
82 #define ELF_PLATFORM                            \
83 ({                                              \
84         /* Or "implver v0" ... */               \
85         register long _v0 __asm("$0");          \
86         __asm(".long 0x47e03d80" : "=r"(_v0));  \
87         _v0 == 0 ? "ev4" : "ev5";               \
88 })
89
90 #ifdef __KERNEL__
91 #define SET_PERSONALITY(EX, IBCS2)                              \
92         set_personality(((EX).e_flags & EF_ALPHA_32BIT)         \
93            ? PER_LINUX_32BIT : (IBCS2) ? PER_SVR4 : PER_LINUX)
94 #endif
95
96 #endif