int debug;
-host_callback *sim_callback;
-
-static SIM_OPEN_KIND sim_kind;
-static char *myname;
-
/* FIXME: Needs to live in header file.
This header should also include the things in remote-sim.h.
One could move this to remote-sim.h but this function isn't needed
/* `msize' must be a power of two. */
if ((memory_size & (memory_size - 1)) != 0)
{
- (*sim_callback->printf_filtered)
- (sim_callback,
+ sim_io_printf
+ (sd,
"init_pointers: bad memory size %d, defaulting to %d.\n",
memory_size, memory_size = H8300S_MSIZE);
}
}
if (wreg[i] == 0 || wreg[i + 8] == 0)
- (*sim_callback->printf_filtered) (sim_callback,
- "init_pointers: internal error.\n");
+ sim_io_printf (sd, "init_pointers: internal error.\n");
h8_set_reg (sd, i, 0);
lreg[i] = h8_get_reg_buf (sd) + i;
int oldmask;
enum sim_stop reason;
int sigrc;
+ host_callback *sim_callback = STATE_CALLBACK (sd);
init_pointers (sd);
}
- (*sim_callback->printf_filtered) (sim_callback,
- "sim_resume: internal error.\n");
+ sim_io_printf (sd, "sim_resume: internal error.\n");
sim_engine_set_run_state (sd, sim_stopped, SIGILL);
goto end;
h8_set_pc (sd, intval);
break;
default:
- (*sim_callback->printf_filtered) (sim_callback,
- "sim_store_register: bad regnum %d.\n",
- rn);
+ sim_io_printf (sd, "sim_store_register: bad regnum %d.\n", rn);
case R0_REGNUM:
case R1_REGNUM:
case R2_REGNUM:
switch (rn)
{
default:
- (*sim_callback->printf_filtered) (sim_callback,
- "sim_fetch_register: bad regnum %d.\n",
- rn);
+ sim_io_printf (sd, "sim_fetch_register: bad regnum %d.\n", rn);
v = 0;
break;
case CCR_REGNUM:
double timetaken = (double) h8_get_ticks (sd) / (double) now_persec ();
double virttime = h8_get_cycles (sd) / 10.0e6;
- (*sim_callback->printf_filtered) (sim_callback,
- "\n\n#instructions executed %10d\n",
- h8_get_insts (sd));
- (*sim_callback->printf_filtered) (sim_callback,
- "#cycles (v approximate) %10d\n",
- h8_get_cycles (sd));
- (*sim_callback->printf_filtered) (sim_callback,
- "#real time taken %10.4f\n",
- timetaken);
- (*sim_callback->printf_filtered) (sim_callback,
- "#virtual time taken %10.4f\n",
- virttime);
+ sim_io_printf (sd, "\n\n#instructions executed %10d\n", h8_get_insts (sd));
+ sim_io_printf (sd, "#cycles (v approximate) %10d\n", h8_get_cycles (sd));
+ sim_io_printf (sd, "#real time taken %10.4f\n", timetaken);
+ sim_io_printf (sd, "#virtual time taken %10.4f\n", virttime);
if (timetaken != 0.0)
- (*sim_callback->printf_filtered) (sim_callback,
- "#simulation ratio %10.4f\n",
- virttime / timetaken);
- (*sim_callback->printf_filtered) (sim_callback,
- "#compiles %10d\n",
- h8_get_compiles (sd));
- (*sim_callback->printf_filtered) (sim_callback,
- "#cache size %10d\n",
- sd->sim_cache_size);
+ sim_io_printf (sd, "#simulation ratio %10.4f\n", virttime / timetaken);
+ sim_io_printf (sd, "#compiles %10d\n", h8_get_compiles (sd));
+ sim_io_printf (sd, "#cache size %10d\n", sd->sim_cache_size);
#ifdef ADEBUG
/* This to be conditional on `what' (aka `verbose'),
for (i = 0; i < O_LAST; i++)
{
if (h8_get_stats (sd, i))
- (*sim_callback->printf_filtered) (sim_callback, "%d: %d\n",
- i, h8_get_stats (sd, i));
+ sim_io_printf (sd, "%d: %d\n", i, h8_get_stats (sd, i));
}
}
#endif
/* FIXME: Much of the code in sim_load can be moved here. */
- sim_kind = kind;
- myname = argv[0];
- sim_callback = callback;
return sd;
}
/* `msize' must be a power of two. */
if ((memory_size & (memory_size - 1)) != 0)
{
- (*sim_callback->printf_filtered) (sim_callback,
- "sim_load: bad memory size.\n");
+ sim_io_printf (sd, "sim_load: bad memory size.\n");
return SIM_RC_FAIL;
}
h8_set_mask (sd, memory_size - 1);
- if (sim_load_file (sd, myname, sim_callback, prog, prog_bfd,
- sim_kind == SIM_OPEN_DEBUG,
+ if (sim_load_file (sd, STATE_MY_NAME (sd), STATE_CALLBACK (sd), prog,
+ prog_bfd, STATE_OPEN_KIND (sd) == SIM_OPEN_DEBUG,
0, sim_write)
== NULL)
{