This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

default sim-run.c and sim_engine_run


it doesnt look like any current sim ports use the common sim-run.c code (and 
thus the default sim_engine_run implementation), so perhaps it has broken over 
time and no one noticed.  while porting the Blackfin sim port to common/ code, 
i tried using this function but it doesn't seem to work or make much sense.

void
sim_engine_run (SIM_DESC sd,
		int next_cpu_nr, /* ignore */
		int nr_cpus, /* ignore */
		int siggnal) /* ignore */
{
  sim_cia cia;
  sim_cpu *cpu;
  SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
  cpu = STATE_CPU (sd, 0);
  cia = CIA_GET (cpu);
  while (1)
    {
      instruction_word insn = IMEM32 (cia);
      cia = idecode_issue (sd, insn, cia);
      /* process any events */
      if (sim_events_tick (sd))
	{
	  CIA_SET (cpu, cia);
	  sim_events_process (sd);
	}
    }
}

if the idea here is to basically do:
	while (1) {
		<process current instruction>
		if (<check for pending events>) {
			<back up the PC>
			<process pending events>
		}
	}

how does this work ?  processing the current instruction (idecode_issue) 
modifies the current processor state and returns the old PC.  rolling back the  
PC doesnt roll back the processor state, so it makes it hard to do things like 
single step.  while many instructions are OK to repeat, obviously there are 
many that are not.  like an incrementing instruction.

so what am i missing here ?
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]