1b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov/* -*- mode: C; c-basic-offset: 3; -*- */ 2b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov 3b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov/*---------------------------------------------------------------*/ 4b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov/*--- begin host_s390_disasm.h ---*/ 5b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov/*---------------------------------------------------------------*/ 6b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov 7b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov/* 8b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov This file is part of Valgrind, a dynamic binary instrumentation 9b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov framework. 10b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov 11b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov Copyright IBM Corp. 2010-2011 12b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov 13b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov This program is free software; you can redistribute it and/or 14b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov modify it under the terms of the GNU General Public License as 15b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov published by the Free Software Foundation; either version 2 of the 16b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov License, or (at your option) any later version. 17b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov 18b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov This program is distributed in the hope that it will be useful, but 19b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov WITHOUT ANY WARRANTY; without even the implied warranty of 20b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov General Public License for more details. 22b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov 23b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov You should have received a copy of the GNU General Public License 24b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov along with this program; if not, write to the Free Software 25b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 26b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov 02110-1301, USA. 27b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov 28b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov The GNU General Public License is contained in the file COPYING. 29b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov*/ 30b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov 31b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#ifndef __VEX_HOST_S390_DISASM_H 32b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#define __VEX_HOST_S390_DISASM_H 33b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov 34b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#include "libvex_basictypes.h" 35b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov 36b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov/* Macros to encode a command for s390_disasm. */ 37b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#undef P 38b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#define P(a) (S390_ARG_##a) 39b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#undef ENC1 40b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#define ENC1(a) ((P(DONE) << 4) | P(a)) 41b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#undef ENC2 42b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#define ENC2(a,b) ((P(DONE) << 8) | (P(b) << 4) | P(a)) 43b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#undef ENC3 44b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#define ENC3(a,b,c) ((P(DONE) << 12) | (P(c) << 8) | (P(b) << 4) | P(a)) 45b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#undef ENC4 46b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#define ENC4(a,b,c,d) ((P(DONE) << 16) | (P(d) << 12) | (P(c) << 8) | \ 47b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov (P(b) << 4) | P(a)) 48b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#undef ENC5 49b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#define ENC5(a,b,c,d,e) ((P(DONE) << 20) | (P(e) << 16) | (P(d) << 12) | \ 50b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov (P(c) << 8) | (P(b) << 4) | P(a)) 51b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#undef ENC6 52b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#define ENC6(a,b,c,d,e,f) ((P(DONE) << 24) | (P(f) << 20) | (P(e) << 16) | \ 53b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov (P(d) << 12) | (P(c) << 8) | (P(b) << 4) | P(a)) 54b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov 55b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov/* The different kinds of operands in an asm insn */ 56b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanovenum { 57b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_ARG_DONE = 0, 58b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_ARG_GPR = 1, 59b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_ARG_FPR = 2, 60b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_ARG_AR = 3, 61b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_ARG_INT = 4, 62b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_ARG_UINT = 5, 63b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_ARG_PCREL = 6, 64b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_ARG_SDXB = 7, 65b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_ARG_UDXB = 8, 66b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_ARG_UDLB = 9, 67b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_ARG_CABM = 10, 68b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_ARG_MNM = 11, 69b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_ARG_XMNM = 12 70b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov}; 71b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov 72b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov/* The different kinds of extended mnemonics */ 73b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanovenum { 74b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_XMNM_CAB = 0, 75b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_XMNM_BCR = 1, 76b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_XMNM_BC = 2, 77b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_XMNM_BRC = 3, 78b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_XMNM_BRCL = 4, 79b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_XMNM_LOCR = 5, 80b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_XMNM_LOCGR = 6, 81b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_XMNM_LOC = 7, 82b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_XMNM_LOCG = 8, 83b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_XMNM_STOC = 9, 84b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov S390_XMNM_STOCG = 10 85b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov}; 86b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov 87b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanovvoid s390_disasm(UInt command, ...); 88b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov 89b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov/*---------------------------------------------------------------*/ 90b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov/*--- end host_s390_disasm.h ---*/ 91b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov/*---------------------------------------------------------------*/ 92b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov 93b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#endif /* __VEX_HOST_S390_DISASM_H */ 94