linux-cvs-patches
[Top] [All Lists]

CVS Update@linux-mips.org: linux

To: linux-cvs-patches@linux-mips.org
Subject: CVS Update@linux-mips.org: linux
From: ralf@linux-mips.org
Date: Thu, 14 Apr 2005 11:41:50 +0100
Reply-to: linux-mips@linux-mips.org
Sender: linux-cvs-patches-bounce@linux-mips.org
CVSROOT:        /home/cvs
Module name:    linux
Changes by:     ralf@ftp.linux-mips.org 05/04/14 11:41:44

Modified files:
        arch/mips/kernel: Tag: linux_2_4 process.c 
        arch/mips64/kernel: Tag: linux_2_4 process.c 
        include/asm-mips: Tag: linux_2_4 elf.h reg.h 
        include/asm-mips64: Tag: linux_2_4 elf.h reg.h 

Log message:
        Fix 2.4 ELF core dumps match what gdb is expecting.  Affected are 32-bit
        o32 and 64-bit n64 and n32 core dumps.

diff -urN linux/arch/mips/kernel/process.c linux/arch/mips/kernel/process.c
--- linux/arch/mips/kernel/process.c    2003/07/24 04:44:00     1.32.2.13
+++ linux/arch/mips/kernel/process.c    2005/04/14 10:41:44     1.32.2.14
@@ -128,6 +128,26 @@
        return 1;
 }
 
+void dump_regs(elf_greg_t *gp, struct pt_regs *regs)
+{
+       int i;
+
+       for (i = 0; i < EF_REG0; i++)
+               gp[i] = 0;
+       gp[EF_REG0] = 0;
+       for (i = 1; i <= 31; i++)
+               gp[EF_REG0 + i] = regs->regs[i];
+       gp[EF_REG26] = 0;
+       gp[EF_REG27] = 0;
+       gp[EF_LO] = regs->lo;
+       gp[EF_HI] = regs->hi;
+       gp[EF_CP0_EPC] = regs->cp0_epc;
+       gp[EF_CP0_BADVADDR] = regs->cp0_badvaddr;
+       gp[EF_CP0_STATUS] = regs->cp0_status;
+       gp[EF_CP0_CAUSE] = regs->cp0_cause;
+       gp[EF_UNUSED0] = 0;
+}
+
 /*
  * Create a kernel thread
  */
diff -urN linux/arch/mips64/kernel/process.c linux/arch/mips64/kernel/process.c
--- linux/arch/mips64/kernel/Attic/process.c    2003/07/24 04:44:00     
1.18.2.15
+++ linux/arch/mips64/kernel/Attic/process.c    2005/04/14 10:41:44     
1.18.2.16
@@ -125,6 +125,25 @@
        return 1;
 }
 
+void dump_regs(elf_greg_t *gp, struct pt_regs *regs)
+{
+       int i;
+
+       for (i = 0; i < EF_REG0; i++)
+               gp[i] = 0;
+       gp[EF_REG0] = 0;
+       for (i = 1; i <= 31; i++)
+               gp[EF_REG0 + i] = regs->regs[i];
+       gp[EF_REG26] = 0;
+       gp[EF_REG27] = 0;
+       gp[EF_LO] = regs->lo;
+       gp[EF_HI] = regs->hi;
+       gp[EF_CP0_EPC] = regs->cp0_epc;
+       gp[EF_CP0_BADVADDR] = regs->cp0_badvaddr;
+       gp[EF_CP0_STATUS] = regs->cp0_status;
+       gp[EF_CP0_CAUSE] = regs->cp0_cause;
+}
+
 /*
  * Create a kernel thread
  */
diff -urN linux/include/asm-mips/elf.h linux/include/asm-mips/elf.h
--- linux/include/asm-mips/elf.h        2003/11/17 01:07:45     1.14.2.4
+++ linux/include/asm-mips/elf.h        2005/04/14 10:41:44     1.14.2.5
@@ -66,9 +66,10 @@
 #define USE_ELF_CORE_DUMP
 #define ELF_EXEC_PAGESIZE      PAGE_SIZE
 
-#define ELF_CORE_COPY_REGS(_dest,_regs)                                \
-       memcpy((char *) &_dest, (char *) _regs,                 \
-              sizeof(struct pt_regs));
+extern void dump_regs(elf_greg_t *, struct pt_regs *regs);
+
+#define ELF_CORE_COPY_REGS(elf_regs, regs)                     \
+       dump_regs((elf_greg_t *)&(elf_regs), regs);
 
 /* This yields a mask that user programs can use to figure out what
    instruction set this cpu supports.  This could be done in userspace,
diff -urN linux/include/asm-mips/reg.h linux/include/asm-mips/reg.h
--- linux/include/asm-mips/reg.h        2001/11/11 02:44:51     1.3
+++ linux/include/asm-mips/reg.h        2005/04/14 10:41:44     1.3.2.1
@@ -45,6 +45,9 @@
 /*
  * k0/k1 unsaved
  */
+#define EF_REG26               32
+#define EF_REG27               33
+
 #define EF_REG28               34
 #define EF_REG29               35
 #define EF_REG30               36
@@ -60,6 +63,7 @@
 #define EF_CP0_BADVADDR                41
 #define EF_CP0_STATUS          42
 #define EF_CP0_CAUSE           43
+#define EF_UNUSED0             44
 
 #define EF_SIZE                        180     /* size in bytes */
 
diff -urN linux/include/asm-mips64/elf.h linux/include/asm-mips64/elf.h
--- linux/include/asm-mips64/Attic/elf.h        2003/11/17 01:07:45     1.10.2.6
+++ linux/include/asm-mips64/Attic/elf.h        2005/04/14 10:41:44     1.10.2.7
@@ -64,9 +64,10 @@
 #define USE_ELF_CORE_DUMP
 #define ELF_EXEC_PAGESIZE      PAGE_SIZE
 
-#define ELF_CORE_COPY_REGS(_dest,_regs)                                \
-       memcpy((char *) &_dest, (char *) _regs,                 \
-              sizeof(struct pt_regs));
+extern void dump_regs(elf_greg_t *, struct pt_regs *regs);
+
+#define ELF_CORE_COPY_REGS(elf_regs, regs)                     \
+       dump_regs((elf_greg_t *)&(elf_regs), regs);
 
 /* This yields a mask that user programs can use to figure out what
    instruction set this cpu supports.  This could be done in userspace,
diff -urN linux/include/asm-mips64/reg.h linux/include/asm-mips64/reg.h
--- linux/include/asm-mips64/Attic/reg.h        2002/09/18 02:48:05     1.1.4.1
+++ linux/include/asm-mips64/Attic/reg.h        2005/04/14 10:41:44     1.1.4.2
@@ -46,6 +46,9 @@
 /*
  * k0/k1 unsaved
  */
+#define EF_REG26               26
+#define EF_REG27               27
+
 #define EF_REG28               28
 #define EF_REG29               29
 #define EF_REG30               30

<Prev in Thread] Current Thread [Next in Thread>