acf3ec
From 1c918c621e48f53ea69a143aabc59c8366102236 Mon Sep 17 00:00:00 2001
acf3ec
From: Hari Bathini <hbathini@linux.ibm.com>
acf3ec
Date: Mon, 4 Jul 2022 10:55:41 +0530
acf3ec
Subject: [PATCH 03/28] ppc64: fix bt for '-S' case
acf3ec
acf3ec
Passing '-S' option to 'bt' command was intended to specify the stack
acf3ec
pointer manually. But get_stack_frame() handling on ppc64 is ignoring
acf3ec
this option altogether. Fix it.
acf3ec
acf3ec
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
acf3ec
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
acf3ec
---
acf3ec
 ppc64.c | 16 ++++++++++++++++
acf3ec
 1 file changed, 16 insertions(+)
acf3ec
acf3ec
diff --git a/ppc64.c b/ppc64.c
acf3ec
index 975caa53b812..0e1d8678eef5 100644
acf3ec
--- a/ppc64.c
acf3ec
+++ b/ppc64.c
acf3ec
@@ -2330,6 +2330,22 @@ ppc64_vmcore_stack_frame(struct bt_info *bt_in, ulong *nip, ulong *ksp)
acf3ec
 
acf3ec
 	pt_regs = (struct ppc64_pt_regs *)bt_in->machdep;
acf3ec
 	if (!pt_regs || !pt_regs->gpr[1]) {
acf3ec
+		if (bt_in->hp) {
acf3ec
+			if (bt_in->hp->esp) {
acf3ec
+				*ksp = bt_in->hp->esp;
acf3ec
+				if (!bt_in->hp->eip) {
acf3ec
+					if (IS_KVADDR(*ksp)) {
acf3ec
+						readmem(*ksp+16, KVADDR, &unip, sizeof(ulong),
acf3ec
+							"Regs NIP value", FAULT_ON_ERROR);
acf3ec
+						*nip = unip;
acf3ec
+					}
acf3ec
+				} else
acf3ec
+					*nip = bt_in->hp->eip;
acf3ec
+
acf3ec
+			}
acf3ec
+			return TRUE;
acf3ec
+		}
acf3ec
+
acf3ec
 		/*
acf3ec
 		 * Not collected regs. May be the corresponding CPU not
acf3ec
 		 * responded to an IPI in case of KDump OR f/w has not
acf3ec
-- 
acf3ec
2.37.1
acf3ec