sim: m68hc11: warn when emul_write fails

Not sure what we should do here when this fails, so just emit a warning
for now to satisfy unused result compiler warnings.  We can see if any
users actually notice here.
This commit is contained in:
Mike Frysinger
2021-05-06 23:51:10 -04:00
parent a41513efec
commit 8852d02874
2 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2021-05-06 Mike Frysinger <vapier@gentoo.org>
* emulos.c: Include errno.h & stdio.h.
(emul_write): Print a warning when the write fails.
2021-05-04 Mike Frysinger <vapier@gentoo.org>
* dv-m68hc11.c (struct m68hc11cpu): Change attach_size to unsigned int.

View File

@ -23,6 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#endif
#ifndef WIN32
#include <errno.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/time.h>
@ -104,7 +106,8 @@ emul_write (sim_cpu *cpu)
{
uint8 val = memory_read8 (cpu, addr);
write(0, &val, 1);
if (write (0, &val, 1) != 1)
printf ("write failed: %s\n", strerror (errno));
addr ++;
size--;
}