void Java_org_deadc0de_apple2ix_Apple2Preferences_nativeSetCPUSpeed(JNIEnv *env, jclass cls, jint percentSpeed) { LOG("percentSpeed : %d%%", percentSpeed); #if TESTING cpu_scale_factor = CPU_SCALE_FASTEST; cpu_altscale_factor = CPU_SCALE_FASTEST; timing_initialize(); #else bool wasPaused = cpu_isPaused(); if (!wasPaused) { cpu_pause(); } cpu_scale_factor = percentSpeed/100.0; if (cpu_scale_factor > CPU_SCALE_FASTEST) { cpu_scale_factor = CPU_SCALE_FASTEST; } if (cpu_scale_factor < CPU_SCALE_SLOWEST) { cpu_scale_factor = CPU_SCALE_SLOWEST; } if (video_backend->animation_showCPUSpeed) { video_backend->animation_showCPUSpeed(); } timing_initialize(); if (!wasPaused) { cpu_resume(); } #endif }
static INTERRUPT_GEN( blockade_interrupt ) { cpu_resume(device, SUSPEND_ANY_REASON); if ((input_port_read(device->machine, "IN0") & 0x80) == 0) { just_been_reset = 1; cpu_set_input_line(device, INPUT_LINE_RESET, PULSE_LINE); } }
void resume_all_vcpus(void) { CPUState *cpu = first_cpu; qemu_clock_enable(QEMU_CLOCK_VIRTUAL, true); while (cpu) { cpu_resume(cpu); cpu = cpu->next_cpu; } }
void Java_org_deadc0de_apple2ix_Apple2Activity_nativeEmulationResume(JNIEnv *env, jobject obj) { if (!cpu_isPaused()) { return; } LOG("..."); #if TESTING // test driver thread is managing CPU #else cpu_resume(); #endif }
void Java_org_deadc0de_apple2ix_Apple2Activity_nativeOnQuit(JNIEnv *env, jobject obj) { #if TESTING // test driver thread is managing CPU #else appState = APP_REQUESTED_SHUTDOWN; LOG("..."); disk6_eject(0); disk6_eject(1); cpu_resume(); #endif }
int resume_all_vcpus(struct uc_struct *uc) { CPUState *cpu = uc->cpu; // Fix call multiple time (vu). // We have to check whether this is the second time, then reset all CPU. if (!cpu->created) { cpu->created = true; cpu->halted = 0; if (qemu_init_vcpu(cpu)) return -1; } //qemu_clock_enable(QEMU_CLOCK_VIRTUAL, true); cpu_resume(cpu); qemu_tcg_cpu_loop(uc); return 0; }
bool emu_start(unsigned int port_gdb, unsigned int port_rdbg, const char *snapshot_file) { gui_busy_raii gui_busy; if(snapshot_file) { // Open snapshot size_t snapshot_size = gzip_filesize(snapshot_file); if(snapshot_size < sizeof(emu_snapshot)) return false; FILE *fp = fopen_utf8(snapshot_file, "rb"); if(!fp) return false; int dupfd = dup(fileno(fp)); fclose(fp); fp = nullptr; // gzdopen takes ownership of the fd gzFile gzf = gzdopen(dupfd, "r"); if(!gzf) { close(dupfd); return false; } auto snapshot = (struct emu_snapshot *) malloc(snapshot_size); if(!snapshot) { gzclose(gzf); return false; } if((size_t) gzread(gzf, snapshot, snapshot_size) != snapshot_size) { gzclose(gzf); free(snapshot); return false; } gzclose(gzf); //sched_reset(); sched.items[SCHED_THROTTLE].clock = CLOCK_27M; sched.items[SCHED_THROTTLE].proc = throttle_interval_event; // TODO: Max length path_boot1 = std::string(snapshot->path_boot1); path_flash = std::string(snapshot->path_flash); // TODO: Pass snapshot_size to flash_resume to avoid reading after the buffer // Resume components uint32_t sdram_size; if(snapshot->sig != SNAPSHOT_SIG || snapshot->version != SNAPSHOT_VER || !flash_resume(snapshot) || !flash_read_settings(&sdram_size, &product, &features, &asic_user_flags) || !cpu_resume(snapshot) || !memory_resume(snapshot) || !sched_resume(snapshot)) { emu_cleanup(); free(snapshot); return false; } free(snapshot); } else { if (!flash_open(path_flash.c_str())) return false; uint32_t sdram_size; flash_read_settings(&sdram_size, &product, &features, &asic_user_flags); flash_set_bootorder(boot_order); if(!memory_initialize(sdram_size)) { emu_cleanup(); return false; } } if(debug_on_start) cpu_events |= EVENT_DEBUG_STEP; uint8_t *rom = mem_areas[0].ptr; memset(rom, -1, 0x80000); for (int i = 0x00000; i < 0x80000; i += 4) RAM_FLAGS(&rom[i]) = RF_READ_ONLY; /* Load the ROM */ FILE *f = fopen_utf8(path_boot1.c_str(), "rb"); if (!f) { gui_perror(path_boot1.c_str()); emu_cleanup(); return false; } (void)fread(rom, 1, 0x80000, f); fclose(f); #ifndef NO_TRANSLATION if(!translate_init()) { gui_debug_printf("Could not init JIT, disabling translation.\n"); do_translate = false; } #endif addr_cache_init(); throttle_timer_on(); if(port_gdb) gdbstub_init(port_gdb); if(port_rdbg) rdebug_bind(port_rdbg); usblink_queue_reset(); if(!snapshot_file) emu_reset(); return true; }