gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / bfd / xtensa-isa.c
index ba7408f6a15f430adb9bd46fd5461e7ffb877efd..bbd9124902437e15e4ff0820b324399078c2f4f8 100644 (file)
@@ -1,5 +1,5 @@
 /* Configurable Xtensa ISA support.
-   Copyright 2003, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2003-2020 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -180,7 +180,7 @@ xtensa_insnbuf_to_chars (xtensa_isa isa,
 /* Inward conversion from byte stream to xtensa_insnbuf.  See
    xtensa_insnbuf_to_chars for a discussion of why this is complicated
    by endianness.  */
-    
+
 void
 xtensa_insnbuf_from_chars (xtensa_isa isa,
                           xtensa_insnbuf insn,
@@ -223,7 +223,7 @@ xtensa_insnbuf_from_chars (xtensa_isa isa,
       int word_inx = byte_to_word_index (i);
       int bit_inx = byte_to_bit_index (i);
 
-      insn[word_inx] |= (*cp & 0xff) << bit_inx;
+      insn[word_inx] |= (unsigned) (*cp & 0xff) << bit_inx;
     }
 }
 
@@ -292,11 +292,12 @@ xtensa_isa_init (xtensa_isa_status *errno_p, char **error_msg_p)
       xtensa_sysreg_internal *sreg = &isa->sysregs[n];
       is_user = sreg->is_user;
 
-      isa->sysreg_table[is_user][sreg->number] = n;
+      if (sreg->number >= 0)
+       isa->sysreg_table[is_user][sreg->number] = n;
     }
 
   /* Set up the interface lookup table.  */
-  isa->interface_lookup_table = 
+  isa->interface_lookup_table =
     bfd_malloc (isa->num_interfaces * sizeof (xtensa_lookup_entry));
   CHECK_ALLOC_FOR_INIT (isa->interface_lookup_table, NULL, errno_p,
                        error_msg_p);
@@ -309,7 +310,7 @@ xtensa_isa_init (xtensa_isa_status *errno_p, char **error_msg_p)
         sizeof (xtensa_lookup_entry), xtensa_isa_name_compare);
 
   /* Set up the funcUnit lookup table.  */
-  isa->funcUnit_lookup_table = 
+  isa->funcUnit_lookup_table =
     bfd_malloc (isa->num_funcUnits * sizeof (xtensa_lookup_entry));
   CHECK_ALLOC_FOR_INIT (isa->funcUnit_lookup_table, NULL, errno_p,
                        error_msg_p);
@@ -339,43 +340,26 @@ xtensa_isa_free (xtensa_isa isa)
      the memory allocated by xtensa_isa_init and restore the xtensa_isa
      structure to its initial state.  */
 
-  if (intisa->opname_lookup_table)
-    {
-      free (intisa->opname_lookup_table);
-      intisa->opname_lookup_table = 0;
-    }
+  free (intisa->opname_lookup_table);
+  intisa->opname_lookup_table = 0;
 
-  if (intisa->state_lookup_table)
-    {
-      free (intisa->state_lookup_table);
-      intisa->state_lookup_table = 0;
-    }
+  free (intisa->state_lookup_table);
+  intisa->state_lookup_table = 0;
+
+  free (intisa->sysreg_lookup_table);
+  intisa->sysreg_lookup_table = 0;
 
-  if (intisa->sysreg_lookup_table)
-    {
-      free (intisa->sysreg_lookup_table);
-      intisa->sysreg_lookup_table = 0;
-    }
   for (n = 0; n < 2; n++)
     {
-      if (intisa->sysreg_table[n])
-       {
-         free (intisa->sysreg_table[n]);
-         intisa->sysreg_table[n] = 0;
-       }
+      free (intisa->sysreg_table[n]);
+      intisa->sysreg_table[n] = 0;
     }
 
-  if (intisa->interface_lookup_table)
-    {
-      free (intisa->interface_lookup_table);
-      intisa->interface_lookup_table = 0;
-    }
+  free (intisa->interface_lookup_table);
+  intisa->interface_lookup_table = 0;
 
-  if (intisa->funcUnit_lookup_table)
-    {
-      free (intisa->funcUnit_lookup_table);
-      intisa->funcUnit_lookup_table = 0;
-    }
+  free (intisa->funcUnit_lookup_table);
+  intisa->funcUnit_lookup_table = 0;
 }
 
 
@@ -406,7 +390,7 @@ xtensa_isa_length_from_chars (xtensa_isa isa, const unsigned char *cp)
 
 
 int
-xtensa_isa_num_pipe_stages (xtensa_isa isa) 
+xtensa_isa_num_pipe_stages (xtensa_isa isa)
 {
   xtensa_opcode opcode;
   xtensa_funcUnit_use *use;
@@ -544,7 +528,7 @@ xtensa_format_lookup (xtensa_isa isa, const char *fmtname)
       if (strcasecmp (fmtname, intisa->formats[fmt].name) == 0)
        return fmt;
     }
-  
+
   xtisa_errno = xtensa_isa_bad_format;
   sprintf (xtisa_error_msg, "format \"%s\" not recognized", fmtname);
   return XTENSA_UNDEFINED;
This page took 0.026209 seconds and 4 git commands to generate.