From 43e526b9b4c9868d3cd90772a54f767f8d45cadd Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Mon, 12 Jul 1999 11:15:22 +0000 Subject: import gdb-1999-07-12 snapshot --- sim/arm/ChangeLog | 1 + sim/arm/armdefs.h | 1 - sim/arm/armemu.c | 2 ++ sim/common/ChangeLog | 23 +++++++++++++++++++++++ sim/common/nltvals.def | 24 ------------------------ sim/common/nrun.c | 49 +++++++++++++++++++++++++----------------------- sim/common/sim-base.h | 5 +++++ sim/common/sim-hload.c | 10 ++-------- sim/common/sim-options.c | 30 +++++++++++++++++++++++++++++ sim/common/sim-resume.c | 5 +++++ sim/mips/ChangeLog | 14 ++++++++++++++ sim/mips/interp.c | 42 ++++++++++++++++++++++++++++++++++++----- sim/mips/tconfig.in | 2 ++ 13 files changed, 147 insertions(+), 61 deletions(-) (limited to 'sim') diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog index db62bb2..1ec771b 100644 --- a/sim/arm/ChangeLog +++ b/sim/arm/ChangeLog @@ -1,3 +1,4 @@ + 1999-05-08 Felix Lee * configure: Regenerated to track ../common/aclocal.m4 changes. diff --git a/sim/arm/armdefs.h b/sim/arm/armdefs.h index 1e1f352..1d832bc 100644 --- a/sim/arm/armdefs.h +++ b/sim/arm/armdefs.h @@ -30,7 +30,6 @@ typedef char * VoidStar ; #endif typedef unsigned long ARMword ; /* must be 32 bits wide */ - typedef struct ARMul_State ARMul_State ; typedef unsigned ARMul_CPInits(ARMul_State *state) ; diff --git a/sim/arm/armemu.c b/sim/arm/armemu.c index 36b7bba..fa994e0 100644 --- a/sim/arm/armemu.c +++ b/sim/arm/armemu.c @@ -464,6 +464,7 @@ ARMword ARMul_Emulate26(register ARMul_State *state) if (temp) { /* if the condition codes don't match, stop here */ mainswitch: + switch ((int)BITS(20,27)) { /***************************************************************************\ @@ -877,6 +878,7 @@ mainswitch: break ; case 0x10 : /* TST reg and MRS CPSR and SWP word */ + #ifdef MODET if (BITS(4,11) == 0xB) { /* STRH register offset, no write-back, down, pre indexed */ diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 5f702b0..3c6a9f0 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,26 @@ +Sun Jul 11 23:47:20 1999 Andrew Cagney + + * sim-resume.c (sim_resume): Ensure that the siggnal [sic] is only + passed in when sim_resume is first entered - don't re-pass it + after a restart. + +Sun Jul 11 23:34:44 1999 Andrew Cagney + + * sim-options.c (standard_option_handler): Add OPTION_LOAD_VMA and + OPTION_LOAD_LMA but only when is defined. + (standard_options): When SIM_HANDLES_LMA is defined include + options --load-lma and --load-vma. + (standard_install): Initialize STATE_LOAD_AT_LMA_P. + + * sim-base.h (STATE_LOAD_AT_LMA_P): Define. + (struct sim_state_base): Add load_at_lma_p. + * sim-hload.c (sim_load): Replace SIM_HANDLES_LMA with + STATE_LOAD_AT_LMA_P. + +Sun Jul 11 12:03:36 1999 Andrew Cagney + + * nrun.c (main): Re-format loop gnu style. + Wed Jul 7 19:56:03 1999 Andrew Cagney * dv-sockser.c (connected_p): Initialize addrlen. diff --git a/sim/common/nltvals.def b/sim/common/nltvals.def index bed711c..b5e82fc 100644 --- a/sim/common/nltvals.def +++ b/sim/common/nltvals.def @@ -416,27 +416,3 @@ /* end v850 sys target macros */ #endif #endif -#ifdef NL_TARGET_venus -#ifdef sys_defs -/* from syscall.h */ -/* begin venus sys target macros */ - { "SYS_argv", 13 }, - { "SYS_argvlen", 12 }, - { "SYS_chdir", 14 }, - { "SYS_chmod", 16 }, - { "SYS_close", 3 }, - { "SYS_exit", 1 }, - { "SYS_fstat", 10 }, - { "SYS_getpid", 8 }, - { "SYS_kill", 9 }, - { "SYS_lseek", 6 }, - { "SYS_open", 2 }, - { "SYS_read", 4 }, - { "SYS_stat", 15 }, - { "SYS_time", 18 }, - { "SYS_unlink", 7 }, - { "SYS_utime", 17 }, - { "SYS_write", 5 }, -/* end venus sys target macros */ -#endif -#endif diff --git a/sim/common/nrun.c b/sim/common/nrun.c index 2f13b1f..c5b43a2 100644 --- a/sim/common/nrun.c +++ b/sim/common/nrun.c @@ -137,41 +137,44 @@ main (int argc, char **argv) ((reason == sim_stopped) && (STATE_ENVIRONMENT (sd) == OPERATING_ENVIRONMENT))); } - else do + else { + do + { #if defined (HAVE_SIGACTION) && defined (SA_RESTART) - struct sigaction sa, osa; - sa.sa_handler = cntrl_c; - sigemptyset (&sa.sa_mask); - sa.sa_flags = 0; - sigaction (SIGINT, &sa, &osa); - prev_sigint = osa.sa_handler; + struct sigaction sa, osa; + sa.sa_handler = cntrl_c; + sigemptyset (&sa.sa_mask); + sa.sa_flags = 0; + sigaction (SIGINT, &sa, &osa); + prev_sigint = osa.sa_handler; #else - prev_sigint = signal (SIGINT, cntrl_c); + prev_sigint = signal (SIGINT, cntrl_c); #endif - sim_resume (sd, 0, sigrc); - signal (SIGINT, prev_sigint); - sim_stop_reason (sd, &reason, &sigrc); - - if ((reason == sim_stopped) && - (sigrc == sim_signal_to_host (sd, SIM_SIGINT))) - break; /* exit on control-C */ - - /* remain on signals in oe mode */ - } while ((reason == sim_stopped) && - (STATE_ENVIRONMENT (sd) == OPERATING_ENVIRONMENT)); - + sim_resume (sd, 0, sigrc); + signal (SIGINT, prev_sigint); + sim_stop_reason (sd, &reason, &sigrc); + + if ((reason == sim_stopped) && + (sigrc == sim_signal_to_host (sd, SIM_SIGINT))) + break; /* exit on control-C */ + + /* remain on signals in oe mode */ + } while ((reason == sim_stopped) && + (STATE_ENVIRONMENT (sd) == OPERATING_ENVIRONMENT)); + + } /* Print any stats the simulator collected. */ sim_info (sd, 0); - + /* Shutdown the simulator. */ sim_close (sd, 0); - + /* If reason is sim_exited, then sigrc holds the exit code which we want to return. If reason is sim_stopped or sim_signalled, then sigrc holds the signal that the simulator received; we want to return that to indicate failure. */ - + #ifdef SIM_H8300 /* FIXME: Ugh. grep for SLEEP in compile.c */ if (sigrc == SIGILL) abort (); diff --git a/sim/common/sim-base.h b/sim/common/sim-base.h index 3fe01b4..f3af305 100644 --- a/sim/common/sim-base.h +++ b/sim/common/sim-base.h @@ -237,6 +237,11 @@ typedef struct { #endif + /* Should image loads be performed using the LMA or VMA? Older + simulators use the VMA while newer simulators prefer the LMA. */ + int load_at_lma_p; +#define STATE_LOAD_AT_LMA_P(SD) ((SD)->base.load_at_lma_p) + /* Marker for those wanting to do sanity checks. This should remain the last member of this struct to help catch miscompilation errors. */ diff --git a/sim/common/sim-hload.c b/sim/common/sim-hload.c index e4016f4..b8726ba 100644 --- a/sim/common/sim-hload.c +++ b/sim/common/sim-hload.c @@ -45,20 +45,14 @@ sim_load (sd, prog_name, prog_bfd, from_tty) incorrectly write the program sections at LMA interpreted as a virtual address. This is still accommodated for backward compatibility reasons. */ - /* FIXME: The following simulators use this file as of 980313: - m32r, mips, v850 [grep for sim-hload in all Makefile.in's]. - Each of these should be properly using lma. When this is confirmed, - SIM_HANDLES_LMA can go away. */ -#ifndef SIM_HANDLES_LMA -#define SIM_HANDLES_LMA 0 -#endif result_bfd = sim_load_file (sd, STATE_MY_NAME (sd), STATE_CALLBACK (sd), prog_name, STATE_PROG_BFD (sd), STATE_OPEN_KIND (sd) == SIM_OPEN_DEBUG, - SIM_HANDLES_LMA, sim_write); + STATE_LOAD_AT_LMA_P (sd), + sim_write); if (result_bfd == NULL) { bfd_close (STATE_PROG_BFD (sd)); diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c index b49256b..8d0f923 100644 --- a/sim/common/sim-options.c +++ b/sim/common/sim-options.c @@ -111,6 +111,8 @@ typedef enum { #ifdef SIM_H8300 /* FIXME: Should be movable to h8300 dir. */ OPTION_H8300, #endif + OPTION_LOAD_LMA, + OPTION_LOAD_VMA, } STANDARD_OPTIONS; static const OPTION standard_options[] = @@ -182,6 +184,19 @@ static const OPTION standard_options[] = '\0', "BFDNAME", "Specify the object-code format for the object files", standard_option_handler }, +#ifdef SIM_HANDLES_LMA + { {"load-lma", no_argument, NULL, OPTION_LOAD_LMA}, + '\0', NULL, +#if SIM_HANDLES_LMA + "Use VMA or LMA addresses when loading image (default LMA)", +#else + "Use VMA or LMA addresses when loading image (default VMA)", +#endif + standard_option_handler, "load-{lma,vma}" }, + { {"load-vma", no_argument, NULL, OPTION_LOAD_VMA}, + '\0', NULL, "", standard_option_handler, "" }, +#endif + { {NULL, no_argument, NULL, 0}, '\0', NULL, NULL, NULL } }; @@ -394,6 +409,18 @@ standard_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt, break; } + case OPTION_LOAD_LMA: + { + STATE_LOAD_AT_LMA_P (sd) = 1; + break; + } + + case OPTION_LOAD_VMA: + { + STATE_LOAD_AT_LMA_P (sd) = 0; + break; + } + case OPTION_HELP: sim_print_help (sd, is_command); if (STATE_OPEN_KIND (sd) == SIM_OPEN_STANDALONE) @@ -413,6 +440,9 @@ standard_install (SIM_DESC sd) SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); if (sim_add_option_table (sd, NULL, standard_options) != SIM_RC_OK) return SIM_RC_FAIL; +#ifdef SIM_HANDLES_LMA + STATE_LOAD_AT_LMA_P (sd) = SIM_HANDLES_LMA; +#endif return SIM_RC_OK; } diff --git a/sim/common/sim-resume.c b/sim/common/sim-resume.c index 09b475e..8cf75d5 100644 --- a/sim/common/sim-resume.c +++ b/sim/common/sim-resume.c @@ -70,6 +70,11 @@ sim_resume (SIM_DESC sd, if (next_cpu_nr >= nr_cpus) next_cpu_nr = 0; + /* Only deliver the siggnal ]sic] the first time through - don't + re-deliver any siggnal during a restart. */ + if (jmpval == sim_engine_restart_jmpval) + siggnal = 0; + #ifdef SIM_CPU_EXCEPTION_RESUME { sim_cpu* cpu = STATE_CPU (sd, next_cpu_nr); diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog index 04f0bc6..34c2798 100644 --- a/sim/mips/ChangeLog +++ b/sim/mips/ChangeLog @@ -1,3 +1,17 @@ +Mon Jul 12 00:02:27 1999 Andrew Cagney + + * interp.c (sim_monitor): Flush output before reading input. + +Sun Jul 11 19:28:11 1999 Andrew Cagney + + * tconfig.in (SIM_HANDLES_LMA): Always define. + +Thu Jul 8 16:06:59 1999 Andrew Cagney + + From Mark Salter : + * interp.c (BOARD_BSP): Define. Add to list of possible boards. + (sim_open): Add setup for BSP board. + Wed Jul 7 12:45:58 1999 Andrew Cagney * mips.igen (MULT, MULTU): Add syntax for two operand version. diff --git a/sim/mips/interp.c b/sim/mips/interp.c index a2ed20f..04383d3 100644 --- a/sim/mips/interp.c +++ b/sim/mips/interp.c @@ -257,6 +257,8 @@ static const OPTION mips_options[] = "|" BOARD_JMR3904_PAL #define BOARD_JMR3904_DEBUG "jmr3904debug" "|" BOARD_JMR3904_DEBUG +#define BOARD_BSP "bsp" + "|" BOARD_BSP , "Customize simulation for a particular board.", mips_option_handler }, @@ -352,12 +354,40 @@ sim_open (kind, cb, abfd, argv) device_init(sd); } - + else if (board != NULL + && (strcmp(board, BOARD_BSP) == 0)) + { + int i; + + STATE_ENVIRONMENT (sd) = OPERATING_ENVIRONMENT; + + /* ROM: 0x9FC0_0000 - 0x9FFF_FFFF and 0xBFC0_0000 - 0xBFFF_FFFF */ + sim_do_commandf (sd, "memory alias 0x%lx@1,0x%lx,0x%0x", + 0x9FC00000, + 4 * 1024 * 1024, /* 4 MB */ + 0xBFC00000); + + /* SRAM: 0x8000_0000 - 0x803F_FFFF and 0xA000_0000 - 0xA03F_FFFF */ + sim_do_commandf (sd, "memory alias 0x%lx@1,0x%lx,0x%0x", + 0x80000000, + 4 * 1024 * 1024, /* 4 MB */ + 0xA0000000); + + /* DRAM: 0x8800_0000 - 0x89FF_FFFF and 0xA800_0000 - 0xA9FF_FFFF */ + for (i=0; i<8; i++) /* 32 MB total */ + { + unsigned size = 4 * 1024 * 1024; /* 4 MB */ + sim_do_commandf (sd, "memory alias 0x%lx@1,0x%lx,0x%0x", + 0x88000000 + (i * size), + size, + 0xA8000000 + (i * size)); + } + } #if (WITH_HW) - if (board != NULL - && (strcmp(board, BOARD_JMR3904) == 0 || - strcmp(board, BOARD_JMR3904_PAL) == 0 || - strcmp(board, BOARD_JMR3904_DEBUG) == 0)) + else if (board != NULL + && (strcmp(board, BOARD_JMR3904) == 0 || + strcmp(board, BOARD_JMR3904_PAL) == 0 || + strcmp(board, BOARD_JMR3904_DEBUG) == 0)) { /* match VIRTUAL memory layout of JMR-TX3904 board */ int i; @@ -973,6 +1003,8 @@ sim_monitor (SIM_DESC sd, case 11: /* char inbyte(void) */ { char tmp; + /* ensure that all output has gone... */ + sim_io_flush_stdout (sd); if (sim_io_read_stdin (sd, &tmp, sizeof(char)) != sizeof(char)) { sim_io_error(sd,"Invalid return from character read"); diff --git a/sim/mips/tconfig.in b/sim/mips/tconfig.in index e8062a3..d591474 100644 --- a/sim/mips/tconfig.in +++ b/sim/mips/tconfig.in @@ -12,6 +12,8 @@ MODULE_INSTALL_FN dv_sockser_install; #define MODULE_LIST dv_sockser_install, +#else +#define SIM_HANDLES_LMA 0 #endif /* Define this if the simulator supports profiling. -- cgit v1.1