66 * ELF register definitions..
77 */
88
9- #include <asm/ptrace .h>
9+ #include <linux/types .h>
1010
1111#define EM_PARISC 15
1212
@@ -169,16 +169,12 @@ typedef struct elf64_fdesc {
169169 __u64 gp ;
170170} Elf64_Fdesc ;
171171
172- #ifdef __KERNEL__
173-
174172#ifdef CONFIG_64BIT
175173#define Elf_Fdesc Elf64_Fdesc
176174#else
177175#define Elf_Fdesc Elf32_Fdesc
178176#endif /*CONFIG_64BIT*/
179177
180- #endif /*__KERNEL__*/
181-
182178/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */
183179
184180#define PT_HP_TLS (PT_LOOS + 0x0)
@@ -212,45 +208,45 @@ typedef struct elf64_fdesc {
212208#define PF_HP_LAZYSWAP 0x04000000
213209#define PF_HP_SBP 0x08000000
214210
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+
215219/*
216220 * The following definitions are those for 32-bit ELF binaries on a 32-bit
217221 * 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.
221224 */
222225#ifndef ELF_CLASS
223226
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- */
234227#ifdef CONFIG_64BIT
235- #define ELF_CLASS ELFCLASS64
228+ #define ELF_CLASS ELFCLASS64
236229#else
237230#define ELF_CLASS ELFCLASS32
238231#endif
239232
240233typedef unsigned long elf_greg_t ;
241234
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-
250235#define SET_PERSONALITY (ex ) \
236+ ({ \
251237 set_personality((current->personality & ~PER_MASK) | PER_LINUX); \
252238 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+ })
254250
255251/*
256252 * Fill in general registers in a core dump. This saves pretty
@@ -277,10 +273,12 @@ typedef unsigned long elf_greg_t;
277273
278274#define ELF_CORE_COPY_REGS (dst , pt ) \
279275 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 ]; \
284282 dst [44 ] = pt -> sar ; dst [45 ] = pt -> iir ; \
285283 dst [46 ] = pt -> isr ; dst [47 ] = pt -> ior ; \
286284 dst [48 ] = mfctl (22 ); dst [49 ] = mfctl (0 ); \
@@ -292,7 +290,7 @@ typedef unsigned long elf_greg_t;
292290 dst [60 ] = mfctl (12 ); dst [61 ] = mfctl (13 ); \
293291 dst [62 ] = mfctl (10 ); dst [63 ] = mfctl (15 );
294292
295- #endif /* ! ELF_CLASS */
293+ #define CORE_DUMP_USE_REGSET
296294
297295#define ELF_NGREG 80 /* We only need 64 at present, but leave space
298296 for expansion. */
@@ -310,7 +308,10 @@ extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
310308struct pt_regs ; /* forward declaration... */
311309
312310
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)
314315
315316/*
316317 * These are used to set parameters in the core dumps.
0 commit comments