]> git.proxmox.com Git - qemu.git/blobdiff - cris-dis.c
usb-ccid: Drop unused CCIDCardInfo callback print()
[qemu.git] / cris-dis.c
index 3b09f2767648ac76374842e23cb0ee00786091ec..5fa67d9f29799d60b1ba0d9c645dcbe4bd2492b5 100644 (file)
    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.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>. */
 
+#include "qemu-common.h"
 #include "dis-asm.h"
 //#include "sysdep.h"
 #include "target-cris/opcode-cris.h"
 //#include "libiberty.h"
-\f
 
-#define FALSE 0
-#define TRUE 1
 #define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
 
 /* cris-opc.c -- Table of opcodes for the CRIS processor.
@@ -49,8 +45,7 @@ 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.  */
+along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef NULL
 #define NULL (0)
@@ -1321,7 +1316,7 @@ cris_parse_disassembler_options (disassemble_info *info,
   info->private_data = calloc (1, sizeof (struct cris_disasm_data));
   disdata = (struct cris_disasm_data *) info->private_data;
   if (disdata == NULL)
-    return FALSE;
+    return false;
 
   /* Default true.  */
   disdata->trace_case
@@ -1329,7 +1324,7 @@ cris_parse_disassembler_options (disassemble_info *info,
        || (strcmp (info->disassembler_options, "nocase") != 0));
 
   disdata->distype = distype;
-  return TRUE;
+  return true;
 }
 
 static const struct cris_spec_reg *
@@ -1401,44 +1396,32 @@ get_opcode_entry (unsigned int insn,
   /* Allocate and clear the opcode-table.  */
   if (opc_table == NULL)
     {
-      opc_table = malloc (65536 * sizeof (opc_table[0]));
-      if (opc_table == NULL)
-       return NULL;
+      opc_table = qemu_malloc (65536 * sizeof (opc_table[0]));
 
       memset (opc_table, 0, 65536 * sizeof (const struct cris_opcode *));
 
       dip_prefixes
-       = malloc (65536 * sizeof (const struct cris_opcode **));
-      if (dip_prefixes == NULL)
-       return NULL;
+       = qemu_malloc (65536 * sizeof (const struct cris_opcode **));
 
       memset (dip_prefixes, 0, 65536 * sizeof (dip_prefixes[0]));
 
       bdapq_m1_prefixes
-       = malloc (65536 * sizeof (const struct cris_opcode **));
-      if (bdapq_m1_prefixes == NULL)
-       return NULL;
+       = qemu_malloc (65536 * sizeof (const struct cris_opcode **));
 
       memset (bdapq_m1_prefixes, 0, 65536 * sizeof (bdapq_m1_prefixes[0]));
 
       bdapq_m2_prefixes
-       = malloc (65536 * sizeof (const struct cris_opcode **));
-      if (bdapq_m2_prefixes == NULL)
-       return NULL;
+       = qemu_malloc (65536 * sizeof (const struct cris_opcode **));
 
       memset (bdapq_m2_prefixes, 0, 65536 * sizeof (bdapq_m2_prefixes[0]));
 
       bdapq_m4_prefixes
-       = malloc (65536 * sizeof (const struct cris_opcode **));
-      if (bdapq_m4_prefixes == NULL)
-       return NULL;
+       = qemu_malloc (65536 * sizeof (const struct cris_opcode **));
 
       memset (bdapq_m4_prefixes, 0, 65536 * sizeof (bdapq_m4_prefixes[0]));
 
       rest_prefixes
-       = malloc (65536 * sizeof (const struct cris_opcode **));
-      if (rest_prefixes == NULL)
-       return NULL;
+       = qemu_malloc (65536 * sizeof (const struct cris_opcode **));
 
       memset (rest_prefixes, 0, 65536 * sizeof (rest_prefixes[0]));
     }
@@ -2625,12 +2608,10 @@ print_insn_cris_generic (bfd_vma memaddr,
      If we can't get any data, or we do not get enough data, we print
      the error message.  */
 
-  for (nbytes = MAX_BYTES_PER_CRIS_INSN; nbytes > 0; nbytes -= 2)
-    {
-      status = (*info->read_memory_func) (memaddr, buffer, nbytes, info);
-      if (status == 0)
-       break;
-    }
+  nbytes = info->buffer_length;
+  if (nbytes > MAX_BYTES_PER_CRIS_INSN)
+         nbytes = MAX_BYTES_PER_CRIS_INSN;
+  status = (*info->read_memory_func) (memaddr, buffer, nbytes, info);  
 
   /* If we did not get all we asked for, then clear the rest.
      Hopefully this makes a reproducible result in case of errors.  */
@@ -2786,7 +2767,6 @@ print_insn_cris_generic (bfd_vma memaddr,
 }
 
 /* Disassemble, prefixing register names with `$'.  CRIS v0..v10.  */
-#if 0
 static int
 print_insn_cris_with_register_prefix (bfd_vma vma,
                                      disassemble_info *info)
@@ -2794,9 +2774,8 @@ print_insn_cris_with_register_prefix (bfd_vma vma,
   if (info->private_data == NULL
       && !cris_parse_disassembler_options (info, cris_dis_v0_v10))
     return -1;
-  return print_insn_cris_generic (vma, info, TRUE);
+  return print_insn_cris_generic (vma, info, true);
 }
-#endif
 /* Disassemble, prefixing register names with `$'.  CRIS v32.  */
 
 static int
@@ -2806,7 +2785,7 @@ print_insn_crisv32_with_register_prefix (bfd_vma vma,
   if (info->private_data == NULL
       && !cris_parse_disassembler_options (info, cris_dis_v32))
     return -1;
-  return print_insn_cris_generic (vma, info, TRUE);
+  return print_insn_cris_generic (vma, info, true);
 }
 
 #if 0
@@ -2820,7 +2799,7 @@ print_insn_crisv10_v32_with_register_prefix (bfd_vma vma,
   if (info->private_data == NULL
       && !cris_parse_disassembler_options (info, cris_dis_common_v10_v32))
     return -1;
-  return print_insn_cris_generic (vma, info, TRUE);
+  return print_insn_cris_generic (vma, info, true);
 }
 
 /* Disassemble, no prefixes on register names.  CRIS v0..v10.  */
@@ -2832,7 +2811,7 @@ print_insn_cris_without_register_prefix (bfd_vma vma,
   if (info->private_data == NULL
       && !cris_parse_disassembler_options (info, cris_dis_v0_v10))
     return -1;
-  return print_insn_cris_generic (vma, info, FALSE);
+  return print_insn_cris_generic (vma, info, false);
 }
 
 /* Disassemble, no prefixes on register names.  CRIS v32.  */
@@ -2844,7 +2823,7 @@ print_insn_crisv32_without_register_prefix (bfd_vma vma,
   if (info->private_data == NULL
       && !cris_parse_disassembler_options (info, cris_dis_v32))
     return -1;
-  return print_insn_cris_generic (vma, info, FALSE);
+  return print_insn_cris_generic (vma, info, false);
 }
 
 /* Disassemble, no prefixes on register names.
@@ -2857,10 +2836,17 @@ print_insn_crisv10_v32_without_register_prefix (bfd_vma vma,
   if (info->private_data == NULL
       && !cris_parse_disassembler_options (info, cris_dis_common_v10_v32))
     return -1;
-  return print_insn_cris_generic (vma, info, FALSE);
+  return print_insn_cris_generic (vma, info, false);
 }
 #endif
 
+int
+print_insn_crisv10 (bfd_vma vma,
+                   disassemble_info *info)
+{
+  return print_insn_cris_with_register_prefix(vma, info);
+}
+
 int
 print_insn_crisv32 (bfd_vma vma,
                    disassemble_info *info)