Re: [Qemu-devel] [PATCH 08/35] s390: Update disassembler to the last GPLv2 from binutils.

2010-06-09 Thread Aurelien Jarno
On Fri, Jun 04, 2010 at 12:14:16PM -0700, Richard Henderson wrote:
> Signed-off-by: Richard Henderson 
> ---
>  s390-dis.c |   81 
> +---
>  1 files changed, 50 insertions(+), 31 deletions(-)

Thanks, applied.

> diff --git a/s390-dis.c b/s390-dis.c
> index 86dd84f..3d96be0 100644
> --- a/s390-dis.c
> +++ b/s390-dis.c
> @@ -1,3 +1,4 @@
> +/* opcodes/s390-dis.c revision 1.12 */
>  /* s390-dis.c -- Disassemble S390 instructions
> Copyright 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
> Contributed by Martin Schwidefsky (schwidef...@de.ibm.com).
> @@ -15,11 +16,14 @@
> 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, see .  */
> +   along with this program; if not, write to the Free Software
> +   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
> +   02110-1301, USA.  */
>  
> -#include 
> +#include "qemu-common.h"
>  #include "dis-asm.h"
>  
> +/* include/opcode/s390.h revision 1.9 */
>  /* s390.h -- Header file for S390 opcode table
> Copyright 2000, 2001, 2003 Free Software Foundation, Inc.
> Contributed by Martin Schwidefsky (schwidef...@de.ibm.com).
> @@ -37,7 +41,9 @@
> 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, see .  */
> +   along with this program; if not, write to the Free Software
> +   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
> +   02110-1301, USA.  */
>  
>  #ifndef S390_H
>  #define S390_H
> @@ -57,7 +63,8 @@ enum s390_opcode_cpu_val
>  S390_OPCODE_Z900,
>  S390_OPCODE_Z990,
>  S390_OPCODE_Z9_109,
> -S390_OPCODE_Z9_EC
> +S390_OPCODE_Z9_EC,
> +S390_OPCODE_Z10
>};
>  
>  /* The opcode table is an array of struct s390_opcode.  */
> @@ -95,12 +102,13 @@ struct s390_opcode
>  /* The table itself is sorted by major opcode number, and is otherwise
> in the order in which the disassembler should consider
> instructions.  */
> -extern const struct s390_opcode s390_opcodes[];
> -extern const ints390_num_opcodes;
> +/* QEMU: Mark these static.  */
> +static const struct s390_opcode s390_opcodes[];
> +static const ints390_num_opcodes;
>  
>  /* A opcode format table for the .insn pseudo mnemonic.  */
> -extern const struct s390_opcode s390_opformats[];
> -extern const ints390_num_opformats;
> +static const struct s390_opcode s390_opformats[];
> +static const ints390_num_opformats;
>  
>  /* Values defined for the flags field of a struct powerpc_opcode.  */
>  
> @@ -121,7 +129,7 @@ struct s390_operand
>  /* Elements in the table are retrieved by indexing with values from
> the operands field of the powerpc_opcodes table.  */
>  
> -extern const struct s390_operand s390_operands[];
> +static const struct s390_operand s390_operands[];
>  
>  /* Values defined for the flags field of a struct s390_operand.  */
>  
> @@ -164,12 +172,13 @@ extern const struct s390_operand s390_operands[];
> the instruction may be optional.  */
>  #define S390_OPERAND_OPTIONAL 0x400
>  
> - #endif /* S390_H */
> -
> +#endif /* S390_H */
>  
>  static int init_flag = 0;
>  static int opc_index[256];
> -static int current_arch_mask = 0;
> +
> +/* QEMU: We've disabled the architecture check below.  */
> +/* static int current_arch_mask = 0; */
>  
>  /* Set up index table for first opcode byte.  */
>  
> @@ -188,17 +197,21 @@ init_disasm (struct disassemble_info *info)
>(opcode[1].opcode[0] == opcode->opcode[0]))
>   opcode++;
>  }
> -//  switch (info->mach)
> -//{
> -//case bfd_mach_s390_31:
> +
> +#ifdef QEMU_DISABLE
> +  switch (info->mach)
> +{
> +case bfd_mach_s390_31:
>current_arch_mask = 1 << S390_OPCODE_ESA;
> -//  break;
> -//case bfd_mach_s390_64:
> -//  current_arch_mask = 1 << S390_OPCODE_ZARCH;
> -//  break;
> -//default:
> -//  abort ();
> -//}
> +  break;
> +case bfd_mach_s390_64:
> +  current_arch_mask = 1 << S390_OPCODE_ZARCH;
> +  break;
> +default:
> +  abort ();
> +}
> +#endif /* QEMU_DISABLE */
> +
>init_flag = 1;
>  }
>  
> @@ -297,9 +310,12 @@ print_insn_s390 (bfd_vma memaddr, struct 
> disassemble_info *info)
> const struct s390_operand *operand;
> const unsigned char *opindex;
>  
> +#ifdef QEMU_DISABLE
> /* Check architecture.  */
> if (!(opcode->modes & current_arch_mask))
>   continue;
> +#endif /* QEMU_DISABLE */
> +
> /* Check signature of the opcode.  */
> if ((buffer[1] & opcode->mask[1]) != opcode->opcode[1]
> || (buffer[2] & opcode->mask[2]) != opcode->opcode[2]
> @@ -392,6 +408,8 @@ print_insn_s390 (bfd_vma 

[Qemu-devel] [PATCH 08/35] s390: Update disassembler to the last GPLv2 from binutils.

2010-06-04 Thread Richard Henderson
Signed-off-by: Richard Henderson 
---
 s390-dis.c |   81 +---
 1 files changed, 50 insertions(+), 31 deletions(-)

diff --git a/s390-dis.c b/s390-dis.c
index 86dd84f..3d96be0 100644
--- a/s390-dis.c
+++ b/s390-dis.c
@@ -1,3 +1,4 @@
+/* opcodes/s390-dis.c revision 1.12 */
 /* s390-dis.c -- Disassemble S390 instructions
Copyright 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidef...@de.ibm.com).
@@ -15,11 +16,14 @@
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, see .  */
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+   02110-1301, USA.  */
 
-#include 
+#include "qemu-common.h"
 #include "dis-asm.h"
 
+/* include/opcode/s390.h revision 1.9 */
 /* s390.h -- Header file for S390 opcode table
Copyright 2000, 2001, 2003 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidef...@de.ibm.com).
@@ -37,7 +41,9 @@
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, see .  */
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+   02110-1301, USA.  */
 
 #ifndef S390_H
 #define S390_H
@@ -57,7 +63,8 @@ enum s390_opcode_cpu_val
 S390_OPCODE_Z900,
 S390_OPCODE_Z990,
 S390_OPCODE_Z9_109,
-S390_OPCODE_Z9_EC
+S390_OPCODE_Z9_EC,
+S390_OPCODE_Z10
   };
 
 /* The opcode table is an array of struct s390_opcode.  */
@@ -95,12 +102,13 @@ struct s390_opcode
 /* The table itself is sorted by major opcode number, and is otherwise
in the order in which the disassembler should consider
instructions.  */
-extern const struct s390_opcode s390_opcodes[];
-extern const ints390_num_opcodes;
+/* QEMU: Mark these static.  */
+static const struct s390_opcode s390_opcodes[];
+static const ints390_num_opcodes;
 
 /* A opcode format table for the .insn pseudo mnemonic.  */
-extern const struct s390_opcode s390_opformats[];
-extern const ints390_num_opformats;
+static const struct s390_opcode s390_opformats[];
+static const ints390_num_opformats;
 
 /* Values defined for the flags field of a struct powerpc_opcode.  */
 
@@ -121,7 +129,7 @@ struct s390_operand
 /* Elements in the table are retrieved by indexing with values from
the operands field of the powerpc_opcodes table.  */
 
-extern const struct s390_operand s390_operands[];
+static const struct s390_operand s390_operands[];
 
 /* Values defined for the flags field of a struct s390_operand.  */
 
@@ -164,12 +172,13 @@ extern const struct s390_operand s390_operands[];
the instruction may be optional.  */
 #define S390_OPERAND_OPTIONAL 0x400
 
-   #endif /* S390_H */
-
+#endif /* S390_H */
 
 static int init_flag = 0;
 static int opc_index[256];
-static int current_arch_mask = 0;
+
+/* QEMU: We've disabled the architecture check below.  */
+/* static int current_arch_mask = 0; */
 
 /* Set up index table for first opcode byte.  */
 
@@ -188,17 +197,21 @@ init_disasm (struct disassemble_info *info)
 (opcode[1].opcode[0] == opcode->opcode[0]))
opcode++;
 }
-//  switch (info->mach)
-//{
-//case bfd_mach_s390_31:
+
+#ifdef QEMU_DISABLE
+  switch (info->mach)
+{
+case bfd_mach_s390_31:
   current_arch_mask = 1 << S390_OPCODE_ESA;
-//  break;
-//case bfd_mach_s390_64:
-//  current_arch_mask = 1 << S390_OPCODE_ZARCH;
-//  break;
-//default:
-//  abort ();
-//}
+  break;
+case bfd_mach_s390_64:
+  current_arch_mask = 1 << S390_OPCODE_ZARCH;
+  break;
+default:
+  abort ();
+}
+#endif /* QEMU_DISABLE */
+
   init_flag = 1;
 }
 
@@ -297,9 +310,12 @@ print_insn_s390 (bfd_vma memaddr, struct disassemble_info 
*info)
  const struct s390_operand *operand;
  const unsigned char *opindex;
 
+#ifdef QEMU_DISABLE
  /* Check architecture.  */
  if (!(opcode->modes & current_arch_mask))
continue;
+#endif /* QEMU_DISABLE */
+
  /* Check signature of the opcode.  */
  if ((buffer[1] & opcode->mask[1]) != opcode->opcode[1]
  || (buffer[2] & opcode->mask[2]) != opcode->opcode[2]
@@ -392,6 +408,8 @@ print_insn_s390 (bfd_vma memaddr, struct disassemble_info 
*info)
   return 1;
 }
 }
+
+/* opcodes/s390-opc.c revision 1.16 */
 /* s390-opc.c -- S390 opcode list
Copyright 2000, 2001, 2003 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidef...@de.ibm.com).
@@ -409,9 +427,9 @@ print_insn_s390 (bfd_vma memaddr, struct disassemble_info