[AArch64] MTE corefile support
[binutils-gdb.git] / sim / m68hc11 / emulos.c
index 58716ae0423d146c64740abca29d55fd63f4f0e8..b66117503c1d558c742d3af52615555b1a9a6fba 100644 (file)
@@ -1,5 +1,5 @@
 /* emulos.c -- Small OS emulation
-   Copyright 1999-2017 Free Software Foundation, Inc.
+   Copyright 1999-2022 Free Software Foundation, Inc.
    Written by Stephane Carrez (stcarrez@worldnet.fr)
 
 This file is part of GDB, GAS, and the GNU binutils.
@@ -17,12 +17,17 @@ 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, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
 #ifndef WIN32
+#include <errno.h>
+#include <stdio.h>
 #include <sys/types.h>
 #include <sys/time.h>
 
@@ -102,9 +107,10 @@ emul_write (sim_cpu *cpu)
   cpu->cpu_running = 0;
   while (size)
     {
-      uint8 val = memory_read8 (cpu, addr);
-        
-      write(0, &val, 1);
+      uint8_t val = memory_read8 (cpu, addr);
+
+      if (write (0, &val, 1) != 1)
+       printf ("write failed: %s\n", strerror (errno));
       addr ++;
       size--;
     }