s390.h revision 99461
199158Sdes/* s390.h -- Header file for S390 opcode table
299158Sdes   Copyright 2000, 2001 Free Software Foundation, Inc.
399158Sdes   Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
499158Sdes
599158Sdes   This file is part of BFD, the Binary File Descriptor library.
699158Sdes
799158Sdes   This program is free software; you can redistribute it and/or modify
899158Sdes   it under the terms of the GNU General Public License as published by
999158Sdes   the Free Software Foundation; either version 2 of the License, or
1099158Sdes   (at your option) any later version.
1199158Sdes
1299158Sdes   This program is distributed in the hope that it will be useful,
1399158Sdes   but WITHOUT ANY WARRANTY; without even the implied warranty of
1499158Sdes   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1599158Sdes   GNU General Public License for more details.
1699158Sdes
1799158Sdes   You should have received a copy of the GNU General Public License
1899158Sdes   along with this program; if not, write to the Free Software
1999158Sdes   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2099158Sdes   02111-1307, USA.  */
2199158Sdes
2299158Sdes#ifndef S390_H
2399158Sdes#define S390_H
2499158Sdes
2599158Sdes/* List of instruction sets variations. */
2699158Sdes
2799158Sdesenum s390_opcode_arch_val
2899158Sdes  {
2999158Sdes    S390_OPCODE_ESA = 0,
3099158Sdes    S390_OPCODE_ESAME
3199158Sdes  };
3299158Sdes
3399158Sdes/* The opcode table is an array of struct s390_opcode.  */
34107937Sdes
3599158Sdesstruct s390_opcode
3699158Sdes  {
3799158Sdes    /* The opcode name.  */
3899158Sdes    const char * name;
3999158Sdes
4099158Sdes    /* The opcode itself.  Those bits which will be filled in with
4199158Sdes       operands are zeroes.  */
4299158Sdes    unsigned char opcode[6];
4399158Sdes
4499158Sdes    /* The opcode mask.  This is used by the disassembler.  This is a
4599158Sdes       mask containing ones indicating those bits which must match the
46107937Sdes       opcode field, and zeroes indicating those bits which need not
4799158Sdes       match (and are presumably filled in by operands).  */
4899158Sdes    unsigned char mask[6];
4999158Sdes
5099158Sdes    /* The opcode length in bytes. */
5199158Sdes    int oplen;
5299158Sdes
5399158Sdes    /* An array of operand codes.  Each code is an index into the
5499158Sdes       operand table.  They appear in the order which the operands must
5599158Sdes       appear in assembly code, and are terminated by a zero.  */
5699158Sdes    unsigned char operands[6];
5799158Sdes
5899158Sdes    /* Bitmask of architectures this opcode is available for.  */
5999158Sdes    unsigned int architecture;
6099158Sdes  };
6199158Sdes
6299158Sdes/* The table itself is sorted by major opcode number, and is otherwise
6399158Sdes   in the order in which the disassembler should consider
6499158Sdes   instructions.  */
6599158Sdesextern const struct s390_opcode s390_opcodes[];
6699158Sdesextern const int                s390_num_opcodes;
6799158Sdes
6899158Sdes/* A opcode format table for the .insn pseudo mnemonic.  */
6999158Sdesextern const struct s390_opcode s390_opformats[];
7099158Sdesextern const int                s390_num_opformats;
7199158Sdes
7299158Sdes/* Values defined for the flags field of a struct powerpc_opcode.  */
7399158Sdes
7499158Sdes/* The operands table is an array of struct s390_operand.  */
7599158Sdes
7699158Sdesstruct s390_operand
7799158Sdes  {
7899158Sdes    /* The number of bits in the operand.  */
7999158Sdes    int bits;
8099158Sdes
8199158Sdes    /* How far the operand is left shifted in the instruction.  */
8299158Sdes    int shift;
8399158Sdes
8499158Sdes    /* One bit syntax flags.  */
8599158Sdes    unsigned long flags;
8699158Sdes  };
8799158Sdes
8899158Sdes/* Elements in the table are retrieved by indexing with values from
8999158Sdes   the operands field of the powerpc_opcodes table.  */
9099158Sdes
9199158Sdesextern const struct s390_operand s390_operands[];
9299158Sdes
9399158Sdes/* Values defined for the flags field of a struct s390_operand.  */
9499158Sdes
9599158Sdes/* This operand names a register.  The disassembler uses this to print
9699158Sdes   register names with a leading 'r'.  */
9799158Sdes#define S390_OPERAND_GPR 0x1
9899158Sdes
9999158Sdes/* This operand names a floating point register.  The disassembler
10099158Sdes   prints these with a leading 'f'. */
10199158Sdes#define S390_OPERAND_FPR 0x2
10299158Sdes
10399158Sdes/* This operand names an access register.  The disassembler
10499158Sdes   prints these with a leading 'a'.  */
10599158Sdes#define S390_OPERAND_AR 0x4
10699158Sdes
10799158Sdes/* This operand names a control register.  The disassembler
10899158Sdes   prints these with a leading 'c'.  */
10999158Sdes#define S390_OPERAND_CR 0x8
11099158Sdes
11199158Sdes/* This operand is a displacement.  */
11299158Sdes#define S390_OPERAND_DISP 0x10
11399158Sdes
11499158Sdes/* This operand names a base register.  */
11599158Sdes#define S390_OPERAND_BASE 0x20
11699158Sdes
11799158Sdes/* This operand names an index register, it can be skipped.  */
11899158Sdes#define S390_OPERAND_INDEX 0x40
11999158Sdes
12099158Sdes/* This operand is a relative branch displacement.  The disassembler
12199158Sdes   prints these symbolically if possible.  */
12299158Sdes#define S390_OPERAND_PCREL 0x80
12399158Sdes
12499158Sdes/* This operand takes signed values.  */
12599158Sdes#define S390_OPERAND_SIGNED 0x100
12699158Sdes
12799158Sdes/* This operand is a length.  */
12899158Sdes#define S390_OPERAND_LENGTH 0x200
12999158Sdes
13099158Sdes#endif /* S390_H */
13199158Sdes