more changes on original files
[linux-2.4.git] / include / asm-ppc / elf.h
1 #ifndef __PPC_ELF_H
2 #define __PPC_ELF_H
3
4 /*
5  * ELF register definitions..
6  */
7 #include <asm/types.h>
8 #include <asm/ptrace.h>
9 #include <asm/cputable.h>
10
11 #define ELF_NGREG       48      /* includes nip, msr, lr, etc. */
12 #define ELF_NFPREG      33      /* includes fpscr */
13 #define ELF_NVRREG      33      /* includes vscr */
14
15 /*
16  * These are used to set parameters in the core dumps.
17  */
18 #define ELF_ARCH        EM_PPC
19 #define ELF_CLASS       ELFCLASS32
20 #define ELF_DATA        ELFDATA2MSB
21
22 /* General registers */
23 typedef unsigned long elf_greg_t;
24 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
25
26 /* Floating point registers */
27 typedef double elf_fpreg_t;
28 typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
29
30 /* Altivec registers */
31 typedef __vector128 elf_vrreg_t;
32 typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG];
33
34 #ifdef __KERNEL__
35
36 /*
37  * This is used to ensure we don't load something for the wrong architecture.
38  */
39
40 #define elf_check_arch(x) ((x)->e_machine == EM_PPC)
41
42 /* This is the location that an ET_DYN program is loaded if exec'ed.  Typical
43    use of this is to invoke "./ld.so someprog" to test out a new version of
44    the loader.  We need to make sure that it is out of the way of the program
45    that it will "exec", and that there is sufficient room for the brk.  */
46
47 #define ELF_ET_DYN_BASE         (0x08000000)
48
49 #define USE_ELF_CORE_DUMP
50 #define ELF_EXEC_PAGESIZE       4096
51
52 #define ELF_CORE_COPY_REGS(gregs, regs) \
53         memcpy(gregs, regs, \
54                sizeof(struct pt_regs) < sizeof(elf_gregset_t)? \
55                sizeof(struct pt_regs): sizeof(elf_gregset_t));
56
57
58 /* This yields a mask that user programs can use to figure out what
59    instruction set this cpu supports.  This could be done in userspace,
60    but it's not easy, and we've already done it here.  */
61
62 #define ELF_HWCAP       (cur_cpu_spec[0]->cpu_user_features)
63
64 /* This yields a string that ld.so will use to load implementation
65    specific libraries for optimization.  This is more specific in
66    intent than poking at uname or /proc/cpuinfo.
67
68    For the moment, we have only optimizations for the Intel generations,
69    but that could change... */
70
71 #define ELF_PLATFORM    (NULL)
72
73 #define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
74
75 /*
76  * We need to put in some extra aux table entries to tell glibc what
77  * the cache block size is, so it can use the dcbz instruction safely.
78  */
79 #define AT_DCACHEBSIZE          19
80 #define AT_ICACHEBSIZE          20
81 #define AT_UCACHEBSIZE          21
82 /* A special ignored type value for PPC, for glibc compatibility.  */
83 #define AT_IGNOREPPC            22
84
85 extern int dcache_bsize;
86 extern int icache_bsize;
87 extern int ucache_bsize;
88
89 /*
90  * The requirements here are:
91  * - keep the final alignment of sp (sp & 0xf)
92  * - make sure the 32-bit value at the first 16 byte aligned position of
93  *   AUXV is greater than 16 for glibc compatibility.
94  *   AT_IGNOREPPC is used for that.
95  * - for compatibility with glibc ARCH_DLINFO must always be defined on PPC,
96  *   even if DLINFO_ARCH_ITEMS goes to zero or is undefined.
97  */
98 #define DLINFO_ARCH_ITEMS       3
99 #define ARCH_DLINFO                                                     \
100 do {                                                                    \
101         sp -= DLINFO_ARCH_ITEMS * 2;                                    \
102         NEW_AUX_ENT(0, AT_DCACHEBSIZE, dcache_bsize);                   \
103         NEW_AUX_ENT(1, AT_ICACHEBSIZE, icache_bsize);                   \
104         NEW_AUX_ENT(2, AT_UCACHEBSIZE, ucache_bsize);                   \
105         /*                                                              \
106          * Now handle glibc compatibility.                              \
107          */                                                             \
108         sp -= 2*2;                                                      \
109         NEW_AUX_ENT(0, AT_IGNOREPPC, AT_IGNOREPPC);                     \
110         NEW_AUX_ENT(1, AT_IGNOREPPC, AT_IGNOREPPC);                     \
111  } while (0)
112
113 #endif /* __KERNEL__ */
114 #endif