From 56f42a752b028fe558cbf83ad829597e6b639c88 Mon Sep 17 00:00:00 2001 From: cagney Date: Tue, 22 Feb 2000 08:52:20 +0000 Subject: [PATCH] When SIM_HAVE_ENVIRONMENT: use sim_set_trace() to enable tracing instead of sim_trace() to run the program; include support for ``-o'' option (operating environment); when a signal occurs, only continue execution when operating environment mode. Update d10v. --- include/ChangeLog | 5 ++ include/remote-sim.h | 18 +++- sim/common/ChangeLog | 9 ++ sim/common/run.c | 51 +++++++---- sim/d10v/ChangeLog | 173 +++++++++++++++++++++++++++++++++++++ sim/d10v/Makefile.in | 1 + sim/d10v/interp.c | 12 +-- sim/testsuite/d10v-elf/ChangeLog | 32 +++++++ sim/testsuite/d10v-elf/Makefile.in | 30 +++++++ 9 files changed, 303 insertions(+), 28 deletions(-) diff --git a/include/ChangeLog b/include/ChangeLog index f377d21f0c..bd9ba9a545 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,8 @@ +Tue Feb 22 15:19:54 2000 Andrew Cagney + + * remote-sim.h (sim_trace): Document return values. + (sim_set_trace): Declare. Deprecate. + 2000-02-21 Alan Modra * dis-asm.h (struct disassemble_info): Change `length' param of diff --git a/include/remote-sim.h b/include/remote-sim.h index a8eb923828..b32f93fddc 100644 --- a/include/remote-sim.h +++ b/include/remote-sim.h @@ -308,15 +308,27 @@ void sim_set_callbacks PARAMS ((struct host_callback_struct *)); void sim_size PARAMS ((int i)); -/* Run a simulation with tracing enabled. +/* Single-step simulator with tracing enabled. THIS PROCEDURE IS DEPRECIATED. + THIS PROCEDURE IS EVEN MORE DEPRECATED THAN SIM_SET_TRACE GDB and NRUN do not use this interface. - This procedure does not take a SIM_DESC argument as it is - used before sim_open. */ + This procedure returns: ``0'' indicating that the simulator should + be continued using sim_trace() calls; ``1'' indicating that the + simulation has finished. */ int sim_trace PARAMS ((SIM_DESC sd)); +/* Enable tracing. + THIS PROCEDURE IS DEPRECIATED. + GDB and NRUN do not use this interface. + This procedure returns: ``0'' indicating that the simulator should + be continued using sim_trace() calls; ``1'' indicating that the + simulation has finished. */ + +void sim_set_trace PARAMS ((void)); + + /* Configure the size of the profile buffer. THIS PROCEDURE IS DEPRECIATED. GDB and NRUN do not use this interface. diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 9aeba03429..1273e8353d 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,12 @@ +Tue Feb 22 16:45:09 2000 Andrew Cagney + + * run.c (main): When SIM_HAVE_ENVIRONMENT enable tracing with + sim_set_trace and run simulator using sim_resume. + (main): Add option ``-o'' - operating environment. Only continue + after a signal when operating environment. + (main): Always set REASON and SIGRC using sim_stop_reason. + (sim_trace): Delete extern declaration. + 2000-02-08 Nick Clifton * callback.c: Fix compile time warning messages. diff --git a/sim/common/run.c b/sim/common/run.c index 1a4e96908f..d23b5a0152 100644 --- a/sim/common/run.c +++ b/sim/common/run.c @@ -57,9 +57,6 @@ extern host_callback default_callback; static char *myname; -/* NOTE: sim_size() and sim_trace() are going away */ -extern int sim_trace PARAMS ((SIM_DESC sd)); - extern int getopt (); #ifdef NEED_UI_LOOP_HOOK @@ -89,6 +86,9 @@ main (ac, av) int i; int verbose = 0; int trace = 0; +#ifdef SIM_HAVE_ENVIRONMENT + int operating_p = 0; +#endif char *name; static char *no_args[4]; char **sim_argv = &no_args[0]; @@ -117,9 +117,9 @@ main (ac, av) do all argv processing. */ #ifdef SIM_H8300 /* FIXME: quick hack */ - while ((i = getopt (ac, av, "a:c:m:p:s:htv")) != EOF) + while ((i = getopt (ac, av, "a:c:m:op:s:htv")) != EOF) #else - while ((i = getopt (ac, av, "a:c:m:p:s:tv")) != EOF) + while ((i = getopt (ac, av, "a:c:m:op:s:tv")) != EOF) #endif switch (i) { @@ -147,6 +147,13 @@ main (ac, av) /* FIXME: Rename to sim_set_mem_size. */ sim_size (atoi (optarg)); break; +#ifdef SIM_HAVE_ENVIRONMENT + case 'o': + /* Operating enironment where any signals are delivered to the + target. */ + operating_p = 1; + break; +#endif SIM_HAVE_ENVIRONMENT #ifdef SIM_HAVE_PROFILE case 'p': sim_set_profile (atoi (optarg)); @@ -157,8 +164,6 @@ main (ac, av) #endif case 't': trace = 1; - /* FIXME: need to allow specification of what to trace. */ - /* sim_set_trace (1); */ break; case 'v': /* Things that are printed with -v are the kinds of things that @@ -231,6 +236,21 @@ main (ac, av) if (sim_create_inferior (sd, abfd, prog_args, NULL) == SIM_RC_FAIL) exit (1); +#ifdef SIM_HAVE_ENVIRONMENT + /* NOTE: An old simulator supporting the operating environment MUST + provide sim_set_trace() and not sim_trace(). That way + sim_stop_reason() can be used to determine any stop reason. */ + if (trace) + sim_set_trace (); + do + { + prev_sigint = signal (SIGINT, cntrl_c); + sim_resume (sd, 0, sigrc); + signal (SIGINT, prev_sigint); + sim_stop_reason (sd, &reason, &sigrc); + } + while (operating_p && reason == sim_stopped && sigrc != SIGINT); +#else if (trace) { int done = 0; @@ -240,18 +260,16 @@ main (ac, av) done = sim_trace (sd); } signal (SIGINT, prev_sigint); + sim_stop_reason (sd, &reason, &sigrc); } else { - do - { - prev_sigint = signal (SIGINT, cntrl_c); - sim_resume (sd, 0, sigrc); - signal (SIGINT, prev_sigint); - sim_stop_reason (sd, &reason, &sigrc); - } - while (reason == sim_stopped && sigrc != SIGINT); + prev_sigint = signal (SIGINT, cntrl_c); + sim_resume (sd, 0, sigrc); + signal (SIGINT, prev_sigint); + sim_stop_reason (sd, &reason, &sigrc); } +#endif if (verbose) sim_info (sd, 0); @@ -303,6 +321,9 @@ usage () fprintf (stderr, "-h Executable is for h8/300h or h8/300s.\n"); #endif fprintf (stderr, "-m size Set memory size of simulator, in bytes.\n"); +#ifdef SIM_HAVE_ENVIRONMENT + fprintf (stderr, "-o Select operating (kernel) environment.\n"); +#endif #ifdef SIM_HAVE_PROFILE fprintf (stderr, "-p freq Set profiling frequency.\n"); fprintf (stderr, "-s size Set profiling size.\n"); diff --git a/sim/d10v/ChangeLog b/sim/d10v/ChangeLog index 73b8c9287a..232716636a 100644 --- a/sim/d10v/ChangeLog +++ b/sim/d10v/ChangeLog @@ -1,3 +1,176 @@ +Tue Feb 22 18:24:56 2000 Andrew Cagney + + * Makefile.in (SIM_EXTRA_CFLAGS): Define SIM_HAVE_ENVIRONMENT. + * interp.c (sim_set_trace): Replace sim_trace. Enable tracing. + +Mon Jan 3 02:06:07 2000 Andrew Cagney + + * interp.c (lookup_hash): Stop the update of the PC when there was + an illegal instruction exception. + +Mon Jan 3 00:14:33 2000 Andrew Cagney + + * simops.c (address_exception): New function. + (OP_30000000, OP_6401, OP_6001, OP_6000, OP_32010000, OP_31000000, + OP_6601, OP_6201, OP_6200, OP_33010000, OP_34000000, OP_6800, + OP_6C1F, OP_6801, OP_6C01, OP_36010000, OP_35000000, OP_6A00, + OP_6E1F, OP_6A01, OP_6E01, OP_37010000): For "ld", "ld2w", "st" + and "st2w" check that the address is aligned. + +1999-11-25 Nick Clifton + + * simops.c (OP_4E0F): New function: Simulate new bit pattern for + cpfg instruction. + +Fri Oct 29 18:34:28 1999 Andrew Cagney + + * simops.c (move_to_cr): Don't allow user to set PSW.DM in either + DPSW and BPSW. + +Thu Oct 28 01:26:18 1999 Andrew Cagney + + * simops.c (OP_5F20): Use SET_HW_PSW when updating PSW. + (PSW_HW_MASK): Declare. + + * d10v_sim.h (move_to_cr): Add ``psw_hw_p'' parameter. + (SET_CREG, SET_PSW_BIT): Update. + (SET_HW_CREG, SET_HW_PSW): Define. + +Sun Oct 24 21:38:04 1999 Andrew Cagney + + * interp.c (sim_d10v_translate_dmap_addr): Fix extraction of IOSP + for DMAP3. + +Sun Oct 24 16:04:16 1999 Andrew Cagney + + * interp.c (sim_d10v_translate_addr): New function. + (xfer_mem): Rewrite. Use sim_d10v_translate_addr. + (map_memory): Make INLINE. + +Sun Oct 24 13:45:19 1999 Andrew Cagney + + * interp.c (sim_d10v_translate_dmap_addr): New function. + (dmem_addr): Rewrite. Use sim_d10v_translate_dmap_addr. Change + offset parameter to type uint16. + * d10v_sim.h (dmem_addr): Update declaration. + +Sun Oct 24 13:07:31 1999 Andrew Cagney + + * interp.c (imap_register, set_imap_register, dmap_register, + set_imap_register): Use map_memory. + (DMAP): Update. + (sim_create_inferior): Initialize all DMAP registers. NOTE that + DMAP2, in internal memory mode, is set to 0x0000 and NOT + 0x2000. This is consistent with the older d10v boards. + +Sun Oct 24 11:22:12 1999 Andrew Cagney + + * interp.c (sim_d10v_translate_imap_addr): New function. + (imem_addr): Rewrite. Use sim_d10v_translate_imap_addr. + (last_from, last_to): Declare. + +Sun Oct 24 01:21:56 1999 Andrew Cagney + + * d10v_sim.h (struct d10v_memory): Define. Support very long + memories. + (struct _state): Replace imem, dmem and umem by mem. + (IMAP_BLOCK_SIZE, DMAP_BLOCK_SIZE, SEGMENT_SIZE, IMEM_SEGMENTS, + DMEM_SEGMENTS, UMEM_SEGMENTS): Define. + + * interp.c (map_memory): New function. + (sim_size, xfer_memory, imem_addr, dmem_addr): Update. + (UMEM_SEGMENTS): Moveed to "d10v_sim.h". + (IMEM_SIZEDMEM_SIZE): Delete. + +Sat Oct 23 20:06:58 1999 Andrew Cagney + + * interp.c: Include "sim-d10v.h". + (imap_register, set_imap_register, dmap_register, + set_dmap_register, spi_register, spu_register, set_spi_register, + set_spu_register): New functions. + (sim_create_inferior): Update. + (sim_fetch_register, sim_store_register): Rewrite. Use enums + defined in sim-d10v.h. + + * d10v_sim.h (DEBUG_MEMORY): Define. + (IMAP0, IMAP1, DMAP, SET_IMAP0, SET_IMAP1, SET_DMAP): Delete. + +Sat Oct 23 18:41:18 1999 Andrew Cagney + + * interp.c (sim_open): Allow a debug value to be passed to the -t + option. + (lookup_hash): Don't exit on an illegal instruction. + (do_long, do_2_short, do_parallel): Check for failed instruction + lookup. + +Mon Oct 18 18:03:24 MDT 1999 Diego Novillo + + * simops.c (OP_3220): Fix trace output for illegal accumulator + message. + +1999-09-14 Nick Clifton + + * simops.c: Disable setting of DM bit in PSW. + +Wed Sep 8 19:34:55 MDT 1999 Diego Novillo + + * simops.c (op_types): Added new memory indirect type OP_MEMREF3. + (trace_input_func): Added support for OP_MEMREF3. + (OP_32010000): New instruction ld. + (OP_33010000): New instruction ld2w. + (OP_5209): New instruction sac. + (OP_4209): New instruction sachi. + (OP_3220): New instruction slae. + (OP_36010000): New instruction st. + (OP_37010000): New instruction st2w. + +1999-09-09 Stan Shebs + + * interp.c (old_segment_mapping): New global. + (xfer_mem): Change the default segment mapping to be the way + that Mitsubishi prefers, but use the previous mapping if + old_segment_mapping is true. + (sim_open): Add an option -oldseg to get the old mapping. + (sim_create_inferior): Init mapping registers based on the + value of old_segment_mapping. + +1999-09-07 Nick Clifton + + * simops.c (OP_6601): Do not write back decremented address if + either of the destination registers was the same as the address + register. + (OP_6201): Do not write back incremented address if either of the + destination registers was the same as the address register. + +Thu Sep 2 18:15:53 1999 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + +1999-05-08 Felix Lee + + * configure: Regenerated to track ../common/aclocal.m4 changes. + +1999-04-02 Keith Seitz + + * interp.c (ui_loop_hook_counter): New global (when NEED_UI_LOOP_HOOK + defined). + (sim_resume): If the counter has expired, call the ui_loop_hook, + if defined. + (UI_LOOP_POLL_INTERVAL): Define. Used to tweak the frequency of + ui_loop_hook calls. + * Makefile.in (SIM_EXTRA_CFLAGS): Include NEED_UI_LOOP_HOOK. + +Wed Mar 10 19:32:13 1999 Nick Clifton + + * simops.c: If load instruction with auto increment/decrement + addressing is used when the destination register is the same as + the address register, then ignore the auto increment/decrement. + +Wed Mar 10 19:32:13 1999 Martin M. Hunt + + * simops.c (OP_5F00): Ifdef SYS_stat case because + not all systems have it defined. + 1999-01-26 Jason Molenda (jsm@bugshack.cygnus.com) * simops.c (OP_5607): Correct saturation comparison/assignment. diff --git a/sim/d10v/Makefile.in b/sim/d10v/Makefile.in index 07323275de..8ed219f013 100644 --- a/sim/d10v/Makefile.in +++ b/sim/d10v/Makefile.in @@ -20,6 +20,7 @@ SIM_OBJS = interp.o table.o simops.o endian.o sim-load.o SIM_EXTRA_CLEAN = clean-extra +SIM_EXTRA_CFLAGS = -DNEED_UI_LOOP_HOOK -DSIM_HAVE_ENVIRONMENT INCLUDE = d10v_sim.h $(srcroot)/include/callback.h targ-vals.h endian.c diff --git a/sim/d10v/interp.c b/sim/d10v/interp.c index 80898ab44e..91ebee56ce 100644 --- a/sim/d10v/interp.c +++ b/sim/d10v/interp.c @@ -1072,20 +1072,12 @@ sim_resume (sd, step, siggnal) State.exception = SIGTRAP; } -int -sim_trace (sd) - SIM_DESC sd; +void +sim_set_trace (void) { - enum sim_stop reason; - static int sigrc = 0; #ifdef DEBUG d10v_debug = DEBUG; #endif - /* NOTE: SIGRC starts with zero and is then, always the value - returned by the last sim_stop_reason() call. */ - sim_resume (sd, 0, sigrc); - sim_stop_reason (sd, &reason, &sigrc); - return (reason != sim_stopped || sigrc != SIGINT); } void diff --git a/sim/testsuite/d10v-elf/ChangeLog b/sim/testsuite/d10v-elf/ChangeLog index b3b7f8cfac..a7cf211ce3 100644 --- a/sim/testsuite/d10v-elf/ChangeLog +++ b/sim/testsuite/d10v-elf/ChangeLog @@ -1,3 +1,35 @@ +Tue Feb 22 17:36:34 2000 Andrew Cagney + + * Makefile.in: Force d10v into operating mode. + +Mon Jan 3 00:17:28 2000 Andrew Cagney + + * t-ae-ld-d.s, t-ae-ld-i.s, t-ae-ld-id.s, t-ae-ld-im.s , + t-ae-ld-ip.s, t-ae-ld2w-d.s, t-ae-ld2w-i.s, t-ae-ld2w-id.s , + t-ae-ld2w-im.s, t-ae-ld2w-ip.s, t-ae-st-d.s, t-ae-st-i.s , + t-ae-st-id.s, t-ae-st-im.s, t-ae-st-ip.s, t-ae-st-is.s , + t-ae-st2w-d.s, t-ae-st2w-i.s, t-ae-st2w-id.s, t-ae-st2w-im.s , + t-ae-st2w-ip.s, t-ae-st2w-is.s: New tests. Check that an address + exception occures when a word/two-word load/store is not word + aligned. + * Makefile.in (TESTS): Update. + +Fri Oct 29 18:36:34 1999 Andrew Cagney + + * t-mvtc.s: Check that the user can not modify the DM bit in the + BPSW or DPSW. + +Thu Oct 28 01:47:26 1999 Andrew Cagney + + * t-mvtc.s: Update. Check that user can not modify DM bit. + +Wed Sep 8 19:34:55 MDT 1999 Diego Novillo + + * t-ld-st.s: New file. + * t-sac.s: New file. + * t-sachi.s: New file. + * t-slae.s: New file. + 1999-01-13 Jason Molenda (jsm@bugshack.cygnus.com) * t-sadd.s: New file. diff --git a/sim/testsuite/d10v-elf/Makefile.in b/sim/testsuite/d10v-elf/Makefile.in index 09d59ac756..40e96464eb 100644 --- a/sim/testsuite/d10v-elf/Makefile.in +++ b/sim/testsuite/d10v-elf/Makefile.in @@ -41,6 +41,7 @@ TESTS = \ exit47.ko \ hello.hi \ t-dbt.ok \ + t-ld-st.ok \ t-mac.ok \ t-mvtac.ok \ t-mvtc.ok \ @@ -51,11 +52,37 @@ TESTS = \ t-rdt.ok \ t-rep.ok \ t-rte.ok \ + t-sac.ok \ + t-sachi.ok \ t-sadd.ok \ + t-slae.ok \ t-sp.ok \ t-sub2w.ok \ t-sub.ok \ t-subi.ok \ + t-ae-ld-d.ok \ + t-ae-ld-i.ok \ + t-ae-ld-id.ok \ + t-ae-ld-im.ok \ + t-ae-ld-ip.ok \ + t-ae-ld2w-d.ok \ + t-ae-ld2w-i.ok \ + t-ae-ld2w-id.ok \ + t-ae-ld2w-im.ok \ + t-ae-ld2w-ip.ok \ + t-ae-st-d.ok \ + t-ae-st-i.ok \ + t-ae-st-id.ok \ + t-ae-st-im.ok \ + t-ae-st-ip.ok \ + t-ae-st-is.ok \ + t-ae-st2w-d.ok \ + t-ae-st2w-i.ok \ + t-ae-st2w-id.ok \ + t-ae-st2w-im.ok \ + t-ae-st2w-ip.ok \ + t-ae-st2w-is.ok \ + t-mod-ld-pre.ok \ # AS_FOR_TARGET = `\ @@ -79,6 +106,9 @@ RUN_FOR_TARGET = `\ echo $(target_alias)-run ; \ fi` +# Force d10v into operating mode. +RUNFLAGS_FOR_TARGET=-o + check: sanity $(TESTS) sanity: -- 2.11.0