----- Original Message -----
Hello Dave,
In future s390/s390x Linux kernels struct "_lowcore" will be renamed
to "lowcore". This patch checks which struct is defined and uses the
correct one.
Michael
Queued for crash-6.1.0.
Thanks,
Dave
---
s390.c | 33 +++++++++++++++++++++------------
s390x.c | 36 +++++++++++++++++++++++-------------
2 files changed, 44 insertions(+), 25 deletions(-)
--- a/s390.c
+++ b/s390.c
@@ -68,15 +68,24 @@ static struct line_number_hook s390_line
static int s390_is_uvaddr(ulong, struct task_context *);
/*
+ * struct lowcore name (old: "_lowcore", new: "lowcore")
+ */
+static char *lc_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",
+ if (STRUCT_EXISTS("lowcore"))
+ lc_struct = "lowcore";
+ else
+ lc_struct = "_lowcore";
+ if (MEMBER_EXISTS(lc_struct, "st_status_fixed_logout"))
+ MEMBER_OFFSET_INIT(s390_lowcore_psw_save_area, lc_struct,
"st_status_fixed_logout");
else
- MEMBER_OFFSET_INIT(s390_lowcore_psw_save_area, "_lowcore",
+ MEMBER_OFFSET_INIT(s390_lowcore_psw_save_area, lc_struct,
"psw_save_area");
}
@@ -578,9 +587,9 @@ static void s390_get_int_stack(char *sta
{
unsigned long stack_addr;
- if (!MEMBER_EXISTS("_lowcore", stack_name))
+ if (!MEMBER_EXISTS(lc_struct, stack_name))
return;
- stack_addr = ULONG(lc + MEMBER_OFFSET("_lowcore", stack_name));
+ stack_addr = ULONG(lc + MEMBER_OFFSET(lc_struct, stack_name));
if (stack_addr == 0)
return;
readmem(stack_addr - INT_STACK_SIZE, KVADDR, int_stack,
@@ -793,18 +802,18 @@ s390_print_lowcore(char* lc, struct bt_i
if (bt->flags & BT_LINE_NUMBERS)
s390_dump_line_number(tmp[1] & S390_ADDR_MASK);
}
- ptr = lc + MEMBER_OFFSET("_lowcore","cpu_timer_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "cpu_timer_save_area");
tmp[0]=UINT(ptr);
tmp[1]=UINT(ptr + S390_WORD_SIZE);
fprintf(fp," -cpu timer: %#010lx %#010lx\n", tmp[0],tmp[1]);
- ptr = lc + MEMBER_OFFSET("_lowcore","clock_comp_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "clock_comp_save_area");
tmp[0]=UINT(ptr);
tmp[1]=UINT(ptr + S390_WORD_SIZE);
fprintf(fp," -clock cmp: %#010lx %#010lx\n", tmp[0], tmp[1]);
fprintf(fp," -general registers:\n");
- ptr = lc + MEMBER_OFFSET("_lowcore","gpregs_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "gpregs_save_area");
tmp[0]=ULONG(ptr);
tmp[1]=ULONG(ptr + S390_WORD_SIZE);
tmp[2]=ULONG(ptr + 2 * S390_WORD_SIZE);
@@ -831,7 +840,7 @@ s390_print_lowcore(char* lc, struct bt_i
tmp[0], tmp[1], tmp[2], tmp[3]);
fprintf(fp," -access registers:\n");
- ptr = lc + MEMBER_OFFSET("_lowcore","access_regs_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "access_regs_save_area");
tmp[0]=ULONG(ptr);
tmp[1]=ULONG(ptr + S390_WORD_SIZE);
tmp[2]=ULONG(ptr + 2 * S390_WORD_SIZE);
@@ -858,7 +867,7 @@ s390_print_lowcore(char* lc, struct bt_i
tmp[0], tmp[1], tmp[2], tmp[3]);
fprintf(fp," -control registers:\n");
- ptr = lc + MEMBER_OFFSET("_lowcore","cregs_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "cregs_save_area");
tmp[0]=ULONG(ptr);
tmp[1]=ULONG(ptr + S390_WORD_SIZE);
tmp[2]=ULONG(ptr + 2 * S390_WORD_SIZE);
@@ -885,7 +894,7 @@ s390_print_lowcore(char* lc, struct bt_i
fprintf(fp," %#010lx %#010lx %#010lx %#010lx\n",
tmp[0], tmp[1], tmp[2], tmp[3]);
- ptr = lc + MEMBER_OFFSET("_lowcore","floating_pt_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "floating_pt_save_area");
fprintf(fp," -floating point registers 0,2,4,6:\n");
tmp[0]=ULONG(ptr);
tmp[1]=ULONG(ptr + 2 * S390_WORD_SIZE);
@@ -911,7 +920,7 @@ s390_get_stack_frame(struct bt_info *bt,
/* get the stack pointer */
if(esp){
if(s390_has_cpu(bt)){
- ksp = ULONG(lowcore + MEMBER_OFFSET("_lowcore",
+ ksp = ULONG(lowcore + MEMBER_OFFSET(lc_struct,
"gpregs_save_area") + (15 * S390_WORD_SIZE));
} else {
readmem(bt->task + OFFSET(task_struct_thread_ksp),
--- a/s390x.c
+++ b/s390x.c
@@ -117,6 +117,11 @@ static int s390x_get_kvaddr_ranges(struc
static int set_s390x_max_physmem_bits(void);
/*
+ * struct lowcore name (old: "_lowcore", new: "lowcore")
+ */
+static char *lc_struct;
+
+/*
* Read a unsigned long value from address
*/
static unsigned long readmem_ul(unsigned long addr)
@@ -132,11 +137,16 @@ static unsigned long readmem_ul(unsigned
*/
static void s390x_offsets_init(void)
{
- if (MEMBER_EXISTS("_lowcore", "st_status_fixed_logout"))
- MEMBER_OFFSET_INIT(s390_lowcore_psw_save_area, "_lowcore",
+ if (STRUCT_EXISTS("lowcore"))
+ lc_struct = "lowcore";
+ else
+ lc_struct = "_lowcore";
+
+ if (MEMBER_EXISTS(lc_struct, "st_status_fixed_logout"))
+ MEMBER_OFFSET_INIT(s390_lowcore_psw_save_area, lc_struct,
"st_status_fixed_logout");
else
- MEMBER_OFFSET_INIT(s390_lowcore_psw_save_area, "_lowcore",
+ MEMBER_OFFSET_INIT(s390_lowcore_psw_save_area, lc_struct,
"psw_save_area");
if (!STRUCT_EXISTS("stack_frame")) {
ASSIGN_OFFSET(s390_stack_frame_back_chain) = 0;
@@ -908,9 +918,9 @@ static void get_int_stack(char *stack_na
stack_addr = symbol_value("restart_stack");
stack_addr = readmem_ul(stack_addr);
} else {
- if (!MEMBER_EXISTS("_lowcore", stack_name))
+ if (!MEMBER_EXISTS(lc_struct, stack_name))
return;
- stack_addr = ULONG(lc + MEMBER_OFFSET("_lowcore", stack_name));
+ stack_addr = ULONG(lc + MEMBER_OFFSET(lc_struct, stack_name));
}
if (stack_addr == 0)
return;
@@ -1191,22 +1201,22 @@ s390x_print_lowcore(char* lc, struct bt_
if (bt->flags & BT_LINE_NUMBERS)
s390x_dump_line_number(tmp[1]);
}
- ptr = lc + MEMBER_OFFSET("_lowcore","prefixreg_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "prefixreg_save_area");
tmp[0] = UINT(ptr);
fprintf(fp," -prefix : %#010lx\n", tmp[0]);
- ptr = lc + MEMBER_OFFSET("_lowcore","cpu_timer_save_area");
+ 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]);
- ptr = lc + MEMBER_OFFSET("_lowcore","clock_comp_save_area");
+ 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]);
fprintf(fp," -general registers:\n");
- ptr = lc + MEMBER_OFFSET("_lowcore","gpregs_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "gpregs_save_area");
tmp[0]=ULONG(ptr);
tmp[1]=ULONG(ptr + S390X_WORD_SIZE);
tmp[2]=ULONG(ptr + 2 * S390X_WORD_SIZE);
@@ -1233,7 +1243,7 @@ s390x_print_lowcore(char* lc, struct bt_
fprintf(fp," %#018lx %#018lx\n", tmp[2],tmp[3]);
fprintf(fp," -access registers:\n");
- ptr = lc + MEMBER_OFFSET("_lowcore","access_regs_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "access_regs_save_area");
tmp[0]=UINT(ptr);
tmp[1]=UINT(ptr + 4);
tmp[2]=UINT(ptr + 2 * 4);
@@ -1260,7 +1270,7 @@ s390x_print_lowcore(char* lc, struct bt_
tmp[0], tmp[1], tmp[2], tmp[3]);
fprintf(fp," -control registers:\n");
- ptr = lc + MEMBER_OFFSET("_lowcore","cregs_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "cregs_save_area");
tmp[0]=ULONG(ptr);
tmp[1]=ULONG(ptr + S390X_WORD_SIZE);
tmp[2]=ULONG(ptr + 2 * S390X_WORD_SIZE);
@@ -1286,7 +1296,7 @@ s390x_print_lowcore(char* lc, struct bt_
fprintf(fp," %#018lx %#018lx\n", tmp[0],tmp[1]);
fprintf(fp," %#018lx %#018lx\n", tmp[2],tmp[3]);
- ptr = lc + MEMBER_OFFSET("_lowcore","floating_pt_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "floating_pt_save_area");
fprintf(fp," -floating point registers:\n");
tmp[0]=ULONG(ptr);
tmp[1]=ULONG(ptr + S390X_WORD_SIZE);
@@ -1330,7 +1340,7 @@ s390x_get_stack_frame(struct bt_info *bt
/* get the stack pointer */
if(esp){
if (!LIVE() && s390x_has_cpu(bt)) {
- ksp = ULONG(lowcore + MEMBER_OFFSET("_lowcore",
+ ksp = ULONG(lowcore + MEMBER_OFFSET(lc_struct,
"gpregs_save_area") + (15 * S390X_WORD_SIZE));
} else {
readmem(bt->task + OFFSET(task_struct_thread_ksp),