Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm If we are dumping a EABI coredump, set the vers...



details:   https://anonhg.NetBSD.org/src/rev/2915ebb94f47
branches:  trunk
changeset: 326986:2915ebb94f47
user:      matt <matt%NetBSD.org@localhost>
date:      Mon Feb 24 23:54:09 2014 +0000

description:
If we are dumping a EABI coredump, set the version to EABI5.
If we are dumping a BE coredump on a BE8 system, set the BE8 flag.

diffstat:

 sys/arch/arm/arm/core_machdep.c    |  44 ++++++++++++++++++++++++++++++++++++-
 sys/arch/arm/include/elf_machdep.h |   4 ++-
 2 files changed, 45 insertions(+), 3 deletions(-)

diffs (93 lines):

diff -r 2dbba280fe2b -r 2915ebb94f47 sys/arch/arm/arm/core_machdep.c
--- a/sys/arch/arm/arm/core_machdep.c   Mon Feb 24 22:34:08 2014 +0000
+++ b/sys/arch/arm/arm/core_machdep.c   Mon Feb 24 23:54:09 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: core_machdep.c,v 1.4 2014/01/04 00:10:02 dsl Exp $     */
+/*     $NetBSD: core_machdep.c,v 1.5 2014/02/24 23:54:10 matt Exp $    */
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -37,7 +37,10 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: core_machdep.c,v 1.4 2014/01/04 00:10:02 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: core_machdep.c,v 1.5 2014/02/24 23:54:10 matt Exp $");
+
+#include "opt_execfmt.h"
+#include "opt_compat_netbsd32.h"
 
 #include <sys/core.h>
 #include <sys/exec.h>
@@ -49,6 +52,13 @@
 
 #include <sys/exec_aout.h>     /* for MID_* */
 
+#ifdef EXEC_ELF32
+#include <sys/exec_elf.h>
+#ifdef COMPAT_NETBSD32
+#include <compat/netbsd32/netbsd32_exec.h>
+#endif
+#endif
+
 #include <machine/reg.h>
 
 
@@ -96,3 +106,33 @@
        return coredump_write(iocookie, UIO_SYSSPACE,
            &cpustate, sizeof(cpustate));
 }
+
+#ifdef EXEC_ELF32
+void
+arm_netbsd_elf32_coredump_setup(struct lwp *l, void *arg)
+{
+#if defined(__ARMEB__) || defined(__ARM_EABI__) || defined(COMPAT_NETBSD32)
+       Elf_Ehdr * const eh = arg;
+#if defined(__ARM_EABI__) || defined(COMPAT_NETBSD32)
+       struct proc * const p = l->l_proc;
+
+#ifdef __ARM_EABI__
+       if (p->p_emul == &emul_netbsd) {
+               eh->e_flags |= EF_ARM_EABI_VER5;
+       }
+#elif defined(COMPAT_NETBSD32)
+       if (p->p_emul == &emul_netbsd32) {
+               eh->e_flags |= EF_ARM_EABI_VER5;
+       }
+#endif
+#endif /* __ARM_EABI__ || COMPAT_NETBSD32 */
+#ifdef __ARMEB__
+        if (CPU_IS_ARMV7_P()
+           || (CPU_IS_ARMV6_P()
+               && (armreg_sctrl_read() & CPU_CONTROL_BEND_ENABLE) == 0)) {
+               eh->e_flags |= EF_ARM_BE8;
+       }
+#endif
+#endif
+}
+#endif
diff -r 2dbba280fe2b -r 2915ebb94f47 sys/arch/arm/include/elf_machdep.h
--- a/sys/arch/arm/include/elf_machdep.h        Mon Feb 24 22:34:08 2014 +0000
+++ b/sys/arch/arm/include/elf_machdep.h        Mon Feb 24 23:54:09 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: elf_machdep.h,v 1.15 2014/01/29 19:00:08 matt Exp $    */
+/*     $NetBSD: elf_machdep.h,v 1.16 2014/02/24 23:54:09 matt Exp $    */
 
 #ifndef _ARM_ELF_MACHDEP_H_
 #define _ARM_ELF_MACHDEP_H_
@@ -147,12 +147,14 @@
 #ifdef _KERNEL
 #ifdef ELFSIZE
 #define        ELF_MD_PROBE_FUNC       ELFNAME2(arm_netbsd,probe)
+#define        ELF_MD_COREDUMP_FUNC    ELFNAME2(arm_netbsd,coredump_setup)
 #endif
 
 struct exec_package;
 
 int arm_netbsd_elf32_probe(struct lwp *, struct exec_package *, void *, char *,
        vaddr_t *);
+void arm_netbsd_elf32_coredump_setup(struct lwp *, void *);
 #endif
 
 #endif /* _ARM_ELF_MACHDEP_H_ */



Home | Main Index | Thread Index | Old Index