Automatic date update in version.in
[deliverable/binutils-gdb.git] / sim / bfin / dv-bfin_wdog.c
index fcda6c95fc4e2a47a4cf22bd405c4450f2daea42..850ae0618df0ba4207841746c0986baa0aa75aa7 100644 (file)
@@ -1,6 +1,6 @@
 /* Blackfin Watchdog (WDOG) model.
 
-   Copyright (C) 2010-2011 Free Software Foundation, Inc.
+   Copyright (C) 2010-2021 Free Software Foundation, Inc.
    Contributed by Analog Devices, Inc.
 
    This file is part of simulators.
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "dv-sockser.h"
@@ -61,6 +62,10 @@ bfin_wdog_io_write_buffer (struct hw *me, const void *source,
   bu32 *value32p;
   void *valuep;
 
+  /* Invalid access mode is higher priority than missing register.  */
+  if (!dv_bfin_mmr_require_16_32 (me, addr, nr_bytes, true))
+    return 0;
+
   if (nr_bytes == 4)
     value = dv_load_4 (source);
   else
@@ -111,6 +116,10 @@ bfin_wdog_io_read_buffer (struct hw *me, void *dest,
   bu32 *value32p;
   void *valuep;
 
+  /* Invalid access mode is higher priority than missing register.  */
+  if (!dv_bfin_mmr_require_16_32 (me, addr, nr_bytes, false))
+    return 0;
+
   mmr_off = addr - wdog->base;
   valuep = (void *)((unsigned long)wdog + mmr_base() + mmr_off);
   value16p = valuep;
@@ -121,7 +130,8 @@ bfin_wdog_io_read_buffer (struct hw *me, void *dest,
   switch (mmr_off)
     {
     case mmr_offset(ctl):
-      dv_bfin_mmr_require_16 (me, addr, nr_bytes, false);
+      if (!dv_bfin_mmr_require_16 (me, addr, nr_bytes, false))
+       return 0;
       dv_store_2 (dest, *value16p);
       break;
 
This page took 0.024794 seconds and 4 git commands to generate.