summaryrefslogtreecommitdiff
path: root/usr/src/cmd/dis/dis_main.c
diff options
context:
space:
mode:
authorJosef 'Jeff' Sipek <jeffpc@josefsipek.net>2015-11-09 15:19:23 -0500
committerDan McDonald <danmcd@omniti.com>2015-11-09 16:56:32 -0500
commit0472e113e9ad4a95dbf46a1d97075472136a1e7c (patch)
treebef9af3df82b3e4fea5b5c021cf1640c572f08bd /usr/src/cmd/dis/dis_main.c
parent0c923cf7b6cda6dcbc5df1a5974bed6386c49807 (diff)
downloadillumos-joyent-0472e113e9ad4a95dbf46a1d97075472136a1e7c.tar.gz
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>
Diffstat (limited to 'usr/src/cmd/dis/dis_main.c')
-rw-r--r--usr/src/cmd/dis/dis_main.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/usr/src/cmd/dis/dis_main.c b/usr/src/cmd/dis/dis_main.c
index 62a39de2bf..2886f412c9 100644
--- a/usr/src/cmd/dis/dis_main.c
+++ b/usr/src/cmd/dis/dis_main.c
@@ -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);