X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=sim%2Fv850%2Finterp.c;h=1ca248ca3e9864226397753ce0fa18ae86657834;hb=38f48d729d916673434b57dabd7e88e637544033;hp=35320116a4e65f7eeccebc94346c155a1fb7a05d;hpb=a72f8fb439a16152c6c03d1e07c4fbec9c6a85dc;p=deliverable%2Fbinutils-gdb.git diff --git a/sim/v850/interp.c b/sim/v850/interp.c index 35320116a4..1ca248ca3e 100644 --- a/sim/v850/interp.c +++ b/sim/v850/interp.c @@ -1,7 +1,8 @@ -#include #include "sim-main.h" #include "sim-options.h" #include "v850_sim.h" +#include "sim-assert.h" +#include "itable.h" #ifdef HAVE_STDLIB_H #include @@ -25,6 +26,7 @@ #endif #endif +static const char * get_insn_name (sim_cpu *, int); /* For compatibility */ SIM_DESC simulator; @@ -173,6 +175,14 @@ do_interrupt (sd, data) inttype); } +/* Return name of an insn, used by insn profiling. */ + +static const char * +get_insn_name (sim_cpu *cpu, int i) +{ + return itable[i].name; +} + /* These default values correspond to expected usage for the chip. */ uint32 OP[4]; @@ -182,12 +192,14 @@ SIM_DESC sim_open (kind, cb, abfd, argv) SIM_OPEN_KIND kind; host_callback *cb; - struct _bfd *abfd; + struct bfd *abfd; char **argv; { SIM_DESC sd = sim_state_alloc (kind, cb); int mach; + SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); + /* for compatibility */ simulator = sd; @@ -197,6 +209,10 @@ sim_open (kind, cb, abfd, argv) STATE_WATCHPOINTS (sd)->interrupt_handler = do_interrupt; STATE_WATCHPOINTS (sd)->interrupt_names = interrupt_names; + /* Initialize the mechanism for doing insn profiling. */ + CPU_INSN_NAME (STATE_CPU (sd, 0)) = get_insn_name; + CPU_MAX_INSNS (STATE_CPU (sd, 0)) = nr_itable_entries; + if (sim_pre_argv_init (sd, argv[0]) != SIM_RC_OK) return 0; @@ -260,20 +276,11 @@ sim_open (kind, cb, abfd, argv) switch (mach) { case bfd_mach_v850: - /* start-sanitize-v850e */ case bfd_mach_v850e: - /* end-sanitize-v850e */ + case bfd_mach_v850e1: STATE_CPU (sd, 0)->psw_mask = (PSW_NP | PSW_EP | PSW_ID | PSW_SAT | PSW_CY | PSW_OV | PSW_S | PSW_Z); break; - /* start-sanitize-v850eq */ - case bfd_mach_v850eq: - PSW |= PSW_US; - STATE_CPU (sd, 0)->psw_mask = (PSW_US - | PSW_NP | PSW_EP | PSW_ID | PSW_SAT - | PSW_CY | PSW_OV | PSW_S | PSW_Z); - break; - /* end-sanitize-v850eq */ } return sd; @@ -288,57 +295,39 @@ sim_close (sd, quitting) sim_module_uninstall (sd); } -int -sim_stop (sd) - SIM_DESC sd; -{ - return 0; -} - -void -sim_info (sd, verbose) - SIM_DESC sd; - int verbose; -{ - profile_print (sd, STATE_VERBOSE_P (sd), NULL, NULL); -} - SIM_RC sim_create_inferior (sd, prog_bfd, argv, env) SIM_DESC sd; - struct _bfd *prog_bfd; + struct bfd *prog_bfd; char **argv; char **env; { memset (&State, 0, sizeof (State)); if (prog_bfd != NULL) PC = bfd_get_start_address (prog_bfd); - /* start-sanitize-v850eq */ - /* For v850eq, set PSW[US] by default */ - if (STATE_ARCHITECTURE (sd) != NULL - && STATE_ARCHITECTURE (sd)->arch == bfd_arch_v850 - && STATE_ARCHITECTURE (sd)->mach == bfd_mach_v850eq) - PSW |= PSW_US; - /* end-sanitize-v850eq */ return SIM_RC_OK; } -void -sim_fetch_register (sd, rn, memory) +int +sim_fetch_register (sd, rn, memory, length) SIM_DESC sd; int rn; unsigned char *memory; + int length; { *(unsigned32*)memory = H2T_4 (State.regs[rn]); + return -1; } -void -sim_store_register (sd, rn, memory) +int +sim_store_register (sd, rn, memory, length) SIM_DESC sd; int rn; unsigned char *memory; + int length; { State.regs[rn] = T2H_4 (*(unsigned32*)memory); + return -1; } void