]> git.proxmox.com Git - mirror_qemu.git/blobdiff - disas/m68k.c
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
[mirror_qemu.git] / disas / m68k.c
index c950241f79005cf5040e33bd068bcf6368b01348..0dc8aa1a3c546b59513081802809c4dddfe95ae4 100644 (file)
@@ -1,9 +1,8 @@
 /* This file is composed of several different files from the upstream
    sourceware.org CVS.  Original file boundaries marked with **** */
 
-#include <string.h>
+#include "qemu/osdep.h"
 #include <math.h>
-#include <stdio.h>
 
 #include "disas/bfd.h"
 
@@ -616,15 +615,13 @@ static const char *const reg_half_names[] =
 /* Maximum length of an instruction.  */
 #define MAXLEN 22
 
-#include <setjmp.h>
-
 struct private
 {
   /* Points to first byte not fetched.  */
   bfd_byte *max_fetched;
   bfd_byte the_buffer[MAXLEN];
   bfd_vma insn_start;
-  jmp_buf bailout;
+  sigjmp_buf bailout;
 };
 
 /* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)
@@ -644,7 +641,7 @@ fetch_data2(struct disassemble_info *info, bfd_byte *addr)
   if (status != 0)
     {
       (*info->memory_error_func) (status, start, info);
-      longjmp (priv->bailout, 1);
+      siglongjmp(priv->bailout, 1);
     }
   else
     priv->max_fetched = addr;
@@ -1626,6 +1623,7 @@ print_insn_arg (const char *d,
 
     case 'X':
       place = '8';
+      /* fall through */
     case 'Y':
     case 'Z':
     case 'W':
@@ -1679,7 +1677,7 @@ print_insn_arg (const char *d,
          (*info->fprintf_func) (info->stream, "%%sfc");
        else
          /* xgettext:c-format */
-         (*info->fprintf_func) (info->stream, _("<function code %d>"), fc);
+         (*info->fprintf_func) (info->stream, "<function code %d>", fc);
       }
       break;
 
@@ -1830,7 +1828,7 @@ match_insn_m68k (bfd_vma memaddr,
        {
          info->fprintf_func (info->stream,
                              /* xgettext:c-format */
-                             _("<internal error in opcode table: %s %s>\n"),
+                             "<internal error in opcode table: %s %s>\n",
                              best->name,  best->args);
          info->fprintf_func = save_printer;
          info->print_address_func = save_print_address;
@@ -1912,9 +1910,10 @@ print_insn_m68k (bfd_vma memaddr, disassemble_info *info)
   priv.max_fetched = priv.the_buffer;
   priv.insn_start = memaddr;
 
-  if (setjmp (priv.bailout) != 0)
-    /* Error return.  */
-    return -1;
+  if (sigsetjmp(priv.bailout, 0) != 0) {
+      /* Error return.  */
+      return -1;
+  }
 
   switch (info->mach)
     {
@@ -2019,6 +2018,20 @@ print_insn_m68k (bfd_vma memaddr, disassemble_info *info)
                }
            }
 
+          /* Don't match FPU insns with non-default coprocessor ID.  */
+          if (*d == '\0')
+            {
+              for (d = opc->args; *d; d += 2)
+                {
+                  if (d[0] == 'I')
+                    {
+                      val = fetch_arg (buffer, 'd', 3, info);
+                      if (val != 1)
+                        break;
+                    }
+                }
+            }
+
          if (*d == '\0')
            if ((val = match_insn_m68k (memaddr, info, opc, & priv)))
              return val;
@@ -4687,10 +4700,11 @@ get_field (const unsigned char *data, enum floatformat_byteorders order,
        /* This is the last byte; zero out the bits which are not part of
           this field.  */
        result |=
-         (*(data + cur_byte) & ((1 << (len - cur_bitshift)) - 1))
+         (unsigned long)(*(data + cur_byte)
+                         & ((1 << (len - cur_bitshift)) - 1))
            << cur_bitshift;
       else
-       result |= *(data + cur_byte) << cur_bitshift;
+       result |= (unsigned long)*(data + cur_byte) << cur_bitshift;
       cur_bitshift += FLOATFORMAT_CHAR_BIT;
       if (order == floatformat_little)
        ++cur_byte;
@@ -4700,10 +4714,6 @@ get_field (const unsigned char *data, enum floatformat_byteorders order,
   return result;
 }
 
-#ifndef min
-#define min(a, b) ((a) < (b) ? (a) : (b))
-#endif
-
 /* Convert from FMT to a double.
    FROM is the address of the extended float.
    Store the double in *TO.  */
@@ -4735,7 +4745,7 @@ floatformat_to_double (const struct floatformat *fmt,
       nan = 0;
       while (mant_bits_left > 0)
        {
-         mant_bits = min (mant_bits_left, 32);
+          mant_bits = MIN(mant_bits_left, 32);
 
          if (get_field (ufrom, fmt->byteorder, fmt->totalsize,
                         mant_off, mant_bits) != 0)
@@ -4795,7 +4805,7 @@ floatformat_to_double (const struct floatformat *fmt,
 
   while (mant_bits_left > 0)
     {
-      mant_bits = min (mant_bits_left, 32);
+      mant_bits = MIN(mant_bits_left, 32);
 
       mant = get_field (ufrom, fmt->byteorder, fmt->totalsize,
                         mant_off, mant_bits);