void arm_dyncom_init(arm_core_t* core){ cpu_t* cpu = cpu_new(0, 0, arm_arch_func); /* init the reg structure */ cpu->rf.pc = &core->Reg[15]; cpu->rf.phys_pc = &core->Reg[15]; cpu->rf.grf = core->Reg; cpu->rf.srf = core->Spsr; cpu->cpu_data = (conf_object_t*)core; core->dyncom_cpu = get_conf_obj_by_cast(cpu, "cpu_t"); cpu->debug_func = arm_debug_func; sky_pref_t *pref = get_skyeye_pref(); if(pref->user_mode_sim){ cpu->syscall_func = arm_dyncom_syscall; } else cpu->syscall_func = NULL; cpu->dyncom_engine->code_start = 0x8000; cpu->dyncom_engine->code_end = 0x100000; cpu->dyncom_engine->code_entry = 0x80d0; return; }
static bool arm_cpu_init() { skyeye_config_t* config = get_current_config(); machine_config_t *mach = config->mach; ARM_CPU_State* cpu = (ARM_CPU_State*)skyeye_mm_zero(sizeof(ARM_CPU_State)); if(!cpu){ skyeye_log(Critical_log, __FUNCTION__, "Can not allocate the enough memory for cpu.\n"); skyeye_exit(-1); } mach->cpu_data = get_conf_obj_by_cast(cpu, "ARM_CPU_State"); cpu->core_num = 1; if(!cpu->core_num){ skyeye_log(Critical_log, __FUNCTION__, "Can not get the core number or set wrong mach name?\n"); skyeye_exit(-1); } else cpu->core = (arm_core_t*)skyeye_mm(sizeof(arm_core_t) * cpu->core_num); /* TODO: zero the memory by malloc */ if(!cpu->core){ skyeye_log(Critical_log, __FUNCTION__, "Can not allocate memory for ppc core.\n"); skyeye_exit(-1); } else skyeye_log(Info_log, __FUNCTION__, "Initilization for %d core\n", cpu->core_num); int i; for(i = 0; i < cpu->core_num; i++){ arm_core_t* core = &cpu->core[i]; arm_core_init(core, i); arm_dyncom_init(core); skyeye_exec_t* exec = create_exec(); //exec->priv_data = get_conf_obj_by_cast(core, "arm_core_t"); exec->priv_data = (conf_object_t*)core; exec->run = (void (*)(conf_object_t*))per_cpu_step; exec->stop = (void (*)(conf_object_t*))per_cpu_stop; add_to_default_cell(exec); } cpu->boot_core_id = 0; return true; }
void mips_dyncom_init(mips_core_t *core) { cpu_t* cpu = cpu_new(0, 0, arch_func_mips); /* init the reg structure */ cpu->rf.pc = &core->pc; cpu->rf.phys_pc = &core->pc; cpu->rf.grf = core->gpr; cpu->rf.frf = core->fpr; cpu->rf.srf = core->cp0; cpu_set_flags_debug(cpu, 0 | CPU_DEBUG_PRINT_IR | CPU_DEBUG_LOG ); cpu_set_flags_codegen(cpu, CPU_CODEGEN_TAG_LIMIT); cpu->cpu_data = (conf_object_t*)core; core->dyncom_cpu = get_conf_obj_by_cast(cpu, "cpu_t"); cpu->debug_func = mips_debug_func; sky_pref_t *pref = get_skyeye_pref(); set_memory_operator(arch_mips_read_memory, arch_mips_write_memory); if(pref->user_mode_sim){ //cpu->syscall_func = mips_dyncom_syscall; cpu->syscall_func = NULL; } else cpu->syscall_func = NULL; cpu->dyncom_engine->code_start = 0x0; cpu->dyncom_engine->code_end = 0x100000; cpu->dyncom_engine->code_entry = 0x0; return; }