This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 90517b9f11 coredump:support arm64 coredump
90517b9f11 is described below

commit 90517b9f11d66de80a5df828d80ef0047fc984d8
Author: anjiahao <[email protected]>
AuthorDate: Thu Nov 9 19:16:45 2023 +0800

    coredump:support arm64 coredump
    
    Signed-off-by: anjiahao <[email protected]>
---
 arch/arm64/Kconfig              |  1 +
 arch/arm64/include/elf.h        | 20 ++++++++++++++++++++
 binfmt/libelf/libelf_coredump.c |  8 ++++----
 3 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index e5eff102ea..a37e03aa69 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -71,6 +71,7 @@ config ARCH_CHIP_GOLDFISH
        select ARCH_HAVE_POWEROFF
        select ARCH_HAVE_RESET
        select ARCH_NEED_ADDRENV_MAPPING
+       select LIBC_ARCH_ELF_64BIT if LIBC_ARCH_ELF
        ---help---
                Android GoldFish platform for NuttX (ARMv8a),
                based on ARM virt board
diff --git a/arch/arm64/include/elf.h b/arch/arm64/include/elf.h
index 7a7b9ea231..2892849739 100644
--- a/arch/arm64/include/elf.h
+++ b/arch/arm64/include/elf.h
@@ -25,6 +25,12 @@
 #ifndef __ARCH_ARM64_INCLUDE_ELF_H
 #define __ARCH_ARM64_INCLUDE_ELF_H
 
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <stdint.h>
+
 /****************************************************************************
  * Pre-processor Prototypes
  ****************************************************************************/
@@ -206,10 +212,24 @@
 #define PT_AARCH64_ARCHEXT  0x70000000  /* Reserved for architecture 
compatibility information */
 #define PT_AARCH64_UNWIND   0x70000001  /* Reserved for exception unwinding 
tables */
 
+#define EF_FLAG             0
+
 /****************************************************************************
  * Public Types
  ****************************************************************************/
 
+typedef unsigned long elf_greg_t;
+struct user_pt_regs
+{
+  uint64_t regs[31];
+  uint64_t sp;
+  uint64_t pc;
+  uint64_t pstate;
+};
+
+#define ELF_NGREG (sizeof(struct user_pt_regs) / sizeof(elf_greg_t))
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+
 /****************************************************************************
  * Public Data
  ****************************************************************************/
diff --git a/binfmt/libelf/libelf_coredump.c b/binfmt/libelf/libelf_coredump.c
index 006d43a6b0..004d33fee1 100644
--- a/binfmt/libelf/libelf_coredump.c
+++ b/binfmt/libelf/libelf_coredump.c
@@ -231,7 +231,7 @@ static void elf_emit_tcb_note(FAR struct elf_dumpinfo_s 
*cinfo,
   char name[ROUNDUP(CONFIG_TASK_NAME_SIZE, 8)];
   elf_prstatus_t status;
   elf_prpsinfo_t info;
-  FAR uint32_t *regs;
+  FAR uintptr_t *regs;
   Elf_Nhdr nhdr;
   int i;
 
@@ -267,17 +267,17 @@ static void elf_emit_tcb_note(FAR struct elf_dumpinfo_s 
*cinfo,
     {
       if (up_interrupt_context())
         {
-          regs = (FAR uint32_t *)CURRENT_REGS;
+          regs = (FAR uintptr_t *)CURRENT_REGS;
         }
       else
         {
           up_saveusercontext(g_running_regs);
-          regs = (FAR uint32_t *)g_running_regs;
+          regs = (FAR uintptr_t *)g_running_regs;
         }
     }
   else
     {
-      regs = tcb->xcp.regs;
+      regs = (uintptr_t *)tcb->xcp.regs;
     }
 
   if (regs != NULL)

Reply via email to