]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Cleanups to compile under FreeBSD
authorAndrew Cagney <cagney@redhat.com>
Thu, 17 Apr 1997 06:05:19 +0000 (06:05 +0000)
committerAndrew Cagney <cagney@redhat.com>
Thu, 17 Apr 1997 06:05:19 +0000 (06:05 +0000)
12 files changed:
include/ChangeLog
include/remote-sim.h
sim/arm/ChangeLog
sim/arm/wrapper.c
sim/d10v/ChangeLog
sim/d10v/simops.c
sim/mips/ChangeLog
sim/mips/interp.c
sim/mn10300/ChangeLog
sim/mn10300/simops.c
sim/v850/ChangeLog
sim/v850/simops.c

index 294f4ea38a7f99a53f47d3e10583282b18677147..890c8850a69d71ab1078c4b3c0b72424410a656b 100644 (file)
@@ -1,3 +1,13 @@
+Wed Apr  2 17:09:12 1997  Andrew Cagney  <cagney@kremvax.cygnus.com>
+
+       * remote-sim.h (sim_trace, sim_size): Make these global.  They
+       will go away shortly.
+
+Wed Apr  2 15:23:49 1997  Doug Evans  <dje@canuck.cygnus.com>
+
+       * remote-sim.h (SIM_OPEN_KIND, SIM_RC): New enums.
+       (sim_open): New argument `kind'.
+
 Wed Apr  2 14:45:51 1997  Ian Lance Taylor  <ian@cygnus.com>
 
        * COPYING: Update FSF address.
index 77685d5eef3231b55394f3edd45b4649da9665f5..a18b1efd955c4f59a1573809439b6da3342dc2eb 100644 (file)
@@ -141,4 +141,12 @@ void sim_do_command PARAMS ((SIM_DESC sd, char *cmd));
 
 void sim_set_callbacks PARAMS ((SIM_DESC sd, struct host_callback_struct *));
 
+
+/* NOTE: sim_size() and sim_trace() are going away */
+
+void sim_size PARAMS ((int i));
+
+int sim_trace PARAMS ((SIM_DESC sd));
+
+
 #endif /* !defined (REMOTE_SIM_H) */
index eda154d8d317717516deb9ca244a76cd6d786c68..41f05a19e30ba588b5421bb684e085874e4b4cbc 100644 (file)
@@ -1,3 +1,12 @@
+Thu Apr 17 11:48:25 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * wrapper.c (sim_trace): Update so that it matches prototype.
+
+Mon Apr  7 15:45:02 1997  Andrew Cagney  <cagney@kremvax.cygnus.com>
+
+       * configure: Regenerated to track ../common/aclocal.m4 changes.
+       * config.in: Ditto.
+
 Mon Apr  7 12:01:17 1997  Andrew Cagney  <cagney@kremvax.cygnus.com>
 
        * Makefile.in (armemu32.o): Replace $< with autoconf recommended
index fdbff8647d1927b3286f0324ecfeb0cace31fdc3..2a582cdaad3217168c04992ccd7b0d2d9974661d 100644 (file)
@@ -1,7 +1,7 @@
 /* run front end support for arm
-   Copyright (C) 1995 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
 
-This file is part of ARM SIM
+This file is part of ARM SIM.
 
 GNU CC is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -14,68 +14,95 @@ 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 GNU CC; see the file COPYING.  If not, write to
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA.  */
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+/* This file provides the interface between the simulator and run.c and gdb
+   (when the simulator is linked with gdb).
+   All simulator interaction should go through this file.  */
 
 #include <stdio.h>
 #include <stdarg.h>
-#include <armdefs.h>
 #include <bfd.h>
 #include <signal.h>
 #include "callback.h"
 #include "remote-sim.h"
+#include "armdefs.h"
+#include "armemu.h"
+#include "dbg_rdi.h"
+
+host_callback *sim_callback;
+
 static struct ARMul_State *state;
 
+/* Memory size in bytes.  */
+static int mem_size = (1 << 21);
+
+/* Non-zero to display start up banner, and maybe other things.  */
+static int verbosity;
+
 static void 
 init ()
 {
   static int done;
+
   if (!done)
     {
       ARMul_EmulateInit();
       state = ARMul_NewState ();
-      ARMul_MemoryInit(state, 1<<21);
+      ARMul_MemoryInit(state, mem_size);
       ARMul_OSInit(state);
       ARMul_CoProInit(state); 
+      state->verbose = verbosity;
       done = 1;
     }
-
-}
-void 
-ARMul_ConsolePrint (ARMul_State * state, const char *format,...)
-{
-  va_list ap;
-  va_start (ap, format);
-  vprintf (format, ap);
-  va_end (ap);
 }
 
-ARMword 
-ARMul_Debug (ARMul_State * state, ARMword pc, ARMword instr)
-{
+/* Set verbosity level of simulator.
+   This is not intended to produce detailed tracing or debugging information.
+   Just summaries.  */
+/* FIXME: common/run.c doesn't do this yet.  */
 
+void
+sim_set_verbose (v)
+     int v;
+{
+  verbosity = v;
 }
 
+/* Set the memory size to SIZE bytes.
+   Must be called before initializing simulator.  */   
+/* FIXME: Rename to sim_set_mem_size.  */
+
 void 
 sim_size (size)
      int size;
 {
-  init ();
-  ARMul_MemoryInit (state, 1 << size);
+  mem_size = size;
 }
 
-
 void 
-sim_set_profile ()
+ARMul_ConsolePrint (ARMul_State * state, const char *format,...)
 {
+  va_list ap;
+
+  if (state->verbose)
+    {
+      va_start (ap, format);
+      vprintf (format, ap);
+      va_end (ap);
+    }
 }
-void 
-sim_set_profile_size ()
+
+ARMword 
+ARMul_Debug (ARMul_State * state, ARMword pc, ARMword instr)
 {
+
 }
 
 int
-sim_write (addr, buffer, size)
+sim_write (sd, addr, buffer, size)
+     SIM_DESC sd;
      SIM_ADDR addr;
      unsigned char *buffer;
      int size;
@@ -90,7 +117,8 @@ sim_write (addr, buffer, size)
 }
 
 int
-sim_read (addr, buffer, size)
+sim_read (sd, addr, buffer, size)
+     SIM_DESC sd;
      SIM_ADDR addr;
      unsigned char *buffer;
      int size;
@@ -104,29 +132,38 @@ sim_read (addr, buffer, size)
   return size;
 }
 
-void 
-sim_trace ()
+int
+sim_trace (sd)
+     SIM_DESC sd;
 {
+  (*sim_callback->printf_filtered) (sim_callback, "This simulator does not support tracing\n");
+  return 1;
 }
 
-static int rc;
 void
-sim_resume (step, siggnal)
+sim_resume (sd, step, siggnal)
+     SIM_DESC sd;
      int step, siggnal;
 {
+  state->EndCondition = 0;
+
   if (step)
     {
-      rc = SIGTRAP;
-      state->Reg[15] =       ARMul_DoInstr (state);
+      state->Reg[15] = ARMul_DoInstr (state);
+      if (state->EndCondition == 0)
+       state->EndCondition = RDIError_BreakpointReached;
     }
   else
     {
-      state->Reg[15] =       ARMul_DoProg (state);
+      state->Reg[15] = ARMul_DoProg (state);
     }
+
+  FLUSHPIPE;
 }
 
 void
-sim_create_inferior (start_address, argv, env)
+sim_create_inferior (sd, start_address, argv, env)
+     SIM_DESC sd;
      SIM_ADDR start_address;
      char **argv;
      char **env;
@@ -135,13 +172,14 @@ sim_create_inferior (start_address, argv, env)
 }
 
 void
-sim_info (verbose)
+sim_info (sd, verbose)
+     SIM_DESC sd;
      int verbose;
 {
 }
 
 
-int 
+static int 
 frommem (state, memory)
      struct ARMul_State *state;
      unsigned char *memory;
@@ -163,7 +201,7 @@ frommem (state, memory)
 }
 
 
-void 
+static void
 tomem (state, memory,  val)
      struct ARMul_State *state;
      unsigned char *memory;
@@ -186,7 +224,8 @@ tomem (state, memory,  val)
 }
 
 void
-sim_store_register (rn, memory)
+sim_store_register (sd, rn, memory)
+     SIM_DESC sd;
      int rn;
      unsigned char *memory;
 {
@@ -195,7 +234,8 @@ sim_store_register (rn, memory)
 }
 
 void
-sim_fetch_register (rn, memory)
+sim_fetch_register (sd, rn, memory)
+     SIM_DESC sd;
      int rn;
      unsigned char *memory;
 {
@@ -206,22 +246,27 @@ sim_fetch_register (rn, memory)
 
 
 
-void
-sim_open (name)
-     char *name;
+SIM_DESC
+sim_open (kind, argv)
+     SIM_OPEN_KIND kind;
+     char **argv;
 {
-  /* nothing to do */
+  /*  (*sim_callback->error) (sim_callback, "testing 1 2 3\n");*/
+  /* nothing to do, fudge our descriptor */
+  return (SIM_DESC) 1;
 }
 
 void
-sim_close (quitting)
+sim_close (sd, quitting)
+     SIM_DESC sd;
      int quitting;
 {
   /* nothing to do */
 }
 
 int
-sim_load (prog, from_tty)
+sim_load (sd, prog, from_tty)
+     SIM_DESC sd;
      char *prog;
      int from_tty;
 {
@@ -230,30 +275,46 @@ sim_load (prog, from_tty)
 }
 
 void
-sim_stop_reason (reason, sigrc)
+sim_stop_reason (sd, reason, sigrc)
+     SIM_DESC sd;
      enum sim_stop *reason;
      int *sigrc;
 {
-  *reason = sim_stopped;
-  *sigrc = rc;
+  if (state->EndCondition == 0)
+    {
+      *reason = sim_exited;
+      *sigrc = state->Reg[0] & 255;
+    }
+  else
+    {
+      *reason = sim_stopped;
+      if (state->EndCondition == RDIError_BreakpointReached)
+       *sigrc = SIGTRAP;
+      else
+       *sigrc = 0;
+    }
 }
+
 void
-sim_kill ()
+sim_kill (sd)
+     SIM_DESC sd;
 {
   /* nothing to do */
 }
 
 void
-sim_do_command (cmd)
+sim_do_command (sd, cmd)
+     SIM_DESC sd;
      char *cmd;
 {
-  printf_filtered ("This simulator does not accept any commands.\n");
+  (*sim_callback->printf_filtered) (sim_callback, "This simulator does not accept any commands.\n");
 }
 
 
 void
-sim_set_callbacks (ptr)
-struct host_callback_struct *ptr;
+sim_set_callbacks (sd, ptr)
+     SIM_DESC sd;
+     host_callback *ptr;
 {
-
+  sim_callback = ptr;
 }
index b6eeed6837c2a4a1233a6744794ed9296f2adb87..0cd9cc40b9cae7eba73928edf0124a6e6bb529dc 100644 (file)
@@ -1,3 +1,13 @@
+Wed Apr 16 16:12:03 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * simops.c (OP_5F00): Only provide system calls SYS_execv,
+       SYS_wait, SYS_wait, SYS_utime, SYS_time if defined by the host.
+       
+Mon Apr  7 15:45:02 1997  Andrew Cagney  <cagney@kremvax.cygnus.com>
+
+       * configure: Regenerated to track ../common/aclocal.m4 changes.
+       * config.in: Ditto.
+
 Wed Apr  2 15:06:28 1997  Doug Evans  <dje@canuck.cygnus.com>
 
        * interp.c (sim_open): New arg `kind'.
index 3c4a0af7dc9a62aae5fa31fce5e52625b3f7d847..9a654f4ade1980d8862087546a0e6737fdd28553 100644 (file)
@@ -2628,24 +2628,26 @@ OP_5F00 ()
            (*d10v_callback->printf_filtered) (d10v_callback, "         a0         a1 f0 f1 c\n");
          }
 
-      (*d10v_callback->printf_filtered) (d10v_callback, "Trap %2d 0x%.4x:", (int)OP[0], (int)PC);
+       (*d10v_callback->printf_filtered) (d10v_callback, "Trap %2d 0x%.4x:", (int)OP[0], (int)PC);
 
-      for (i = 0; i < 16; i++)
-       (*d10v_callback->printf_filtered) (d10v_callback, " %.4x", (int) State.regs[i]);
+       for (i = 0; i < 16; i++)
+         (*d10v_callback->printf_filtered) (d10v_callback, " %.4x", (int) State.regs[i]);
 
-      for (i = 0; i < 2; i++)
-       (*d10v_callback->printf_filtered) (d10v_callback, " %.2x%.8lx",
-                                          ((int)(State.a[i] >> 32) & 0xff),
-                                          ((unsigned long)State.a[i]) & 0xffffffff);
+       for (i = 0; i < 2; i++)
+         (*d10v_callback->printf_filtered) (d10v_callback, " %.2x%.8lx",
+                                            ((int)(State.a[i] >> 32) & 0xff),
+                                            ((unsigned long)State.a[i]) & 0xffffffff);
 
-      (*d10v_callback->printf_filtered) (d10v_callback, "  %d  %d %d\n",
-                                        State.F0 != 0, State.F1 != 0, State.C != 0);
-      (*d10v_callback->flush_stdout) (d10v_callback);
-      break;
+       (*d10v_callback->printf_filtered) (d10v_callback, "  %d  %d %d\n",
+                                          State.F0 != 0, State.F1 != 0, State.C != 0);
+       (*d10v_callback->flush_stdout) (d10v_callback);
+       break;
+      }
 #endif
 
-    case 0:
-      /* Trap 0 is used for simulating low-level I/O */
+    case 0:                    /* old system call trap, to be deleted */
+    case 15:                   /* new system call trap */
+      /* Trap 15 is used for simulating low-level I/O */
       {
        errno = 0;
 
@@ -2818,11 +2820,13 @@ OP_5F00 ()
            trace_output (OP_R2);
            break;
 
+#ifdef SYS_execv
          case SYS_execv:
            RETVAL = execve (MEMPTR (PARM1), (char **) MEMPTR (PARM2), NULL);
            trace_input ("<execv>", OP_R2, OP_R3, OP_VOID);
            trace_output (OP_R2);
            break;
+#endif
 
          case SYS_pipe:
            {
@@ -2839,6 +2843,7 @@ OP_5F00 ()
            }
          break;
 
+#ifdef SYS_wait
          case SYS_wait:
            {
              int status;
@@ -2850,6 +2855,7 @@ OP_5F00 ()
              trace_output (OP_R2);
            }
          break;
+#endif
 #else
          case SYS_getpid:
            trace_input ("<getpid>", OP_VOID, OP_VOID, OP_VOID);
@@ -2955,6 +2961,7 @@ OP_5F00 ()
            trace_output (OP_R2);
            break;
 
+#ifdef SYS_utime
          case SYS_utime:
            /* Cast the second argument to void *, to avoid type mismatch
               if a prototype is present.  */
@@ -2962,7 +2969,9 @@ OP_5F00 ()
            trace_input ("<utime>", OP_R2, OP_R3, OP_R4);
            trace_output (OP_R2);
            break;
+#endif
 
+#ifdef SYS_time
          case SYS_time:
            {
              unsigned long ret = time (PARM1 ? MEMPTR (PARM1) : NULL);
@@ -2972,39 +2981,14 @@ OP_5F00 ()
            trace_input ("<time>", OP_R2, OP_R3, OP_R4);
            trace_output (OP_R2R3);
            break;
+#endif
            
          default:
            abort ();
          }
-       RETERR = d10v_callback->get_errno(d10v_callback);
-       break;
-      }
-
-    case 1:
-      /* Trap 1 prints a string */
-      {
-       char *fstr = dmem_addr(State.regs[2]);
-       fputs (fstr, stdout);
-       break;
-      }
-
-    case 2:
-      /* Trap 2 calls printf */
-      {
-       char *fstr = dmem_addr(State.regs[2]);
-       (*d10v_callback->printf_filtered) (d10v_callback, fstr,
-                                          (int16)State.regs[3],
-                                          (int16)State.regs[4],
-                                          (int16)State.regs[5]);
-       (*d10v_callback->flush_stdout) (d10v_callback);
+       RETERR = (RETVAL == (uint16) -1) ? d10v_callback->get_errno(d10v_callback) : 0;
        break;
       }
-
-    case 3:
-      /* Trap 3 writes a character */
-      putchar (State.regs[2]);
-      break;
-      }
     }
 }
 
index 5c784574ec1014ffb474a392961bc2f894f2dbe4..de7075e8cdb552f85151ee781496194cd34c36cb 100644 (file)
@@ -1,3 +1,13 @@
+Wed Apr 16 17:55:37 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * interp.c (sim_size): Delete prototype - conflicts with
+       definition in remote-sim.h.  Correct definition.
+
+Mon Apr  7 15:45:02 1997  Andrew Cagney  <cagney@kremvax.cygnus.com>
+
+       * configure: Regenerated to track ../common/aclocal.m4 changes.
+       * config.in: Ditto.
+
 Wed Apr  2 15:06:28 1997  Doug Evans  <dje@canuck.cygnus.com>
 
        * interp.c (sim_open): New arg `kind'.
index 3b434f19552d1cf0367cb3db8058f080c7e44d43..f4b42a915ccb344ee720a89d7d6c577d4b2037c7 100644 (file)
@@ -75,6 +75,7 @@ code on the hardware.
 #endif
 
 char* pr_addr PARAMS ((SIM_ADDR addr));
+char* pr_uword64 PARAMS ((uword64 addr));
 
 #ifndef SIGBUS
 #define SIGBUS SIGSEGV
@@ -460,7 +461,6 @@ static void LoadMemory PARAMS((uword64*memvalp,uword64*memval1p,int CCA,int Acce
 static void SignalException PARAMS((int exception,...));
 static void simulate PARAMS((void));
 static long getnum PARAMS((char *value));
-extern void sim_size PARAMS((unsigned int newsize));
 extern void sim_set_profile PARAMS((int frequency));
 static unsigned int power2 PARAMS((unsigned int value));
 
@@ -653,7 +653,8 @@ static fnptr_swap_long host_swap_long;
 /*---------------------------------------------------------------------------*/
 
 SIM_DESC
-sim_open (argv)
+sim_open (kind,argv)
+     SIM_OPEN_KIND kind;
      char **argv;
 {
   if (callback == NULL) {
@@ -745,6 +746,9 @@ sim_open (argv)
 
     for (argc = 0; argv[argc]; argc++);
 
+    /* Ensure getopt is reset [don't know whether caller used it].  */
+    optind = 0;
+
     while (1) {
       int option_index = 0;
 
@@ -1657,7 +1661,7 @@ sim_set_profile_size (n)
 
 void
 sim_size(newsize)
-     unsigned int newsize;
+     int newsize;
 {
   char *new;
   /* Used by "run", and internally, to set the simulated memory size */
@@ -2682,7 +2686,7 @@ LoadMemory(memvalp,memval1p,CCA,AccessLength,pAddr,vAddr,IorD,raw)
 
 #ifdef DEBUG
       printf("DBG: LoadMemory() : (offset %d) : value = 0x%s%s\n",
-             (int)(pAddr & LOADDRMASK),pr_addr(value1),pr_addr(value));
+             (int)(pAddr & LOADDRMASK),pr_uword64(value1),pr_uword64(value));
 #endif /* DEBUG */
 
       /* TODO: We could try and avoid the shifts when dealing with raw
@@ -2700,7 +2704,7 @@ LoadMemory(memvalp,memval1p,CCA,AccessLength,pAddr,vAddr,IorD,raw)
 
 #ifdef DEBUG
       printf("DBG: LoadMemory() : shifted value = 0x%s%s\n",
-             pr_addr(value1),pr_addr(value));
+             pr_uword64(value1),pr_uword64(value));
 #endif /* DEBUG */
     }
   }
@@ -2733,7 +2737,7 @@ StoreMemory(CCA,AccessLength,MemElem,MemElem1,pAddr,vAddr,raw)
      int raw;
 {
 #ifdef DEBUG
-  callback->printf_filtered(callback,"DBG: StoreMemory(%d,%d,0x%s,0x%s,0x%s,0x%s,%s)\n",CCA,AccessLength,pr_addr(MemElem),pr_addr(MemElem1),pr_addr(pAddr),pr_addr(vAddr),(raw ? "isRAW" : "isREAL"));
+  callback->printf_filtered(callback,"DBG: StoreMemory(%d,%d,0x%s,0x%s,0x%s,0x%s,%s)\n",CCA,AccessLength,pr_uword64(MemElem),pr_uword64(MemElem1),pr_addr(pAddr),pr_addr(vAddr),(raw ? "isRAW" : "isREAL"));
 #endif /* DEBUG */
 
 #if defined(WARN_MEM)
@@ -2772,7 +2776,7 @@ StoreMemory(CCA,AccessLength,MemElem,MemElem1,pAddr,vAddr,raw)
       int shift = 0;
 
 #ifdef DEBUG
-      printf("DBG: StoreMemory: offset = %d MemElem = 0x%s%s\n",(unsigned int)(pAddr & LOADDRMASK),pr_addr(MemElem1),pr_addr(MemElem));
+      printf("DBG: StoreMemory: offset = %d MemElem = 0x%s%s\n",(unsigned int)(pAddr & LOADDRMASK),pr_uword64(MemElem1),pr_uword64(MemElem));
 #endif /* DEBUG */
 
       if (AccessLength <= AccessLength_DOUBLEWORD) {
@@ -2790,7 +2794,7 @@ StoreMemory(CCA,AccessLength,MemElem,MemElem1,pAddr,vAddr,raw)
       }
 
 #ifdef DEBUG
-      printf("DBG: StoreMemory: shift = %d MemElem = 0x%s%s\n",shift,pr_addr(MemElem1),pr_addr(MemElem));
+      printf("DBG: StoreMemory: shift = %d MemElem = 0x%s%s\n",shift,pr_uword64(MemElem1),pr_uword64(MemElem));
 #endif /* DEBUG */
 
       if (BigEndianMem) {
@@ -4528,5 +4532,16 @@ pr_addr(addr)
   return paddr_str;
 }
 
+char* 
+pr_uword64(addr)
+  uword64 addr;
+{
+  char *paddr_str=get_cell();
+  sprintf(paddr_str,"%08x%08x",
+          (unsigned long)(addr>>thirty_two),(unsigned long)(addr&0xffffffff));
+  return paddr_str;
+}
+
+
 /*---------------------------------------------------------------------------*/
 /*> EOF interp.c <*/
index c9090eddf71059465a99da0701c63f621ab7527a..8f83302acc86276478ef3cbc647466b60b51ce5c 100644 (file)
@@ -1,3 +1,13 @@
+Wed Apr 16 19:30:44 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * simops.c (OP_F020): SYS_execv, SYS_time, SYS_times, SYS_utime
+       only include if implemented by host.
+       (OP_F020): Typecast arg passed to time function;
+
+Mon Apr  7 23:57:49 1997  Jeffrey A Law  (law@cygnus.com)
+
+       * simops.c (syscall): Handle new mn10300 calling conventions.
+
 Mon Apr  7 15:45:02 1997  Andrew Cagney  <cagney@kremvax.cygnus.com>
 
        * configure: Regenerated to track ../common/aclocal.m4 changes.
index 27f6fda587ca9105f17b5a5607f9f83caad14bb4..5f9fc92546de3112ed8048cb3aee331f20ab94f1 100644 (file)
@@ -2920,9 +2920,11 @@ void OP_F020 (insn, extension)
       RETVAL = execve (MEMPTR (PARM1), (char **) MEMPTR (PARM2),
                       (char **)MEMPTR (PARM3));
       break;
+#ifdef SYS_execv
     case SYS_execv:
       RETVAL = execve (MEMPTR (PARM1), (char **) MEMPTR (PARM2), NULL);
       break;
+#endif
 #endif
 
     case SYS_read:
@@ -2986,9 +2988,12 @@ void OP_F020 (insn, extension)
     case SYS_chmod:
       RETVAL = chmod (MEMPTR (PARM1), PARM2);
       break;
+#ifdef SYS_time
     case SYS_time:
-      RETVAL = time (MEMPTR (PARM1));
+      RETVAL = time ((void*) MEMPTR (PARM1));
       break;
+#endif
+#ifdef SYS_times
     case SYS_times:
       {
        struct tms tms;
@@ -2999,6 +3004,7 @@ void OP_F020 (insn, extension)
        store_mem (PARM1 + 12, 4, tms.tms_cstime);
        break;
       }
+#endif
     case SYS_gettimeofday:
       {
        struct timeval t;
@@ -3010,11 +3016,13 @@ void OP_F020 (insn, extension)
        store_mem (PARM2 + 4, 4, tz.tz_dsttime);
        break;
       }
+#ifdef SYS_utime
     case SYS_utime:
       /* Cast the second argument to void *, to avoid type mismatch
         if a prototype is present.  */
       RETVAL = utime (MEMPTR (PARM1), (void *) MEMPTR (PARM2));
       break;
+#endif
     default:
       abort ();
     }
index 316c7ade982c15c61a773cd86549d23e106dc64e..79e55930b8a0b7bd52b36c8db425f2f0fdaa79c8 100644 (file)
@@ -1,3 +1,13 @@
+Wed Apr 16 19:53:55 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * simops.c (OP_10007E0): Only provide system calls SYS_execv,
+       SYS_wait, SYS_wait, SYS_utime, SYS_time if defined by the host.
+
+Mon Apr  7 15:45:02 1997  Andrew Cagney  <cagney@kremvax.cygnus.com>
+
+       * configure: Regenerated to track ../common/aclocal.m4 changes.
+       * config.in: Ditto.
+
 Wed Apr  2 15:06:28 1997  Doug Evans  <dje@canuck.cygnus.com>
 
        * interp.c (sim_open): New arg `kind'.
index e044c46568ede5861491af9caac6cd679e9d28d1..101741a2c41b00bc67a69a1dc0f8f5eabaf93678 100644 (file)
@@ -1,17 +1,14 @@
-#include "config.h"
-
 #include <signal.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
 #include "v850_sim.h"
 #include "simops.h"
 #include "sys/syscall.h"
 #include "bfd.h"
 #include <errno.h>
+#if !defined(__GO32__) && !defined(_WIN32)
 #include <sys/stat.h>
 #include <sys/times.h>
 #include <sys/time.h>
+#endif
 
 enum op_types {
   OP_UNKNOWN,
@@ -1077,8 +1074,8 @@ void
 OP_E0 ()
 {
   trace_input ("mulh", OP_REG_REG, 0);
-  State.regs[OP[1]] = ((State.regs[OP[1]] & 0xffff)
-                      * (State.regs[OP[0]] & 0xffff));
+  State.regs[OP[1]] = (SEXT16 (State.regs[OP[1]])
+                      * SEXT16 (State.regs[OP[0]]));
   trace_output (OP_REG_REG);
 }
 
@@ -1091,7 +1088,7 @@ OP_2E0 ()
   int value = SEXT5 (OP[0]);
  
   trace_input ("mulh", OP_IMM_REG, 0);
-  State.regs[OP[1]] = (State.regs[OP[1]] & 0xffff) * value;
+  State.regs[OP[1]] = SEXT16 (State.regs[OP[1]]) * value;
   trace_output (OP_IMM_REG);
 }
 
@@ -1099,10 +1096,10 @@ OP_2E0 ()
 void
 OP_6E0 ()
 {
-  int value = OP[0] & 0xffff;
+  int value = SEXT16 (OP[0]);
 
   trace_input ("mulhi", OP_IMM_REG_REG, 0);
-  State.regs[OP[2]] = (State.regs[OP[1]] & 0xffff) * value;
+  State.regs[OP[2]] = SEXT16 (State.regs[OP[1]]) * value;
   trace_output (OP_IMM_REG_REG);
 }
 
@@ -2003,9 +2000,11 @@ OP_10007E0 ()
          RETVAL = execve (MEMPTR (PARM1), (char **) MEMPTR (PARM2),
                           (char **)MEMPTR (PARM3));
          break;
+#ifdef SYS_execv
        case SYS_execv:
          RETVAL = execve (MEMPTR (PARM1), (char **) MEMPTR (PARM2), NULL);
          break;
+#endif
 #if 0
        case SYS_pipe:
          {
@@ -2061,6 +2060,7 @@ OP_10007E0 ()
            State.exception = SIG_V850_EXIT;    /* PARM1 has exit status encoded */
          break;
 
+#if !defined(__GO32__) && !defined(_WIN32)
        case SYS_stat:  /* added at hmsi */
          /* stat system call */
          {
@@ -2092,6 +2092,7 @@ OP_10007E0 ()
        case SYS_chmod:
          RETVAL = chmod (MEMPTR (PARM1), PARM2);
          break;
+#ifdef SYS_time
        case SYS_time:
          {
            time_t now;
@@ -2099,6 +2100,8 @@ OP_10007E0 ()
            store_mem (PARM1, 4, now);
          }
          break;
+#endif
+#ifdef SYS_times
        case SYS_times:
          {
            struct tms tms;
@@ -2109,6 +2112,7 @@ OP_10007E0 ()
            store_mem (PARM1 + 12, 4, tms.tms_cstime);
            break;
          }
+#endif
        case SYS_gettimeofday:
          {
            struct timeval t;
@@ -2120,11 +2124,14 @@ OP_10007E0 ()
            store_mem (PARM2 + 4, 4, tz.tz_dsttime);
            break;
          }
+#ifdef SYS_utime
        case SYS_utime:
          /* Cast the second argument to void *, to avoid type mismatch
             if a prototype is present.  */
          RETVAL = utime (MEMPTR (PARM1), (void *) MEMPTR (PARM2));
          break;
+#endif
+#endif
        default:
          abort ();
        }