In regs_dump__printf() it use for_each_set_bit() for bit ops by
casting a (u64 *) to a (unsigned long *), this works for 64 bits
machine, but will fail on 32 bits ones.

Fix it by using the raw bit comparing method.

Signed-off-by: Feng Tang <[email protected]>
---
 tools/perf/util/session.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index f7bb7ae..afcea6c 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -904,11 +904,10 @@ static void regs_dump__printf(u64 mask, u64 *regs)
 {
        unsigned rid, i = 0;
 
-       for_each_set_bit(rid, (unsigned long *) &mask, sizeof(mask) * 8) {
-               u64 val = regs[i++];
-
-               printf(".... %-5s 0x%" PRIx64 "\n",
-                      perf_reg_name(rid), val);
+       for (rid = 0; rid < 64; rid++) {
+               if (mask & (1 << rid))
+                       printf(".... %-5s 0x%" PRIx64 "\n",
+                               perf_reg_name(rid), regs[i++]);
        }
 }
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to