[Pdbg] [PATCH v3 08/13] libpdbg/p9chip: update thread status on stop, start, sreset

Nicholas Piggin npiggin at gmail.com
Wed May 2 16:28:03 AEST 2018


Update thread->status when we expect it to change. This becomes more
important if we chain multiple operations together.

Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
 libpdbg/p9chip.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c
index 3cc3dcb..3a68ea8 100644
--- a/libpdbg/p9chip.c
+++ b/libpdbg/p9chip.c
@@ -127,6 +127,8 @@ static int p9_thread_start(struct thread *thread)
 		thread_write(thread, P9_DIRECT_CONTROL, PPC_BIT(6 + 8*thread->id));
 	}
 
+	thread->status = p9_get_thread_status(thread);
+
 	return 0;
 }
 
@@ -142,6 +144,7 @@ static int p9_thread_stop(struct thread *thread)
 			break;
 		}
 	}
+	thread->status = p9_get_thread_status(thread);
 
 	return 0;
 }
@@ -149,11 +152,13 @@ static int p9_thread_stop(struct thread *thread)
 static int p9_thread_sreset(struct thread *thread)
 {
 	/* Can only sreset if a thread is inactive */
-	if (!(p9_get_thread_status(thread) & THREAD_STATUS_QUIESCE))
+	if (!(thread->status & THREAD_STATUS_QUIESCE))
 		return 1;
 
 	thread_write(thread, P9_DIRECT_CONTROL, PPC_BIT(4 + 8*thread->id));
 
+	thread->status = p9_get_thread_status(thread);
+
 	return 0;
 }
 
-- 
2.17.0



More information about the Pdbg mailing list