Cleanup asm/{elf,page,user}.h: #ifdef __KERNEL__ is no longer needed
[deliverable/linux.git] / include / asm-sparc / elf.h
1 /* $Id: elf.h,v 1.22 2000/07/12 01:27:08 davem Exp $ */
2 #ifndef __ASMSPARC_ELF_H
3 #define __ASMSPARC_ELF_H
4
5 /*
6 * ELF register definitions..
7 */
8
9 #include <asm/ptrace.h>
10
11 /*
12 * Sparc section types
13 */
14 #define STT_REGISTER 13
15
16 /*
17 * Sparc ELF relocation types
18 */
19 #define R_SPARC_NONE 0
20 #define R_SPARC_8 1
21 #define R_SPARC_16 2
22 #define R_SPARC_32 3
23 #define R_SPARC_DISP8 4
24 #define R_SPARC_DISP16 5
25 #define R_SPARC_DISP32 6
26 #define R_SPARC_WDISP30 7
27 #define R_SPARC_WDISP22 8
28 #define R_SPARC_HI22 9
29 #define R_SPARC_22 10
30 #define R_SPARC_13 11
31 #define R_SPARC_LO10 12
32 #define R_SPARC_GOT10 13
33 #define R_SPARC_GOT13 14
34 #define R_SPARC_GOT22 15
35 #define R_SPARC_PC10 16
36 #define R_SPARC_PC22 17
37 #define R_SPARC_WPLT30 18
38 #define R_SPARC_COPY 19
39 #define R_SPARC_GLOB_DAT 20
40 #define R_SPARC_JMP_SLOT 21
41 #define R_SPARC_RELATIVE 22
42 #define R_SPARC_UA32 23
43 #define R_SPARC_PLT32 24
44 #define R_SPARC_HIPLT22 25
45 #define R_SPARC_LOPLT10 26
46 #define R_SPARC_PCPLT32 27
47 #define R_SPARC_PCPLT22 28
48 #define R_SPARC_PCPLT10 29
49 #define R_SPARC_10 30
50 #define R_SPARC_11 31
51 #define R_SPARC_64 32
52 #define R_SPARC_OLO10 33
53 #define R_SPARC_WDISP16 40
54 #define R_SPARC_WDISP19 41
55 #define R_SPARC_7 43
56 #define R_SPARC_5 44
57 #define R_SPARC_6 45
58
59 /* Bits present in AT_HWCAP, primarily for Sparc32. */
60
61 #define HWCAP_SPARC_FLUSH 1 /* CPU supports flush instruction. */
62 #define HWCAP_SPARC_STBAR 2
63 #define HWCAP_SPARC_SWAP 4
64 #define HWCAP_SPARC_MULDIV 8
65 #define HWCAP_SPARC_V9 16
66 #define HWCAP_SPARC_ULTRA3 32
67
68 /* For the most part we present code dumps in the format
69 * Solaris does.
70 */
71 typedef unsigned long elf_greg_t;
72 #define ELF_NGREG 38
73 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
74
75 typedef struct {
76 union {
77 unsigned long pr_regs[32];
78 double pr_dregs[16];
79 } pr_fr;
80 unsigned long __unused;
81 unsigned long pr_fsr;
82 unsigned char pr_qcnt;
83 unsigned char pr_q_entrysize;
84 unsigned char pr_en;
85 unsigned int pr_q[64];
86 } elf_fpregset_t;
87
88 #include <asm/mbus.h>
89 #include <asm/uaccess.h>
90
91 /* Format is:
92 * G0 --> G7
93 * O0 --> O7
94 * L0 --> L7
95 * I0 --> I7
96 * PSR, PC, nPC, Y, WIM, TBR
97 */
98 #define ELF_CORE_COPY_REGS(__elf_regs, __pt_regs) \
99 do { unsigned long *dest = &(__elf_regs[0]); \
100 struct pt_regs *src = (__pt_regs); \
101 unsigned long __user *sp; \
102 memcpy(&dest[0], &src->u_regs[0], \
103 sizeof(unsigned long) * 16); \
104 /* Don't try this at home kids... */ \
105 sp = (unsigned long __user *) src->u_regs[14]; \
106 copy_from_user(&dest[16], sp, \
107 sizeof(unsigned long) * 16); \
108 dest[32] = src->psr; \
109 dest[33] = src->pc; \
110 dest[34] = src->npc; \
111 dest[35] = src->y; \
112 dest[36] = dest[37] = 0; /* XXX */ \
113 } while(0); /* Janitors: Don't touch this semicolon. */
114
115 #define ELF_CORE_COPY_TASK_REGS(__tsk, __elf_regs) \
116 ({ ELF_CORE_COPY_REGS((*(__elf_regs)), (__tsk)->thread.kregs); 1; })
117
118 /*
119 * This is used to ensure we don't load something for the wrong architecture.
120 */
121 #define elf_check_arch(x) ((x)->e_machine == EM_SPARC)
122
123 /*
124 * These are used to set parameters in the core dumps.
125 */
126 #define ELF_ARCH EM_SPARC
127 #define ELF_CLASS ELFCLASS32
128 #define ELF_DATA ELFDATA2MSB
129
130 #define USE_ELF_CORE_DUMP
131 #ifndef CONFIG_SUN4
132 #define ELF_EXEC_PAGESIZE 4096
133 #else
134 #define ELF_EXEC_PAGESIZE 8192
135 #endif
136
137
138 /* This is the location that an ET_DYN program is loaded if exec'ed. Typical
139 use of this is to invoke "./ld.so someprog" to test out a new version of
140 the loader. We need to make sure that it is out of the way of the program
141 that it will "exec", and that there is sufficient room for the brk. */
142
143 #define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE)
144
145 /* This yields a mask that user programs can use to figure out what
146 instruction set this cpu supports. This can NOT be done in userspace
147 on Sparc. */
148
149 /* Sun4c has none of the capabilities, most sun4m's have them all.
150 * XXX This is gross, set some global variable at boot time. -DaveM
151 */
152 #define ELF_HWCAP ((ARCH_SUN4C_SUN4) ? 0 : \
153 (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | \
154 HWCAP_SPARC_SWAP | \
155 ((srmmu_modtype != Cypress && \
156 srmmu_modtype != Cypress_vE && \
157 srmmu_modtype != Cypress_vD) ? \
158 HWCAP_SPARC_MULDIV : 0)))
159
160 /* This yields a string that ld.so will use to load implementation
161 specific libraries for optimization. This is more specific in
162 intent than poking at uname or /proc/cpuinfo. */
163
164 #define ELF_PLATFORM (NULL)
165
166 #define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
167
168 #endif /* !(__ASMSPARC_ELF_H) */
This page took 0.034836 seconds and 5 git commands to generate.