Print this page
6066 dis: support for System/370, System/390, and z/Architecture ELF bins

*** 23,32 **** --- 23,33 ---- * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * Copyright 2011 Jason King. All rights reserved. * Copyright 2012 Joshua M. Clulow <josh@sysmgr.org> + * Copyright 2015 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> */ #include <ctype.h> #include <getopt.h> #include <stdio.h>
*** 544,553 **** --- 545,580 ---- case EM_AMD64: g_flags |= DIS_X86_SIZE64; break; + case EM_S370: + g_flags |= DIS_S370; + + if (ehdr.e_ident[EI_CLASS] != ELFCLASS32 || + ehdr.e_ident[EI_DATA] != ELFDATA2MSB) { + warn("invalid E_IDENT field for S370 object"); + return; + } + break; + + case EM_S390: + if (ehdr.e_ident[EI_CLASS] == ELFCLASS32) { + g_flags |= DIS_S390_31; + } else if (ehdr.e_ident[EI_CLASS] == ELFCLASS64) { + g_flags |= DIS_S390_64; + } else { + warn("invalid E_IDENT field for S390 object"); + return; + } + + if (ehdr.e_ident[EI_DATA] != ELFDATA2MSB) { + warn("invalid E_IDENT field for S390 object"); + return; + } + break; + default: die("%s: unsupported ELF machine 0x%x", filename, ehdr.e_machine); }