fun, and definign VAILDATE will define SWI 1 to enter SVC mode, and SWI
0x11 to halt the emulator. */
-#include "config.h"
+/* This must come before any other includes. */
+#include "defs.h"
+
#include "ansidecl.h"
+#include "libiberty.h"
#include <time.h>
#include <errno.h>
#include <limits.h>
#include <string.h>
-#include "targ-vals.h"
-
-#ifndef TARGET_O_BINARY
-#define TARGET_O_BINARY 0
-#endif
-
-#ifdef HAVE_UNISTD_H
#include <unistd.h> /* For SEEK_SET etc. */
-#endif
#include "armdefs.h"
#include "armos.h"
/* For RDIError_BreakpointReached. */
#include "dbg_rdi.h"
-#include "gdb/callback.h"
+#include "sim/callback.h"
extern host_callback *sim_callback;
extern unsigned ARMul_OSInit (ARMul_State *);
return TRUE;
}
-static int translate_open_mode[] =
+/* These are libgloss defines, but seem to be common across all supported ARM
+ targets at the moment. These should get moved to the callback open_map. */
+#define TARGET_O_BINARY 0
+#define TARGET_O_APPEND 0x8
+#define TARGET_O_CREAT 0x200
+#define TARGET_O_RDONLY 0x0
+#define TARGET_O_RDWR 0x2
+#define TARGET_O_TRUNC 0x400
+#define TARGET_O_WRONLY 0x1
+
+static const int translate_open_mode[] =
{
TARGET_O_RDONLY, /* "r" */
TARGET_O_RDONLY + TARGET_O_BINARY, /* "rb" */
return;
/* Now we need to decode the Demon open mode. */
- flags = translate_open_mode[SWIflags];
+ if (SWIflags >= ARRAY_SIZE (translate_open_mode))
+ flags = 0;
+ else
+ flags = translate_open_mode[SWIflags];
/* Filename ":tt" is special: it denotes stdin/out. */
if (strcmp (buf, ":tt") == 0)
{
sim_callback->printf_filtered
(sim_callback,
- "sim: Unable to read 0x%ulx bytes - out of memory\n",
- len);
+ "sim: Unable to read 0x%lx bytes - out of memory\n",
+ (long)len);
return;
}
case SWI_Time:
if (swi_mask & SWI_MASK_DEMON)
{
- state->Reg[0] = (ARMword) sim_callback->time (sim_callback, NULL);
+ state->Reg[0] = (ARMword) sim_callback->time (sim_callback);
OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
}
else
break;
case AngelSWI_Reason_Time:
- state->Reg[0] = (ARMword) sim_callback->time (sim_callback, NULL);
+ state->Reg[0] = (ARMword) sim_callback->time (sim_callback);
OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
break;
break;
case 17: /* Utime. */
- state->Reg[0] = state->Reg[1] = (ARMword) sim_callback->time (sim_callback, NULL);
+ state->Reg[0] = state->Reg[1] = (ARMword) sim_callback->time (sim_callback);
OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
break;