Hi, Shijie
On Fri, Mar 18, 2022 at 8:00 PM <crash-utility-request@redhat.com> wrote:
Date: Fri, 18 Mar 2022 14:09:36 +0000
From: Huang Shijie <shijie@os.amperecomputing.com>
To: k-hagio-ab@nec.com
Cc: patches@amperecomputing.com, zwang@amperecomputing.com,
        darren@os.amperecomputing.com, crash-utility@redhat.com,
        lijiang@redhat.com, Huang Shijie <shijie@os.amperecomputing.com>
Subject: [Crash-utility] [PATCH 1/2] Add a new helper arm64_get_pkd
Message-ID: <20220318140937.3203595-1-shijie@os.amperecomputing.com>
Content-Type: text/plain

Use this new helper to get the pkd which
may be used in future.
 
It seems to be an orphan patch? Could you please put this one into a relevant patchset together? That may help me understand.

Thanks.
Lianbo

Also move struct proc_kcore_data to defs.h to
avoid the compiler errors.

Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
---
 defs.h    | 16 ++++++++++++++++
 netdump.c |  5 +++++
 netdump.h | 12 ------------
 3 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/defs.h b/defs.h
index 81ac049..4f06bdf 100644
--- a/defs.h
+++ b/defs.h
@@ -39,6 +39,7 @@
 #include <signal.h>
 #include <assert.h>
 #include <errno.h>
+#include <elf.h>
 #include <dirent.h>
 #include <time.h>
 #include <zlib.h>
@@ -6647,6 +6648,20 @@ int sparc64_vmalloc_addr(ulong);
 /*
  *  netdump.c
  */
+
+struct proc_kcore_data {
+       uint flags;
+       uint segments;
+       char *elf_header;
+       size_t header_size;
+       Elf64_Phdr *load64;
+       Elf64_Phdr *notes64;
+       Elf32_Phdr *load32;
+       Elf32_Phdr *notes32;
+       void *vmcoreinfo;
+       uint size_vmcoreinfo;
+};
+
 int is_netdump(char *, ulong);
 uint netdump_page_size(void);
 int read_netdump(int, void *, int, ulong, physaddr_t);
@@ -6689,6 +6704,7 @@ int kdump_phys_base(ulong *);
 int kdump_set_phys_base(ulong);
 int arm_kdump_phys_base(ulong *);
 int arm_kdump_phys_end(ulong *);
+struct proc_kcore_data *arm64_get_pkd(void);
 int is_proc_kcore(char *, ulong);
 int proc_kcore_init(FILE *, int);
 int read_proc_kcore(int, void *, int, ulong, physaddr_t);
diff --git a/netdump.c b/netdump.c
index ff273b4..3066c80 100644
--- a/netdump.c
+++ b/netdump.c
@@ -3864,6 +3864,11 @@ get_netdump_regs_arm64(struct bt_info *bt, ulong *eip, ulong *esp)
        machdep->get_stack_frame(bt, eip, esp);
 }

+struct proc_kcore_data *arm64_get_pkd(void)
+{
+       return pkd;
+}
+
 static void
 get_netdump_regs_mips(struct bt_info *bt, ulong *eip, ulong *esp)
 {
diff --git a/netdump.h b/netdump.h
index ffd60b8..119cb72 100644
--- a/netdump.h
+++ b/netdump.h
@@ -148,15 +148,3 @@ struct vmcore_data {

 #define MAX_KCORE_ELF_HEADER_SIZE (32768)

-struct proc_kcore_data {
-       uint flags;
-       uint segments;
-       char *elf_header;
-       size_t header_size;
-       Elf64_Phdr *load64;
-       Elf64_Phdr *notes64;
-       Elf32_Phdr *load32;
-       Elf32_Phdr *notes32;
-       void *vmcoreinfo;
-       uint size_vmcoreinfo;
-};
--
2.30.2