6
6
* ELF register definitions..
7
7
*/
8
8
9
- #include <asm/ptrace .h>
9
+ #include <linux/types .h>
10
10
11
11
#define EM_PARISC 15
12
12
@@ -169,16 +169,12 @@ typedef struct elf64_fdesc {
169
169
__u64 gp ;
170
170
} Elf64_Fdesc ;
171
171
172
- #ifdef __KERNEL__
173
-
174
172
#ifdef CONFIG_64BIT
175
173
#define Elf_Fdesc Elf64_Fdesc
176
174
#else
177
175
#define Elf_Fdesc Elf32_Fdesc
178
176
#endif /*CONFIG_64BIT*/
179
177
180
- #endif /*__KERNEL__*/
181
-
182
178
/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */
183
179
184
180
#define PT_HP_TLS (PT_LOOS + 0x0)
@@ -212,45 +208,45 @@ typedef struct elf64_fdesc {
212
208
#define PF_HP_LAZYSWAP 0x04000000
213
209
#define PF_HP_SBP 0x08000000
214
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
+
215
219
/*
216
220
* The following definitions are those for 32-bit ELF binaries on a 32-bit
217
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
224
*/
222
225
#ifndef ELF_CLASS
223
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
227
#ifdef CONFIG_64BIT
235
- #define ELF_CLASS ELFCLASS64
228
+ #define ELF_CLASS ELFCLASS64
236
229
#else
237
230
#define ELF_CLASS ELFCLASS32
238
231
#endif
239
232
240
233
typedef unsigned long elf_greg_t ;
241
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
235
#define SET_PERSONALITY (ex ) \
236
+ ({ \
251
237
set_personality((current->personality & ~PER_MASK) | PER_LINUX); \
252
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
+ })
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
+ })
254
250
255
251
/*
256
252
* Fill in general registers in a core dump. This saves pretty
@@ -277,10 +273,12 @@ typedef unsigned long elf_greg_t;
277
273
278
274
#define ELF_CORE_COPY_REGS (dst , pt ) \
279
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
282
dst [44 ] = pt -> sar ; dst [45 ] = pt -> iir ; \
285
283
dst [46 ] = pt -> isr ; dst [47 ] = pt -> ior ; \
286
284
dst [48 ] = mfctl (22 ); dst [49 ] = mfctl (0 ); \
@@ -292,7 +290,7 @@ typedef unsigned long elf_greg_t;
292
290
dst [60 ] = mfctl (12 ); dst [61 ] = mfctl (13 ); \
293
291
dst [62 ] = mfctl (10 ); dst [63 ] = mfctl (15 );
294
292
295
- #endif /* ! ELF_CLASS */
293
+ #define CORE_DUMP_USE_REGSET
296
294
297
295
#define ELF_NGREG 80 /* We only need 64 at present, but leave space
298
296
for expansion. */
@@ -310,7 +308,10 @@ extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
310
308
struct pt_regs ; /* forward declaration... */
311
309
312
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
315
316
/*
316
317
* These are used to set parameters in the core dumps.
0 commit comments