[Crash-utility] [PATCH] s390: Member names changed in struct _lowcore

Michael Holzheu holzheu at linux.vnet.ibm.com
Thu Feb 4 17:45:04 UTC 2010


Hi,

For s390 the "st_status_fixed_logout" member of "struct _lowcore" will be
changed to "psw_save_area" in 2.6.33. This patch will ensure that the correct
member will be used depending on the kernel version.

Best Regards

Michael
---
 defs.h  |    1 +
 s390.c  |   24 ++++++++++++++++++------
 s390x.c |   23 ++++++++++++++++++-----
 3 files changed, 37 insertions(+), 11 deletions(-)

--- a/defs.h
+++ b/defs.h
@@ -1494,6 +1494,7 @@ struct offset_table {                   
 	long attribute_owner;
 	long module_sect_attr_attr;
 	long module_sections_attrs;
+	long s390_lowcore_psw_save_area;
 };
 
 struct size_table {         /* stash of commonly-used sizes */
--- a/s390.c
+++ b/s390.c
@@ -69,6 +69,19 @@ static int s390_is_uvaddr(ulong, struct 
 
 
 /*
+ * Initialize member offsets
+ */
+static void s390_offsets_init(void)
+{
+	if (MEMBER_EXISTS("_lowcore", "st_status_fixed_logout"))
+		MEMBER_OFFSET_INIT(s390_lowcore_psw_save_area, "_lowcore",
+				   "st_status_fixed_logout");
+	else
+		MEMBER_OFFSET_INIT(s390_lowcore_psw_save_area, "_lowcore",
+				   "psw_save_area");
+}
+
+/*
  *  Do all necessary machine-specific setup here.  This is called several
  *  times during initialization.
  */
@@ -132,6 +145,7 @@ s390_init(int when)
 			machdep->hz = HZ;
 		machdep->section_size_bits = _SECTION_SIZE_BITS;
 		machdep->max_physmem_bits = _MAX_PHYSMEM_BITS;
+		s390_offsets_init();
 		break;
 
 	case POST_INIT:
@@ -632,8 +646,7 @@ s390_back_trace_cmd(struct bt_info *bt)
 			return;
 		}
 		s390_get_lowcore(cpu,lowcore);
-		psw_flags = ULONG(lowcore + MEMBER_OFFSET("_lowcore",
-			    "st_status_fixed_logout"));
+		psw_flags = ULONG(lowcore + OFFSET(s390_lowcore_psw_save_area));
 		if(psw_flags & 0x10000UL){
 				fprintf(fp,"Task runs in userspace\n");
 				s390_print_lowcore(lowcore,bt,0);
@@ -755,7 +768,7 @@ s390_print_lowcore(char* lc, struct bt_i
 	char* ptr;
 	unsigned long tmp[4];
 
-	ptr = lc + MEMBER_OFFSET("_lowcore","st_status_fixed_logout");
+	ptr = lc + OFFSET(s390_lowcore_psw_save_area);
 	tmp[0]=ULONG(ptr);
 	tmp[1]=ULONG(ptr + S390_WORD_SIZE);
 
@@ -915,9 +928,8 @@ s390_get_stack_frame(struct bt_info *bt,
 		return;
 
 	if(s390_has_cpu(bt->task) && esp){
-		*eip = ULONG(lowcore + MEMBER_OFFSET("_lowcore",
-		       "st_status_fixed_logout") + S390_WORD_SIZE)
-       		       & S390_ADDR_MASK;
+		*eip = ULONG(lowcore + OFFSET(s390_lowcore_psw_save_area) +
+		       S390_WORD_SIZE) & S390_ADDR_MASK;
 	} else {
 		if(!STRUCT_EXISTS("stack_frame")){
 			r14_offset = 56;
--- a/s390x.c
+++ b/s390x.c
@@ -65,6 +65,18 @@ static void s390x_dump_line_number(ulong
 static struct line_number_hook s390x_line_number_hooks[];
 static int s390x_is_uvaddr(ulong, struct task_context *);
 
+/*
+ * Initialize member offsets
+ */
+static void s390x_offsets_init(void)
+{
+	if (MEMBER_EXISTS("_lowcore", "st_status_fixed_logout"))
+		MEMBER_OFFSET_INIT(s390_lowcore_psw_save_area, "_lowcore",
+				   "st_status_fixed_logout");
+	else
+		MEMBER_OFFSET_INIT(s390_lowcore_psw_save_area, "_lowcore",
+				   "psw_save_area");
+}
 
 /*
  *  Do all necessary machine-specific setup here.  This is called several
@@ -130,6 +142,7 @@ s390x_init(int when)
 			machdep->hz = HZ;
 		machdep->section_size_bits = _SECTION_SIZE_BITS;
 		machdep->max_physmem_bits = _MAX_PHYSMEM_BITS;
+		s390x_offsets_init();
 		break;
 
 	case POST_INIT:
@@ -642,8 +655,8 @@ s390x_back_trace_cmd(struct bt_info *bt)
 			return;
 		}
 		s390x_get_lowcore(cpu,lowcore);
-		psw_flags = ULONG(lowcore + MEMBER_OFFSET("_lowcore",
-			    "st_status_fixed_logout"));
+		psw_flags = ULONG(lowcore + OFFSET(s390_lowcore_psw_save_area));
+
 		if(psw_flags & 0x1000000000000ULL){
 			fprintf(fp,"Task runs in userspace\n");
 			s390x_print_lowcore(lowcore,bt,0);
@@ -766,7 +779,7 @@ s390x_print_lowcore(char* lc, struct bt_
 	char* ptr;
 	unsigned long tmp[4];
 
-	ptr = lc + MEMBER_OFFSET("_lowcore","st_status_fixed_logout");
+	ptr = lc + OFFSET(s390_lowcore_psw_save_area);
 	tmp[0]=ULONG(ptr);
 	tmp[1]=ULONG(ptr + S390X_WORD_SIZE);
 
@@ -945,8 +958,8 @@ s390x_get_stack_frame(struct bt_info *bt
 		return;
 
 	if(s390x_has_cpu(bt->task) && esp){
-		*eip = ULONG(lowcore + MEMBER_OFFSET("_lowcore",
-		       "st_status_fixed_logout") + S390X_WORD_SIZE);
+		*eip = ULONG(lowcore + OFFSET(s390_lowcore_psw_save_area) +
+			     S390X_WORD_SIZE);
 	} else {
 		if(!STRUCT_EXISTS("stack_frame")){
 			r14_offset = 112;





More information about the Crash-utility mailing list