[POWERPC] Switch to generic compat_binfmt_elf code

This switches the CONFIG_PPC64 support for 32-bit ELF to use the
generic fs/compat_binfmt_elf.c implementation instead of our own
binfmt_elf32.c.  Since so much is the same between 32/64, there is
only one macro we have to define to make the generic support work out
of the box.

Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
Roland McGrath 2008-01-02 17:03:11 -08:00 коммит произвёл Paul Mackerras
Родитель 819703872d
Коммит 01e31dbabc
4 изменённых файлов: 3 добавлений и 70 удалений

Просмотреть файл

@ -97,6 +97,7 @@ config EARLY_PRINTK
config COMPAT
bool
default y if PPC64
select COMPAT_BINFMT_ELF
config SYSVIPC_COMPAT
bool

Просмотреть файл

@ -17,7 +17,7 @@ obj-y := semaphore.o cputable.o ptrace.o syscalls.o \
init_task.o process.o systbl.o idle.o \
signal.o
obj-y += vdso32/
obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \
obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \
signal_64.o ptrace32.o \
paca.o cpu_setup_ppc970.o \
cpu_setup_pa6t.o \

Просмотреть файл

@ -1,69 +0,0 @@
/*
* binfmt_elf32.c: Support 32-bit PPC ELF binaries on Power3 and followons.
* based on the SPARC64 version.
* Copyright (C) 1995, 1996, 1997, 1998 David S. Miller (davem@redhat.com)
* Copyright (C) 1995, 1996, 1997, 1998 Jakub Jelinek (jj@ultra.linux.cz)
*
* Copyright (C) 2000,2001 Ken Aaker (kdaaker@rchland.vnet.ibm.com), IBM Corp
* Copyright (C) 2001 Anton Blanchard (anton@au.ibm.com), IBM
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include <asm/processor.h>
#include <linux/module.h>
#include <linux/compat.h>
#include <linux/elfcore-compat.h>
#undef ELF_ARCH
#undef ELF_CLASS
#define ELF_CLASS ELFCLASS32
#define ELF_ARCH EM_PPC
#undef elfhdr
#undef elf_phdr
#undef elf_note
#undef elf_addr_t
#define elfhdr elf32_hdr
#define elf_phdr elf32_phdr
#define elf_note elf32_note
#define elf_addr_t Elf32_Off
#define elf_prstatus compat_elf_prstatus
#define elf_prpsinfo compat_elf_prpsinfo
#define elf_core_copy_regs compat_elf_core_copy_regs
static inline void compat_elf_core_copy_regs(compat_elf_gregset_t *elf_regs,
struct pt_regs *regs)
{
PPC_ELF_CORE_COPY_REGS((*elf_regs), regs);
}
#define elf_core_copy_task_regs compat_elf_core_copy_task_regs
static int compat_elf_core_copy_task_regs(struct task_struct *tsk,
compat_elf_gregset_t *elf_regs)
{
struct pt_regs *regs = tsk->thread.regs;
if (regs)
compat_elf_core_copy_regs(elf_regs, regs);
return 1;
}
#include <linux/time.h>
#undef cputime_to_timeval
#define cputime_to_timeval cputime_to_compat_timeval
static __inline__ void
cputime_to_compat_timeval(const cputime_t cputime, struct compat_timeval *value)
{
unsigned long jiffies = cputime_to_jiffies(cputime);
value->tv_usec = (jiffies % HZ) * (1000000L / HZ);
value->tv_sec = jiffies / HZ;
}
#define init_elf_binfmt init_elf32_binfmt
#include "../../../fs/binfmt_elf.c"

Просмотреть файл

@ -165,6 +165,7 @@ typedef elf_vrreg_t elf_vrregset_t32[ELF_NVRREG32];
* This is used to ensure we don't load something for the wrong architecture.
*/
#define elf_check_arch(x) ((x)->e_machine == ELF_ARCH)
#define compat_elf_check_arch(x) ((x)->e_machine == EM_PPC)
#define USE_ELF_CORE_DUMP
#define CORE_DUMP_USE_REGSET