Module Name: src Committed By: matt Date: Mon Feb 24 23:54:10 UTC 2014
Modified Files: src/sys/arch/arm/arm: core_machdep.c src/sys/arch/arm/include: elf_machdep.h Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/arm/core_machdep.c cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/include/elf_machdep.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/arm/arm/core_machdep.c diff -u src/sys/arch/arm/arm/core_machdep.c:1.4 src/sys/arch/arm/arm/core_machdep.c:1.5 --- src/sys/arch/arm/arm/core_machdep.c:1.4 Sat Jan 4 00:10:02 2014 +++ src/sys/arch/arm/arm/core_machdep.c Mon Feb 24 23:54:10 2014 @@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: core_machdep #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 @@ cpu_coredump(struct lwp *l, struct cored 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 Index: src/sys/arch/arm/include/elf_machdep.h diff -u src/sys/arch/arm/include/elf_machdep.h:1.15 src/sys/arch/arm/include/elf_machdep.h:1.16 --- src/sys/arch/arm/include/elf_machdep.h:1.15 Wed Jan 29 19:00:08 2014 +++ src/sys/arch/arm/include/elf_machdep.h Mon Feb 24 23:54:09 2014 @@ -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_ */