[RFC] Replicate src dir in build dir
[deliverable/binutils-gdb.git] / sim / frv / traps.c
index 603dc21808e87872c5c7c23a94bb3e2fbae3ee7d..84f444381776ad4e3f8fd4c8d588258a134ebfa6 100644 (file)
@@ -1,22 +1,21 @@
 /* frv trap support
-   Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999-2017 Free Software Foundation, Inc.
    Contributed by Red Hat.
 
 This file is part of the GNU simulators.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 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.,
-59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #define WANT_CPU frvbf
 #define WANT_CPU_FRVBF
@@ -30,7 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "bfd.h"
 #include "libiberty.h"
 
-CGEN_ATTR_VALUE_TYPE frv_current_fm_slot;
+CGEN_ATTR_VALUE_ENUM_TYPE frv_current_fm_slot;
 
 /* The semantic code invokes this for invalid (unrecognized) instructions.  */
 
@@ -50,7 +49,8 @@ frv_core_signal (SIM_DESC sd, SIM_CPU *current_cpu, sim_cia cia,
 {
   if (sig == sim_core_unaligned_signal)
     {
-      if (STATE_ARCHITECTURE (sd)->mach == bfd_mach_fr400)
+      if (STATE_ARCHITECTURE (sd)->mach == bfd_mach_fr400
+         || STATE_ARCHITECTURE (sd)->mach == bfd_mach_fr450)
        frv_queue_data_access_error_interrupt (current_cpu, addr);
       else
        frv_queue_mem_address_not_aligned_interrupt (current_cpu, addr);
@@ -65,7 +65,7 @@ frv_sim_engine_halt_hook (SIM_DESC sd, SIM_CPU *current_cpu, sim_cia cia)
 {
   int i;
   if (current_cpu != NULL)
-    CIA_SET (current_cpu, cia);
+    CPU_PC_SET (current_cpu, cia);
 
   /* Invalidate the insn and data caches of all cpus.  */
   for (i = 0; i < MAX_NR_PROCESSORS; ++i)
@@ -110,18 +110,6 @@ frv_itrap (SIM_CPU *current_cpu, PCADDR pc, USI base, SI offset)
   host_callback *cb = STATE_CALLBACK (sd);
   USI num = ((base + offset) & 0x7f) + 0x80;
 
-#ifdef SIM_HAVE_BREAKPOINTS
-  /* Check for breakpoints "owned" by the simulator first, regardless
-     of --environment.  */
-  if (num == TRAP_BREAKPOINT)
-    {
-      /* First try sim-break.c.  If it's a breakpoint the simulator "owns"
-        it doesn't return.  Otherwise it returns and let's us try.  */
-      sim_handle_breakpoint (sd, current_cpu, pc);
-      /* Fall through.  */
-    }
-#endif
-
   if (STATE_ENVIRONMENT (sd) == OPERATING_ENVIRONMENT)
     {
       frv_queue_software_interrupt (current_cpu, num);
@@ -191,7 +179,7 @@ frv_itrap (SIM_CPU *current_cpu, PCADDR pc, USI base, SI offset)
 
            if (bfd_find_nearest_line (STATE_PROG_BFD (sd),
                                       STATE_TEXT_SECTION (sd),
-                                      (struct symbol_cache_entry **) 0,
+                                      (struct bfd_symbol **) 0,
                                       pc - STATE_TEXT_START (sd),
                                       &pc_filename, &pc_function, &pc_linenum)
                && (pc_function || pc_filename))
@@ -293,21 +281,10 @@ frv_break (SIM_CPU *current_cpu)
   IADDR pc;
   SIM_DESC sd = CPU_STATE (current_cpu);
 
-#ifdef SIM_HAVE_BREAKPOINTS
-  /* First try sim-break.c.  If it's a breakpoint the simulator "owns"
-     it doesn't return.  Otherwise it returns and let's us try.  */
-  pc = GET_H_PC ();
-  sim_handle_breakpoint (sd, current_cpu, pc);
-  /* Fall through.  */
-#endif
-
   if (STATE_ENVIRONMENT (sd) != OPERATING_ENVIRONMENT)
     {
       /* Invalidate the insn cache because the debugger will presumably
         replace the breakpoint insn with the real one.  */
-#ifndef SIM_HAVE_BREAKPOINTS
-      pc = GET_H_PC ();
-#endif
       sim_engine_halt (sd, current_cpu, NULL, pc, sim_stopped, SIM_SIGTRAP);
     }
 
@@ -591,7 +568,13 @@ frvbf_media_cr_not_aligned (SIM_CPU *current_cpu)
   /* On some machines this generates an illegal_instruction interrupt.  */
   switch (STATE_ARCHITECTURE (sd)->mach)
     {
+      /* Note: there is a discrepancy between V2.2 of the FR400
+        instruction manual and the various FR4xx LSI specs.  The former
+        claims that unaligned registers cause an mp_exception while the
+        latter say it's an illegal_instruction.  The LSI specs appear
+        to be correct since MTT is fixed at 1.  */
     case bfd_mach_fr400:
+    case bfd_mach_fr450:
     case bfd_mach_fr550:
       frv_queue_program_interrupt (current_cpu, FRV_ILLEGAL_INSTRUCTION);
       break;
@@ -610,7 +593,9 @@ frvbf_media_acc_not_aligned (SIM_CPU *current_cpu)
   /* On some machines this generates an illegal_instruction interrupt.  */
   switch (STATE_ARCHITECTURE (sd)->mach)
     {
+      /* See comment in frvbf_cr_not_aligned().  */
     case bfd_mach_fr400:
+    case bfd_mach_fr450:
     case bfd_mach_fr550:
       frv_queue_program_interrupt (current_cpu, FRV_ILLEGAL_INSTRUCTION);
       break;
@@ -629,7 +614,9 @@ frvbf_media_register_not_aligned (SIM_CPU *current_cpu)
   /* On some machines this generates an illegal_instruction interrupt.  */
   switch (STATE_ARCHITECTURE (sd)->mach)
     {
+      /* See comment in frvbf_cr_not_aligned().  */
     case bfd_mach_fr400:
+    case bfd_mach_fr450:
     case bfd_mach_fr550:
       frv_queue_program_interrupt (current_cpu, FRV_ILLEGAL_INSTRUCTION);
       break;
This page took 0.025334 seconds and 4 git commands to generate.