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