Hello Dave,

The output of CPU timer and clock comparator has always been incorrect
because:

 - We added S390X_WORD_SIZE (8) instead of 4 to get the second word
 - We did not left shift the clock comparator by 8

So fix this by getting the complete 64 bit values and by shifting the
clock comparator correctly.

Signed-off-by: Michael Holzheu <[email protected]>
---
 s390x.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

--- a/s390x.c
+++ b/s390x.c
@@ -1343,14 +1343,16 @@ s390x_print_lowcore(char* lc, struct bt_
        fprintf(fp,"  -prefix   : %#010lx\n", tmp[0]);
        
        ptr = lc + MEMBER_OFFSET(lc_struct, "cpu_timer_save_area");
-       tmp[0]=UINT(ptr);
-       tmp[1]=UINT(ptr + S390X_WORD_SIZE);
-       fprintf(fp,"  -cpu timer: %#010lx %#010lx\n", tmp[0],tmp[1]);
+       tmp[0]=ULONG(ptr);
+       fprintf(fp,"  -cpu timer: %#018lx\n", tmp[0]);
 
        ptr = lc + MEMBER_OFFSET(lc_struct, "clock_comp_save_area");
-       tmp[0]=UINT(ptr);
-       tmp[1]=UINT(ptr + S390X_WORD_SIZE);
-       fprintf(fp,"  -clock cmp: %#010lx %#010lx\n", tmp[0], tmp[1]);
+       /*
+        * Shift clock comparator by 8 because we got bit positions 0-55
+        * in byte 1 to 8. The first byte is always zero.
+        */
+       tmp[0]=ULONG(ptr) << 8;
+       fprintf(fp,"  -clock cmp: %#018lx\n", tmp[0]);
 
        fprintf(fp,"  -general registers:\n");
        ptr = lc + MEMBER_OFFSET(lc_struct, "gpregs_save_area");
[PATCH] s390x: Fix CPU timer and clock comparator output for bt -a

The output of CPU timer and clock comparator has always been incorrect
because:

 - We added S390X_WORD_SIZE (8) instead of 4 to get the second word
 - We did not left shift the clock comparator by 8

So fix this by getting the complete 64 bit values and by shifting the
clock comparator correctly.

Signed-off-by: Michael Holzheu <[email protected]>
---
 s390x.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

--- a/s390x.c
+++ b/s390x.c
@@ -1343,14 +1343,16 @@ s390x_print_lowcore(char* lc, struct bt_
 	fprintf(fp,"  -prefix   : %#010lx\n", tmp[0]);
 	
 	ptr = lc + MEMBER_OFFSET(lc_struct, "cpu_timer_save_area");
-	tmp[0]=UINT(ptr);
-	tmp[1]=UINT(ptr + S390X_WORD_SIZE);
-	fprintf(fp,"  -cpu timer: %#010lx %#010lx\n", tmp[0],tmp[1]);
+	tmp[0]=ULONG(ptr);
+	fprintf(fp,"  -cpu timer: %#018lx\n", tmp[0]);
 
 	ptr = lc + MEMBER_OFFSET(lc_struct, "clock_comp_save_area");
-	tmp[0]=UINT(ptr);
-	tmp[1]=UINT(ptr + S390X_WORD_SIZE);
-	fprintf(fp,"  -clock cmp: %#010lx %#010lx\n", tmp[0], tmp[1]);
+	/*
+	 * Shift clock comparator by 8 because we got bit positions 0-55
+	 * in byte 1 to 8. The first byte is always zero.
+	 */
+	tmp[0]=ULONG(ptr) << 8;
+	fprintf(fp,"  -clock cmp: %#018lx\n", tmp[0]);
 
 	fprintf(fp,"  -general registers:\n");
 	ptr = lc + MEMBER_OFFSET(lc_struct, "gpregs_save_area");
--
Crash-utility mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/crash-utility

Reply via email to