MIPS: asm/reg.h: Make 32- and 64-bit definitions available at the same time

Get rid of the WANT_COMPAT_REG_H test and instead define both the 32-
and 64-bit register offset definitions at the same time with
MIPS{32,64}_ prefixes, then define the existing EF_* names to the
correct definitions for the kernel's bitness.

This patch is a prerequisite of the following bug fix patch.

Signed-off-by: Alex Smith <alex@alex-smith.me.uk>
Cc: <stable@vger.kernel.org> # v3.13+
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/7451/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
Alex Smith
2014-07-23 14:40:08 +01:00
committed by Ralf Baechle
parent 65768a1a92
commit bcec7c8da6
2 changed files with 177 additions and 105 deletions

View File

@@ -72,12 +72,6 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
#include <asm/processor.h>
/*
* When this file is selected, we are definitely running a 64bit kernel.
* So using the right regs define in asm/reg.h
*/
#define WANT_COMPAT_REG_H
/* These MUST be defined before elf.h gets included */
extern void elf32_core_copy_regs(elf_gregset_t grp, struct pt_regs *regs);
#define ELF_CORE_COPY_REGS(_dest, _regs) elf32_core_copy_regs(_dest, _regs);
@@ -149,21 +143,21 @@ void elf32_core_copy_regs(elf_gregset_t grp, struct pt_regs *regs)
{
int i;
for (i = 0; i < EF_R0; i++)
for (i = 0; i < MIPS32_EF_R0; i++)
grp[i] = 0;
grp[EF_R0] = 0;
grp[MIPS32_EF_R0] = 0;
for (i = 1; i <= 31; i++)
grp[EF_R0 + i] = (elf_greg_t) regs->regs[i];
grp[EF_R26] = 0;
grp[EF_R27] = 0;
grp[EF_LO] = (elf_greg_t) regs->lo;
grp[EF_HI] = (elf_greg_t) regs->hi;
grp[EF_CP0_EPC] = (elf_greg_t) regs->cp0_epc;
grp[EF_CP0_BADVADDR] = (elf_greg_t) regs->cp0_badvaddr;
grp[EF_CP0_STATUS] = (elf_greg_t) regs->cp0_status;
grp[EF_CP0_CAUSE] = (elf_greg_t) regs->cp0_cause;
#ifdef EF_UNUSED0
grp[EF_UNUSED0] = 0;
grp[MIPS32_EF_R0 + i] = (elf_greg_t) regs->regs[i];
grp[MIPS32_EF_R26] = 0;
grp[MIPS32_EF_R27] = 0;
grp[MIPS32_EF_LO] = (elf_greg_t) regs->lo;
grp[MIPS32_EF_HI] = (elf_greg_t) regs->hi;
grp[MIPS32_EF_CP0_EPC] = (elf_greg_t) regs->cp0_epc;
grp[MIPS32_EF_CP0_BADVADDR] = (elf_greg_t) regs->cp0_badvaddr;
grp[MIPS32_EF_CP0_STATUS] = (elf_greg_t) regs->cp0_status;
grp[MIPS32_EF_CP0_CAUSE] = (elf_greg_t) regs->cp0_cause;
#ifdef MIPS32_EF_UNUSED0
grp[MIPS32_EF_UNUSED0] = 0;
#endif
}