From: Florian Krohm Date: Mon, 24 Dec 2012 00:14:31 +0000 (+0000) Subject: s390: New file s390_defs.h to contain definitions that are X-Git-Tag: svn/VALGRIND_3_9_0^2~171 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=62d27d9dade6dcf4cca1ae4eb517955270f8d06f;p=thirdparty%2Fvalgrind.git s390: New file s390_defs.h to contain definitions that are neither guest nor host specific, but just s390 specific. These definitions formerly resided in host_s390_defs.h git-svn-id: svn://svn.valgrind.org/vex/trunk@2615 --- diff --git a/VEX/priv/guest_s390_helpers.c b/VEX/priv/guest_s390_helpers.c index 930636c773..f34201df97 100644 --- a/VEX/priv/guest_s390_helpers.c +++ b/VEX/priv/guest_s390_helpers.c @@ -41,7 +41,7 @@ #include "main_globals.h" #include "guest_generic_bb_to_IR.h" #include "guest_s390_defs.h" -#include "host_s390_defs.h" /* S390_BFP_ROUND_xyzzy */ +#include "s390_defs.h" /* S390_BFP_ROUND_xyzzy */ void LibVEX_GuestS390X_initialise(VexGuestS390XState *state) diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index b948330757..ec475318db 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -41,7 +41,8 @@ #include "guest_generic_bb_to_IR.h" /* DisResult */ #include "guest_s390_defs.h" /* prototypes for this file's functions */ #include "s390_disasm.h" -#include "host_s390_defs.h" /* S390_BFP_ROUND_xyzzy */ +#include "s390_defs.h" /* S390_BFP_ROUND_xyzzy */ +#include "host_s390_defs.h" /* s390_host_has_xyzzy */ /*------------------------------------------------------------*/ diff --git a/VEX/priv/host_s390_defs.h b/VEX/priv/host_s390_defs.h index 2cfdfd9d6b..03b6b8d80a 100644 --- a/VEX/priv/host_s390_defs.h +++ b/VEX/priv/host_s390_defs.h @@ -36,6 +36,7 @@ #include "libvex_basictypes.h" /* Bool */ #include "libvex.h" /* VexArchInfo */ #include "host_generic_regs.h" /* HReg */ +#include "s390_defs.h" /* s390_cc_t */ /* --------- Registers --------- */ const HChar *s390_hreg_as_string(HReg); @@ -254,98 +255,6 @@ typedef enum { } s390_dfp_binop_t; -/* Condition code. The encoding of the enumerators matches the value of - the mask field in the various branch opcodes. */ -typedef enum { - S390_CC_NEVER= 0, - S390_CC_OVFL = 1, /* overflow */ - S390_CC_H = 2, /* A > B ; high */ - S390_CC_NLE = 3, /* not low or equal */ - S390_CC_L = 4, /* A < B ; low */ - S390_CC_NHE = 5, /* not high or equal */ - S390_CC_LH = 6, /* low or high */ - S390_CC_NE = 7, /* A != B ; not zero */ - S390_CC_E = 8, /* A == B ; zero */ - S390_CC_NLH = 9, /* not low or high */ - S390_CC_HE = 10, /* A >= B ; high or equal*/ - S390_CC_NL = 11, /* not low */ - S390_CC_LE = 12, /* A <= B ; low or equal */ - S390_CC_NH = 13, /* not high */ - S390_CC_NO = 14, /* not overflow */ - S390_CC_ALWAYS = 15 -} s390_cc_t; - - -/* BFP Rounding mode as it is encoded in the m3 field of certain - instructions (e.g. CFEBR) */ -typedef enum { - S390_BFP_ROUND_PER_FPC = 0, - S390_BFP_ROUND_NEAREST_AWAY = 1, - /* 2 is not allowed */ - S390_BFP_ROUND_PREPARE_SHORT = 3, - S390_BFP_ROUND_NEAREST_EVEN = 4, - S390_BFP_ROUND_ZERO = 5, - S390_BFP_ROUND_POSINF = 6, - S390_BFP_ROUND_NEGINF = 7 -} s390_bfp_round_t; - - -/* BFP Rounding mode as it is encoded in bits [29:31] of the FPC register. - Only rounding modes 0..3 are universally supported. Others require - additional hardware facilities. */ -typedef enum { - S390_FPC_BFP_ROUND_NEAREST_EVEN = 0, - S390_FPC_BFP_ROUND_ZERO = 1, - S390_FPC_BFP_ROUND_POSINF = 2, - S390_FPC_BFP_ROUND_NEGINF = 3, - /* 4,5,6 are not allowed */ - S390_FPC_BFP_ROUND_PREPARE_SHORT = 7 -} s390_fpc_bfp_round_t; - - -/* DFP Rounding mode as it is encoded in the m3 field of certain - instructions (e.g. CGDTR) */ -typedef enum { - S390_DFP_ROUND_PER_FPC_0 = 0, - S390_DFP_ROUND_NEAREST_TIE_AWAY_0_1 = 1, - S390_DFP_ROUND_PER_FPC_2 = 2, - S390_DFP_ROUND_PREPARE_SHORT_3 = 3, - S390_DFP_ROUND_NEAREST_EVEN_4 = 4, - S390_DFP_ROUND_ZERO_5 = 5, - S390_DFP_ROUND_POSINF_6 = 6, - S390_DFP_ROUND_NEGINF_7 = 7, - S390_DFP_ROUND_NEAREST_EVEN_8 = 8, - S390_DFP_ROUND_ZERO_9 = 9, - S390_DFP_ROUND_POSINF_10 = 10, - S390_DFP_ROUND_NEGINF_11 = 11, - S390_DFP_ROUND_NEAREST_TIE_AWAY_0_12 = 12, - S390_DFP_ROUND_NEAREST_TIE_TOWARD_0 = 13, - S390_DFP_ROUND_AWAY_0 = 14, - S390_DFP_ROUND_PREPARE_SHORT_15 = 15 -} s390_dfp_round_t; - - -/* DFP Rounding mode as it is encoded in bits [25:27] of the FPC register. */ -typedef enum { - S390_FPC_DFP_ROUND_NEAREST_EVEN = 0, - S390_FPC_DFP_ROUND_ZERO = 1, - S390_FPC_DFP_ROUND_POSINF = 2, - S390_FPC_DFP_ROUND_NEGINF = 3, - S390_FPC_DFP_ROUND_NEAREST_AWAY_0 = 4, - S390_FPC_DFP_ROUND_NEAREST_TOWARD_0 = 5, - S390_FPC_DFP_ROUND_AWAY_ZERO = 6, - S390_FPC_DFP_ROUND_PREPARE_SHORT = 7 -} s390_fpc_dfp_round_t; - - -/* Invert the condition code */ -static __inline__ s390_cc_t -s390_cc_invert(s390_cc_t cond) -{ - return S390_CC_ALWAYS - cond; -} - - /* The details of a CDAS insn. Carved out to keep the size of s390_insn low */ typedef struct { diff --git a/VEX/priv/s390_defs.h b/VEX/priv/s390_defs.h new file mode 100644 index 0000000000..df7f533809 --- /dev/null +++ b/VEX/priv/s390_defs.h @@ -0,0 +1,135 @@ +/* -*- mode: C; c-basic-offset: 3; -*- */ + +/*---------------------------------------------------------------*/ +/*--- begin s390_defs.h ---*/ +/*---------------------------------------------------------------*/ + +/* + This file is part of Valgrind, a dynamic binary instrumentation + framework. + + Copyright IBM Corp. 2010-2012 + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + The GNU General Public License is contained in the file COPYING. +*/ + +#ifndef __VEX_S390_DEFS_H +#define __VEX_S390_DEFS_H + + +/* Condition code. The encoding of the enumerators matches the value of + the mask field in the various branch opcodes. */ +typedef enum { + S390_CC_NEVER = 0, + S390_CC_OVFL = 1, /* overflow */ + S390_CC_H = 2, /* A > B ; high */ + S390_CC_NLE = 3, /* not low or equal */ + S390_CC_L = 4, /* A < B ; low */ + S390_CC_NHE = 5, /* not high or equal */ + S390_CC_LH = 6, /* low or high */ + S390_CC_NE = 7, /* A != B ; not zero */ + S390_CC_E = 8, /* A == B ; zero */ + S390_CC_NLH = 9, /* not low or high */ + S390_CC_HE = 10, /* A >= B ; high or equal*/ + S390_CC_NL = 11, /* not low */ + S390_CC_LE = 12, /* A <= B ; low or equal */ + S390_CC_NH = 13, /* not high */ + S390_CC_NO = 14, /* not overflow */ + S390_CC_ALWAYS = 15 +} s390_cc_t; + + +/* Invert the condition code */ +static __inline__ s390_cc_t +s390_cc_invert(s390_cc_t cond) +{ + return S390_CC_ALWAYS - cond; +} + + +/* BFP Rounding mode as it is encoded in the m3 field of certain + instructions (e.g. CFEBR) */ +typedef enum { + S390_BFP_ROUND_PER_FPC = 0, + S390_BFP_ROUND_NEAREST_AWAY = 1, + /* 2 is not allowed */ + S390_BFP_ROUND_PREPARE_SHORT = 3, + S390_BFP_ROUND_NEAREST_EVEN = 4, + S390_BFP_ROUND_ZERO = 5, + S390_BFP_ROUND_POSINF = 6, + S390_BFP_ROUND_NEGINF = 7 +} s390_bfp_round_t; + + +/* BFP Rounding mode as it is encoded in bits [29:31] of the FPC register. + Only rounding modes 0..3 are universally supported. Others require + additional hardware facilities. */ +typedef enum { + S390_FPC_BFP_ROUND_NEAREST_EVEN = 0, + S390_FPC_BFP_ROUND_ZERO = 1, + S390_FPC_BFP_ROUND_POSINF = 2, + S390_FPC_BFP_ROUND_NEGINF = 3, + /* 4,5,6 are not allowed */ + S390_FPC_BFP_ROUND_PREPARE_SHORT = 7 +} s390_fpc_bfp_round_t; + + +/* DFP Rounding mode as it is encoded in the m3 field of certain + instructions (e.g. CGDTR) */ +typedef enum { + S390_DFP_ROUND_PER_FPC_0 = 0, + S390_DFP_ROUND_NEAREST_TIE_AWAY_0_1 = 1, + S390_DFP_ROUND_PER_FPC_2 = 2, + S390_DFP_ROUND_PREPARE_SHORT_3 = 3, + S390_DFP_ROUND_NEAREST_EVEN_4 = 4, + S390_DFP_ROUND_ZERO_5 = 5, + S390_DFP_ROUND_POSINF_6 = 6, + S390_DFP_ROUND_NEGINF_7 = 7, + S390_DFP_ROUND_NEAREST_EVEN_8 = 8, + S390_DFP_ROUND_ZERO_9 = 9, + S390_DFP_ROUND_POSINF_10 = 10, + S390_DFP_ROUND_NEGINF_11 = 11, + S390_DFP_ROUND_NEAREST_TIE_AWAY_0_12 = 12, + S390_DFP_ROUND_NEAREST_TIE_TOWARD_0 = 13, + S390_DFP_ROUND_AWAY_0 = 14, + S390_DFP_ROUND_PREPARE_SHORT_15 = 15 +} s390_dfp_round_t; + + +/* DFP Rounding mode as it is encoded in bits [25:27] of the FPC register. */ +typedef enum { + S390_FPC_DFP_ROUND_NEAREST_EVEN = 0, + S390_FPC_DFP_ROUND_ZERO = 1, + S390_FPC_DFP_ROUND_POSINF = 2, + S390_FPC_DFP_ROUND_NEGINF = 3, + S390_FPC_DFP_ROUND_NEAREST_AWAY_0 = 4, + S390_FPC_DFP_ROUND_NEAREST_TOWARD_0 = 5, + S390_FPC_DFP_ROUND_AWAY_ZERO = 6, + S390_FPC_DFP_ROUND_PREPARE_SHORT = 7 +} s390_fpc_dfp_round_t; + + +/* The length of the longest mnemonic: locgrnhe */ +#define S390_MAX_MNEMONIC_LEN 8 + + +/*---------------------------------------------------------------*/ +/*--- end s390_defs.h ---*/ +/*---------------------------------------------------------------*/ + +#endif /* __VEX_S390_DEFS_H */ diff --git a/VEX/priv/s390_disasm.c b/VEX/priv/s390_disasm.c index 4e37a8d6fa..14f313ee62 100644 --- a/VEX/priv/s390_disasm.c +++ b/VEX/priv/s390_disasm.c @@ -34,11 +34,9 @@ #include "libvex_basictypes.h" #include "main_util.h" // vassert #include "main_globals.h" // vex_traceflags +#include "s390_defs.h" // S390_MAX_MNEMONIC_LEN #include "s390_disasm.h" -/* The length of the longest mnemonic: locgrnhe */ -#define S390_MAX_MNEMONIC_LEN 8 - /* Return the mnemonic padded with blanks to its right */ static const HChar *