本文整理汇总了C++中STATE_MAGIC函数的典型用法代码示例。如果您正苦于以下问题:C++ STATE_MAGIC函数的具体用法?C++ STATE_MAGIC怎么用?C++ STATE_MAGIC使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了STATE_MAGIC函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sim_engine_vabort
void
sim_engine_vabort (SIM_DESC sd,
sim_cpu *cpu,
sim_cia cia,
const char *fmt,
va_list ap)
{
ASSERT (sd == NULL || STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
if (sd == NULL)
{
vfprintf (stderr, fmt, ap);
fprintf (stderr, "\nQuit\n");
abort ();
}
else if (STATE_ENGINE (sd)->jmpbuf == NULL)
{
sim_io_evprintf (sd, fmt, ap);
sim_io_eprintf (sd, "\n");
sim_io_error (sd, "Quit Simulator");
abort ();
}
else
{
sim_io_evprintf (sd, fmt, ap);
sim_io_eprintf (sd, "\n");
sim_engine_halt (sd, cpu, NULL, cia, sim_stopped, SIM_SIGABRT);
}
}
示例2: sim_engine_install
SIM_RC
sim_engine_install (SIM_DESC sd)
{
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
sim_module_add_init_fn (sd, sim_engine_init);
return SIM_RC_OK;
}
示例3: control_c_simulation
static void
control_c_simulation (SIM_DESC sd,
void *data)
{
ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
sim_engine_halt (sd, NULL, NULL, NULL_CIA, sim_stopped, SIM_SIGINT);
}
示例4: sim_pre_argv_init
SIM_RC
sim_pre_argv_init (SIM_DESC sd, const char *myname)
{
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
SIM_ASSERT (STATE_MODULES (sd) == NULL);
STATE_MY_NAME (sd) = lbasename (myname);
/* Set the cpu names to default values. */
{
int i;
for (i = 0; i < MAX_NR_PROCESSORS; ++i)
{
char *name;
if (asprintf (&name, "cpu%d", i) < 0)
return SIM_RC_FAIL;
CPU_NAME (STATE_CPU (sd, i)) = name;
}
}
sim_config_default (sd);
/* Install all configured in modules. */
if (sim_module_install (sd) != SIM_RC_OK)
return SIM_RC_FAIL;
return SIM_RC_OK;
}
示例5: sim_read
int
sim_read (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length)
{
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
return sim_core_read_buffer (sd, NULL, read_map,
buf, mem, length);
}
示例6: sim_engine_halt
void
sim_engine_halt (SIM_DESC sd,
sim_cpu *last_cpu,
sim_cpu *next_cpu, /* NULL - use default */
sim_cia cia,
enum sim_stop reason,
int sigrc)
{
sim_engine *engine = STATE_ENGINE (sd);
ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
if (engine->jmpbuf != NULL)
{
jmp_buf *halt_buf = engine->jmpbuf;
engine->last_cpu = last_cpu;
engine->next_cpu = next_cpu;
engine->reason = reason;
engine->sigrc = sigrc;
SIM_ENGINE_HALT_HOOK (sd, last_cpu, cia);
#ifdef SIM_CPU_EXCEPTION_SUSPEND
if (last_cpu != NULL && reason != sim_exited)
SIM_CPU_EXCEPTION_SUSPEND (sd, last_cpu, sim_signal_to_host (sd, sigrc));
#endif
longjmp (*halt_buf, sim_engine_halt_jmpval);
}
else
{
sim_io_error (sd, "sim_halt - bad long jump");
abort ();
}
}
示例7: sim_write
int
sim_write (SIM_DESC sd, SIM_ADDR mem, const unsigned char *buf, int length)
{
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
return sim_core_write_buffer (sd, NULL, write_map,
buf, mem, length);
}
示例8: sim_stop_reason
void
sim_stop_reason (SIM_DESC sd, enum sim_stop *reason, int *sigrc)
{
sim_engine *engine = NULL;
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
engine = STATE_ENGINE (sd);
*reason = engine->reason;
switch (*reason)
{
case sim_exited :
*sigrc = engine->sigrc;
break;
case sim_signalled :
/* ??? See the comment below case `sim_signalled' in
gdb/remote-sim.c:gdbsim_wait.
??? Consider the case of the target requesting that it
kill(2) itself with SIGNAL. That SIGNAL, being target
specific, will not correspond to either of the SIM_SIGNAL
enum nor the HOST_SIGNAL. A mapping from TARGET_SIGNAL to
HOST_SIGNAL is needed. */
*sigrc = sim_signal_to_host (sd, engine->sigrc);
break;
case sim_stopped :
/* The gdb/simulator interface calls for us to return the host
version of the signal which gdb then converts into the
target's version. This is obviously a bit clumsy. */
*sigrc = sim_signal_to_host (sd, engine->sigrc);
break;
default :
abort ();
}
}
示例9: has_stepped
static void
has_stepped (SIM_DESC sd,
void *data)
{
ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
sim_engine_halt (sd, NULL, NULL, NULL_CIA, sim_stopped, SIM_SIGTRAP);
}
示例10: sim_resume
void
sim_resume (SIM_DESC sd,
int step,
int siggnal)
{
sim_engine *engine = STATE_ENGINE (sd);
jmp_buf buf;
int jmpval;
ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
/* we only want to be single stepping the simulator once */
if (engine->stepper != NULL)
{
sim_events_deschedule (sd, engine->stepper);
engine->stepper = NULL;
}
if (step)
engine->stepper = sim_events_schedule (sd, 1, has_stepped, sd);
sim_module_resume (sd);
/* run/resume the simulator */
engine->jmpbuf = &buf;
jmpval = setjmp (buf);
if (jmpval == sim_engine_start_jmpval
|| jmpval == sim_engine_restart_jmpval)
{
int last_cpu_nr = sim_engine_last_cpu_nr (sd);
int next_cpu_nr = sim_engine_next_cpu_nr (sd);
int nr_cpus = sim_engine_nr_cpus (sd);
int sig_to_deliver;
sim_events_preprocess (sd, last_cpu_nr >= nr_cpus, next_cpu_nr >= nr_cpus);
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. NOTE: A new local
variable is used to avoid problems with the automatic
variable ``siggnal'' being trashed by a long jump. */
if (jmpval == sim_engine_start_jmpval)
sig_to_deliver = siggnal;
else
sig_to_deliver = 0;
#ifdef SIM_CPU_EXCEPTION_RESUME
{
sim_cpu* cpu = STATE_CPU (sd, next_cpu_nr);
SIM_CPU_EXCEPTION_RESUME(sd, cpu, sig_to_deliver);
}
#endif
sim_engine_run (sd, next_cpu_nr, nr_cpus, sig_to_deliver);
}
engine->jmpbuf = NULL;
sim_module_suspend (sd);
}
示例11: sim_store_register
int
sim_store_register (SIM_DESC sd, int rn, unsigned char *buf, int length)
{
SIM_CPU *cpu = STATE_CPU (sd, 0);
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
return (* CPU_REG_STORE (cpu)) (cpu, rn, buf, length);
}
示例12: cris_option_install
SIM_RC
cris_option_install (SIM_DESC sd)
{
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
if (sim_add_option_table (sd, NULL, cris_options) != SIM_RC_OK)
return SIM_RC_FAIL;
return SIM_RC_OK;
}
示例13: sim_engine_set_run_state
void
sim_engine_set_run_state (SIM_DESC sd, enum sim_stop reason, int sigrc)
{
sim_engine *engine = STATE_ENGINE (sd);
ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
engine->reason = reason;
engine->sigrc = sigrc;
}
示例14: sim_memopt_install
SIM_RC
sim_memopt_install (SIM_DESC sd)
{
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
sim_add_option_table (sd, NULL, memory_options);
sim_module_add_uninstall_fn (sd, sim_memory_uninstall);
sim_module_add_init_fn (sd, sim_memory_init);
return SIM_RC_OK;
}
示例15: sim_stop
int
sim_stop (SIM_DESC sd)
{
ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
sim_events_schedule_after_signal (sd,
0 /*NOW*/,
control_c_simulation,
sd /*data*/);
return 1;
}