From 070d7cd51ed14b5c9997524305004de0fbabb7da Mon Sep 17 00:00:00 2001 From: Alistair Popple Date: Thu, 24 May 2018 13:42:49 +1000 Subject: libpdbg: Abstract thread status There is currently no abstraction of thread status between library and application. It just passes the hardware specific values down. There is also no interface exported in the library headers to read status. This makes it difficult to implement more advanced functionality in the application as there is no way hardware agnostic way to determine if a thread is in powersave mode or not for example. Instead introduce a hardware agnostic thread state so that we can implement more advanced functionality such as automatically stopping threads if required. Signed-off-by: Alistair Popple --- src/htm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/htm.c') diff --git a/src/htm.c b/src/htm.c index 1e65a04..945d8d6 100644 --- a/src/htm.c +++ b/src/htm.c @@ -338,9 +338,10 @@ int run_htm(int optind, int argc, char *argv[]) if (pdbg_target_status(target) == PDBG_TARGET_NONEXISTENT) continue; - if ((!(thread_status(target) & THREAD_STATUS_ACTIVE)) || - (thread_status(target) & THREAD_STATUS_STOP)) { - fprintf(stderr, "It appears powersave is on 0x%" PRIx64 "%p\n", thread_status(target), target); + if ((!(thread_status(target).active)) || + (thread_status(target).sleep_state != PDBG_THREAD_STATE_RUN)) { + fprintf(stderr, "It appears powersave is on on %s@%d\n", + pdbg_target_name(target), pdbg_target_index(target)); fprintf(stderr, "core HTM needs to run with powersave off\n"); fprintf(stderr, "Hint: put powersave=off on the kernel commandline\n"); return 0; -- cgit v1.2.1