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

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/dis/dis_main.c
          +++ new/usr/src/cmd/dis/dis_main.c
↓ open down ↓ 17 lines elided ↑ open up ↑
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   *
  26   26   * Copyright 2011 Jason King.  All rights reserved.
  27   27   * Copyright 2012 Joshua M. Clulow <josh@sysmgr.org>
       28 + * Copyright 2015 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  28   29   */
  29   30  
  30   31  #include <ctype.h>
  31   32  #include <getopt.h>
  32   33  #include <stdio.h>
  33   34  #include <stdlib.h>
  34   35  #include <string.h>
  35   36  #include <sys/sysmacros.h>
  36   37  #include <sys/elf_SPARC.h>
  37   38  
↓ open down ↓ 499 lines elided ↑ open up ↑
 537  538  
 538  539                          g_flags |= DIS_SPARC_V9 | DIS_SPARC_V9_SGI;
 539  540                          break;
 540  541  
 541  542                  case EM_386:
 542  543                          g_flags |= DIS_X86_SIZE32;
 543  544                          break;
 544  545  
 545  546                  case EM_AMD64:
 546  547                          g_flags |= DIS_X86_SIZE64;
      548 +                        break;
      549 +
      550 +                case EM_S370:
      551 +                        g_flags |= DIS_S370;
      552 +
      553 +                        if (ehdr.e_ident[EI_CLASS] != ELFCLASS32 ||
      554 +                            ehdr.e_ident[EI_DATA] != ELFDATA2MSB) {
      555 +                                warn("invalid E_IDENT field for S370 object");
      556 +                                return;
      557 +                        }
      558 +                        break;
      559 +
      560 +                case EM_S390:
      561 +                        if (ehdr.e_ident[EI_CLASS] == ELFCLASS32) {
      562 +                                g_flags |= DIS_S390_31;
      563 +                        } else if (ehdr.e_ident[EI_CLASS] == ELFCLASS64) {
      564 +                                g_flags |= DIS_S390_64;
      565 +                        } else {
      566 +                                warn("invalid E_IDENT field for S390 object");
      567 +                                return;
      568 +                        }
      569 +
      570 +                        if (ehdr.e_ident[EI_DATA] != ELFDATA2MSB) {
      571 +                                warn("invalid E_IDENT field for S390 object");
      572 +                                return;
      573 +                        }
 547  574                          break;
 548  575  
 549  576                  default:
 550  577                          die("%s: unsupported ELF machine 0x%x", filename,
 551  578                              ehdr.e_machine);
 552  579                  }
 553  580  
 554  581                  /*
 555  582                   * If ET_REL (.o), printing immediate symbols is likely to
 556  583                   * result in garbage, as symbol lookups on unrelocated
↓ open down ↓ 178 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX