[Crash-utility] [PATCHv2 1/4] netdump: Make a helper out of the PPC getregs function

Rabin Vincent rabin at rab.in
Mon Jan 12 20:47:39 UTC 2015


This can be used as-is on MIPS (and later on ARM too).  The check for
nd->num_prstatus_notes being > 1 was corrected to checking for > 0,
since we can have regs for the active task even on single-cpu systems.
---
 netdump.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/netdump.c b/netdump.c
index 14bf899..ce69310 100644
--- a/netdump.c
+++ b/netdump.c
@@ -34,6 +34,7 @@ static size_t dump_Elf32_Nhdr(Elf32_Off offset, int);
 static void dump_Elf64_Ehdr(Elf64_Ehdr *);
 static void dump_Elf64_Phdr(Elf64_Phdr *, int);
 static size_t dump_Elf64_Nhdr(Elf64_Off offset, int);
+static void get_netdump_regs_32(struct bt_info *, ulong *, ulong *);
 static void get_netdump_regs_ppc(struct bt_info *, ulong *, ulong *);
 static void get_netdump_regs_ppc64(struct bt_info *, ulong *, ulong *);
 static void get_netdump_regs_arm(struct bt_info *, ulong *, ulong *);
@@ -3203,16 +3204,13 @@ next_sysrq:
 }
 
 static void
-get_netdump_regs_ppc(struct bt_info *bt, ulong *eip, ulong *esp)
+get_netdump_regs_32(struct bt_info *bt, ulong *eip, ulong *esp)
 {
 	Elf32_Nhdr *note;
 	size_t len;
 
-	ppc_relocate_nt_prstatus_percpu(nd->nt_prstatus_percpu,
-					&nd->num_prstatus_notes);
-
 	if ((bt->task == tt->panic_task) ||
-		(is_task_active(bt->task) && nd->num_prstatus_notes > 1)) {
+		(is_task_active(bt->task) && nd->num_prstatus_notes)) {
 		/*	
 		 * Registers are saved during the dump process for the 
 		 * panic task. Whereas in kdump, regs are captured for all 
@@ -3244,6 +3242,15 @@ no_nt_prstatus_exists:
 }
 
 static void
+get_netdump_regs_ppc(struct bt_info *bt, ulong *eip, ulong *esp)
+{
+	ppc_relocate_nt_prstatus_percpu(nd->nt_prstatus_percpu,
+					&nd->num_prstatus_notes);
+
+	get_netdump_regs_32(bt, eip, esp);
+}
+
+static void
 get_netdump_regs_ppc64(struct bt_info *bt, ulong *eip, ulong *esp)
 {
 	Elf64_Nhdr *note;
-- 
2.1.4




More information about the Crash-utility mailing list