Permalink
Browse files

6066 dis: support for System/370, System/390, and z/Architecture ELF …

…bins

Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Dan McDonald <danmcd@omniti.com>
  • Loading branch information...
jeffpc authored and Dan McDonald committed Nov 9, 2015
1 parent 0c923cf commit 0472e113e9ad4a95dbf46a1d97075472136a1e7c
@@ -25,6 +25,7 @@
*
* 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>
@@ -546,6 +547,38 @@ dis_file(const char *filename)
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:
/*
* Both 390 and z/Architecture use EM_S390, the only
* differences is the class: ELFCLASS32 for plain
* old s390 and ELFCLASS64 for z/Architecture (aka.
* s390x).
*/
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);
@@ -57,12 +57,14 @@ SRCS_i386= $(COMDIR)/dis_i386.c \
SRCS_sparc= $(COMDIR)/dis_sparc.c \
$(COMDIR)/dis_sparc_fmt.c \
$(COMDIR)/dis_sparc_instr.c
SRCS_s390x= $(COMDIR)/dis_s390x.c
OBJECTS_i386= dis_i386.o \
dis_tables.o
OBJECTS_sparc= dis_sparc.o \
dis_sparc_fmt.o \
dis_sparc_instr.o
OBJECTS_s390x= dis_s390x.o
#
# We build the regular shared library with support for all architectures.
@@ -71,7 +73,8 @@ OBJECTS_sparc= dis_sparc.o \
#
OBJECTS_library= $(OBJECTS_common) \
$(OBJECTS_i386) \
$(OBJECTS_sparc)
$(OBJECTS_sparc) \
$(OBJECTS_s390x)
OBJECTS_standalone= $(OBJECTS_common) \
$(OBJECTS_$(MACH))
OBJECTS= $(OBJECTS_$(CURTYPE))
@@ -80,7 +83,8 @@ include $(SRC)/lib/Makefile.lib
SRCS_library= $(SRCS_common) \
$(SRCS_i386) \
$(SRCS_sparc)
$(SRCS_sparc) \
$(SRCS_s390x)
SRCS_standalone= $(SRCS_common) \
$(SRCS_$(MACH))
SRCS= $(SRCS_$(CURTYPE))
Oops, something went wrong.

0 comments on commit 0472e11

Please sign in to comment.