From 87e43259f1f31bb1de748139bb56161d99c44962 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Thu, 17 Apr 1997 06:05:19 +0000 Subject: Cleanups to compile under FreeBSD --- include/ChangeLog | 10 +++ include/remote-sim.h | 8 +++ sim/arm/ChangeLog | 9 +++ sim/arm/wrapper.c | 169 ++++++++++++++++++++++++++++++++++---------------- sim/d10v/ChangeLog | 10 +++ sim/d10v/simops.c | 64 +++++++------------ sim/mips/ChangeLog | 10 +++ sim/mips/interp.c | 31 ++++++--- sim/mn10300/ChangeLog | 10 +++ sim/mn10300/simops.c | 10 ++- sim/v850/ChangeLog | 10 +++ sim/v850/simops.c | 27 +++++--- 12 files changed, 255 insertions(+), 113 deletions(-) diff --git a/include/ChangeLog b/include/ChangeLog index 294f4ea..890c885 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,13 @@ +Wed Apr 2 17:09:12 1997 Andrew Cagney + + * remote-sim.h (sim_trace, sim_size): Make these global. They + will go away shortly. + +Wed Apr 2 15:23:49 1997 Doug Evans + + * 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 * COPYING: Update FSF address. diff --git a/include/remote-sim.h b/include/remote-sim.h index 77685d5..a18b1ef 100644 --- a/include/remote-sim.h +++ b/include/remote-sim.h @@ -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) */ diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog index eda154d..41f05a1 100644 --- a/sim/arm/ChangeLog +++ b/sim/arm/ChangeLog @@ -1,3 +1,12 @@ +Thu Apr 17 11:48:25 1997 Andrew Cagney + + * wrapper.c (sim_trace): Update so that it matches prototype. + +Mon Apr 7 15:45:02 1997 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + * config.in: Ditto. + Mon Apr 7 12:01:17 1997 Andrew Cagney * Makefile.in (armemu32.o): Replace $< with autoconf recommended diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c index fdbff86..2a582cd 100644 --- a/sim/arm/wrapper.c +++ b/sim/arm/wrapper.c @@ -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 #include -#include #include #include #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; } diff --git a/sim/d10v/ChangeLog b/sim/d10v/ChangeLog index b6eeed6..0cd9cc4 100644 --- a/sim/d10v/ChangeLog +++ b/sim/d10v/ChangeLog @@ -1,3 +1,13 @@ +Wed Apr 16 16:12:03 1997 Andrew Cagney + + * 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 + + * configure: Regenerated to track ../common/aclocal.m4 changes. + * config.in: Ditto. + Wed Apr 2 15:06:28 1997 Doug Evans * interp.c (sim_open): New arg `kind'. diff --git a/sim/d10v/simops.c b/sim/d10v/simops.c index 3c4a0af..9a654f4 100644 --- a/sim/d10v/simops.c +++ b/sim/d10v/simops.c @@ -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 ("", 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 ("", 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 ("", 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 ("