Exemple #1
0
static void
cortex_a9_step_once (conf_object_t* opaque)
{
	//ARMul_DoInstr(state);
	cortex_a9_core_t* core = (cortex_a9_core_t*)opaque->obj;
	ARMul_State *state = core->state;
	if(state->space.conf_obj == NULL){
		state->space.conf_obj = core->space->conf_obj;
		state->space.read = core->space->read;
		state->space.write = core->space->write;
	}

	state->step++;
	state->cycle++;
	state->EndCondition = 0;
	state->stop_simulator = 0;
	state->NextInstr = RESUME;      /* treat as PC change */
	state->last_pc = state->Reg[15];
	//core->space->read(core->space->conf_obj, state->Reg[15], state->last_instr, 4);
	//state->Reg[15] = ARMul_DoProg(state);
        state->Reg[15] = ARMul_DoInstr(state);
	//core->space->read(core->space->conf_obj, state->Reg[15], state->CurrInstr, 4);
	state->Cpsr = (state->Cpsr & 0x0fffffdf) | \
                     (state->NFlag << 31)   |                 \
                     (state->ZFlag << 30)   |                 \
                     (state->CFlag << 29)   |                 \
                     (state->VFlag << 28)   |		\
                     (state->TFlag << 5);

        FLUSHPIPE;
}
/// Execture next instruction
void ARM_Interpreter::ExecuteInstruction() {
    m_state->step++;
    m_state->cycle++;
    m_state->EndCondition = 0;
    m_state->stop_simulator = 0;
    m_state->NextInstr = RESUME;
    m_state->last_pc = m_state->Reg[15];
    m_state->Reg[15] = ARMul_DoInstr(m_state);
    m_state->Cpsr = ((m_state->Cpsr & 0x0fffffdf) | (m_state->NFlag << 31) | (m_state->ZFlag << 30) |
                     (m_state->CFlag << 29) | (m_state->VFlag << 28) | (m_state->TFlag << 5));
    m_state->NextInstr |= PRIMEPIPE; // Flush pipe
}
Exemple #3
0
void
sim_resume (SIM_DESC sd ATTRIBUTE_UNUSED,
	    int step,
	    int siggnal ATTRIBUTE_UNUSED)
{
  state->EndCondition = 0;
  stop_simulator = 0;

  if (step)
    {
      state->Reg[15] = ARMul_DoInstr (state);
      if (state->EndCondition == 0)
	state->EndCondition = RDIError_BreakpointReached;
    }
  else
    {
      state->NextInstr = RESUME;	/* treat as PC change */
      state->Reg[15] = ARMul_DoProg (state);
    }

  FLUSHPIPE;
}
Exemple #4
0
void
sim_resume (int step)
{
	/* workaround here: we have different run mode on arm */
	if(!strcmp(skyeye_config.arch->arch_name, "arm")){
		state->EndCondition = 0;
		stop_simulator = 0;

		if (step) {
			state->Reg[15] = ARMul_DoInstr (state);

			if (state->EndCondition == 0) {
				//chy 20050729 ????
				printf ("error in sim_resume for state->EndCondition");
				skyeye_exit (-1);
			}
		}
		else {
			state->NextInstr = RESUME;	/* treat as PC change */
			state->Reg[15] = ARMul_DoProg (state);
		}
		FLUSHPIPE;
	}
	/* other target simulator step run */
	else {
		do {
			/* if we are in remote debugmode we will check ctrl+c and breakpoint */
			if(remote_debugmode){
				int i;
				WORD addr;

				/* to detect if Ctrl+c is pressed.. */
				if(remote_interrupt())
					return;
				addr = arch_instance->get_pc();
				for (i = 0;i < skyeye_ice.num_bps;i++){
					if(skyeye_ice.bps[i] == addr)
            					return;
				} /* for */
                                if (skyeye_ice.tps_status==TRACE_STARTED)
                                {
                                    for (i=0;i<skyeye_ice.num_tps;i++)
                                    {
                                        if (((skyeye_ice.tps[i].tp_address==addr)&&             (skyeye_ice.tps[i].status==TRACEPOINT_ENABLED))||(skyeye_ice.tps[i].status==TRACEPOINT_STEPPING))
                                        {
                                            handle_tracepoint(i);
                                        }
                               	    }
                                }
			} /* if(remote_debugmode) */
			if (skyeye_config.log.logon >= 1) {
				WORD pc = arch_instance->get_pc();
				if (pc >= skyeye_config.log.start &&
					    pc <= skyeye_config.log.end) {
#if !defined(__MINGW32__)
					char * func_name = get_sym(pc);
					if(func_name)
						fprintf (skyeye_logfd,"\n in %s\n", func_name);
#endif
				/*
					if (skyeye_config.log.logon >= 2)
						fprintf (skyeye_logfd,
                                                         "pc=0x%x", pc);

						SKYEYE_OUTREGS (skyeye_logfd);
					if (skyeye_config.log.logon >= 3)
						SKYEYE_OUTMOREREGS
							(skyeye_logfd);
				*/
				}
			}/* if (skyeye_config.log.logon >= 1) */

			arch_instance->step_once ();
		}while(!step);
	}
}