Line 107... |
Line 107... |
PRINTF("%08x %s\n", insn, disassembled);
|
PRINTF("%08x %s\n", insn, disassembled);
|
i += 4;
|
i += 4;
|
}
|
}
|
}
|
}
|
|
|
/* Schedules the next job so that it will run after the next instruction */
|
|
static void sched_next_insn(void (*func)(void *))
|
|
{
|
|
int32_t cycles = 1;
|
|
struct sched_entry *cur = scheduler.job_queue;
|
|
|
|
/* The cycles count of the jobs may go into negatives. If this happens, func
|
|
* will get called before the next instruction has executed. */
|
|
while(cur && (cur->time < 0)) {
|
|
cycles -= cur->time;
|
|
cur = cur->next;
|
|
}
|
|
|
|
SCHED_ADD(func, NULL, cycles);
|
|
}
|
|
|
|
/* Scheduler job that drops us back into interactive mode after the next
|
/* Scheduler job that drops us back into interactive mode after the next
|
* instruction has executed */
|
* instruction has executed */
|
void reenter_int(void *dat)
|
void reenter_int(void *dat)
|
{
|
{
|
if (!runtime.sim.hush) dumpreg();
|
if (!runtime.sim.hush) dumpreg();
|
Line 173... |
Line 157... |
}
|
}
|
|
|
static int sim_cmd_trace(int argc, char **argv) /* trace */
|
static int sim_cmd_trace(int argc, char **argv) /* trace */
|
{
|
{
|
runtime.sim.hush = 0;
|
runtime.sim.hush = 0;
|
sched_next_insn(reenter_int);
|
sched_next_insn(reenter_int, NULL);
|
return 1;
|
return 1;
|
}
|
}
|
|
|
static int sim_cmd_dm(int argc, char **argv) /* dump memory */
|
static int sim_cmd_dm(int argc, char **argv) /* dump memory */
|
{
|
{
|
Line 415... |
Line 399... |
void print_insn_exec(void *dat)
|
void print_insn_exec(void *dat)
|
{
|
{
|
dumpreg();
|
dumpreg();
|
if(runtime.cpu.instructions < to_insn_num) {
|
if(runtime.cpu.instructions < to_insn_num) {
|
/* Instruction count has not yet been reached, reschedule */
|
/* Instruction count has not yet been reached, reschedule */
|
sched_next_insn(print_insn_exec);
|
sched_next_insn(print_insn_exec, NULL);
|
return;
|
return;
|
}
|
}
|
handle_sim_command();
|
handle_sim_command();
|
}
|
}
|
|
|
Line 440... |
Line 424... |
* reschedule. */
|
* reschedule. */
|
SCHED_ADD(check_insn_exec, NULL, to_insn_num);
|
SCHED_ADD(check_insn_exec, NULL, to_insn_num);
|
} else {
|
} else {
|
/* The user wants to see the execution dumps. Schedule a task to show
|
/* The user wants to see the execution dumps. Schedule a task to show
|
* it to him after each cycle */
|
* it to him after each cycle */
|
sched_next_insn(print_insn_exec);
|
sched_next_insn(print_insn_exec, NULL);
|
}
|
}
|
to_insn_num += runtime.cpu.instructions;
|
to_insn_num += runtime.cpu.instructions;
|
} else {
|
} else {
|
if(!runtime.sim.hush)
|
if(!runtime.sim.hush)
|
sched_next_insn(print_insn_exec);
|
sched_next_insn(print_insn_exec, NULL);
|
}
|
}
|
} else
|
} else
|
/* Run 0 instructions */
|
/* Run 0 instructions */
|
return 0;
|
return 0;
|
|
|