This patch adds support for reading diskdumps (generated by makedumpfile) for s390x architecture. Signed-off-by: Mahesh Salgaonkar <mahesh@xxxxxxxxxxxxxxxxxx> Signed-off-by: Michael Holzheu <holzheu@xxxxxxxxxx> --- diskdump.c | 12 ++++++++++++ s390x.c | 22 ++++++++++++++++++++++ 2 files changed, 34 insertions(+) Index: crash-5.0.9/diskdump.c =================================================================== --- crash-5.0.9.orig/diskdump.c +++ crash-5.0.9/diskdump.c @@ -253,6 +253,9 @@ restart: else if (STRNEQ(header->utsname.machine, "arm") && machine_type_mismatch(file, "ARM", NULL, 0)) goto err; + else if (STRNEQ(header->utsname.machine, "s390x") && + machine_type_mismatch(file, "S390X", NULL, 0)) + goto err; if (header->block_size != block_size) { block_size = header->block_size; @@ -349,6 +352,10 @@ restart: dd->machine_type = EM_IA_64; else if (machine_type("PPC64")) dd->machine_type = EM_PPC64; + else if (machine_type("S390")) + dd->machine_type = EM_S390; + else if (machine_type("S390X")) + dd->machine_type = EM_S390; else { error(INFO, "%s: unsupported machine type: %s\n", DISKDUMP_VALID() ? "diskdump" : "compressed kdump", @@ -778,6 +785,9 @@ get_diskdump_regs(struct bt_info *bt, ul case EM_X86_64: return get_netdump_regs_x86_64(bt, eip, esp); break; + case EM_S390: + return machdep->get_stack_frame(bt, eip, esp); + break; default: error(FATAL, "%s: unsupported machine type: %s\n", @@ -893,6 +903,8 @@ __diskdump_memory_dump(FILE *fp) fprintf(fp, "(EM_IA_64)\n"); break; case EM_PPC64: fprintf(fp, "(EM_PPC64)\n"); break; + case EM_S390: + fprintf(fp, "(EM_S390)\n"); break; default: fprintf(fp, "(unknown)\n"); break; } Index: crash-5.0.9/s390x.c =================================================================== --- crash-5.0.9.orig/s390x.c +++ crash-5.0.9/s390x.c @@ -272,6 +272,26 @@ static void s390x_elf_note_add(int elf_c } } +static void s390x_process_elf_notes(void *note_ptr, unsigned long size_note) +{ + Elf64_Nhdr *note = NULL; + size_t tot, len; + static int num_prstatus_notes = 0; + + for (tot = 0; tot < size_note; tot += len) { + note = note_ptr + tot; + + if (note->n_type == NT_PRSTATUS) + num_prstatus_notes++; + + machdep->dumpfile_init(num_prstatus_notes, note); + + len = sizeof(Elf64_Nhdr); + len = roundup(len + note->n_namesz, 4); + len = roundup(len + note->n_descsz, 4); + } +} + /* * Do all necessary machine-specific setup here. This is called several * times during initialization. @@ -283,6 +303,7 @@ s390x_init(int when) { case SETUP_ENV: machdep->dumpfile_init = s390x_elf_note_add; + machdep->process_elf_notes = s390x_process_elf_notes; break; case PRE_SYMTAB: machdep->verify_symbol = s390x_verify_symbol; @@ -399,6 +420,7 @@ s390x_dump_machdep_table(ulong arg) fprintf(fp, " init_kernel_pgd: NULL\n"); fprintf(fp, " value_to_symbol: generic_machdep_value_to_symbol()\n"); fprintf(fp, " dumpfile_init: s390x_elf_note_add()\n"); + fprintf(fp, " process_elf_notes: s390x_process_elf_notes()\n"); fprintf(fp, " line_number_hooks: s390x_line_number_hooks\n"); fprintf(fp, " last_pgd_read: %lx\n", machdep->last_pgd_read); fprintf(fp, " last_pmd_read: %lx\n", machdep->last_pmd_read); -- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility