diff mbox series

[4/4] libdbg: Use the correct thread state function

Message ID 20201110045217.137133-5-amitay@ozlabs.org
State Accepted
Headers show
Series Implement thread status for p10 | expand

Checks

Context Check Description
snowpatch_ozlabs/build-multiarch success Test build-multiarch on branch master
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (bdec2f8c512ff4a70eaadcb01a7494b4cb5e13e5)

Commit Message

Amitay Isaacs Nov. 10, 2020, 4:52 a.m. UTC
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
---
 libpdbg/sbefifo.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libpdbg/sbefifo.c b/libpdbg/sbefifo.c
index bfe25cf..cfc8488 100644
--- a/libpdbg/sbefifo.c
+++ b/libpdbg/sbefifo.c
@@ -370,7 +370,16 @@  static int sbefifo_thread_op(struct thread *thread, uint32_t oper)
 
 static struct thread_state sbefifo_thread_state(struct thread *thread)
 {
-	return p9_thread_state(thread);
+	struct pdbg_target *pib = pdbg_target_require_parent("pib", &thread->target);
+	struct sbefifo *sbefifo = pib_to_sbefifo(pib);
+	struct sbefifo_context *sctx = sbefifo->get_sbefifo_context(sbefifo);
+
+	if (sbefifo_proc(sctx) == SBEFIFO_PROC_P9)
+		return p9_thread_state(thread);
+	else if (sbefifo_proc(sctx) == SBEFIFO_PROC_P10)
+		return p10_thread_state(thread);
+	else
+		abort();
 }
 
 static int sbefifo_thread_start(struct thread *thread)