This commit is contained in:
Nguyen Anh Quynh 2016-01-10 23:10:00 +08:00
parent 036763d6ae
commit 580bc7b56a
4 changed files with 8 additions and 25 deletions

View File

@ -77,7 +77,7 @@ void pause_all_vcpus(struct uc_struct *uc)
CPUState *cpu; CPUState *cpu;
CPU_FOREACH(cpu) { CPU_FOREACH(cpu) {
qemu_thread_join(uc, cpu->thread); // qq: fix qemu_thread_join() to work for instance qemu_thread_join(uc, cpu->thread);
free(cpu->thread); free(cpu->thread);
cpu->thread = NULL; cpu->thread = NULL;
} }
@ -149,17 +149,6 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
} }
while (1) { while (1) {
#if 0
int count = 0;
if (count < 10) {
count++;
unsigned int eip = X86_CPU(mycpu)->env.eip;
printf(">>> current EIP = %x\n", eip);
printf(">>> ECX = %x\n", (unsigned int)X86_CPU(mycpu)->env.regs[R_ECX]);
printf(">>> EDX = %x\n", (unsigned int)X86_CPU(mycpu)->env.regs[R_EDX]);
}
#endif
if (tcg_exec_all(uc)) if (tcg_exec_all(uc))
break; break;
} }
@ -170,7 +159,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
qemu_cond_destroy(cpu->halt_cond); qemu_cond_destroy(cpu->halt_cond);
free(cpu->halt_cond); free(cpu->halt_cond);
#ifdef _WIN32 #ifdef _WIN32
if(cpu->hThread) if (cpu->hThread)
CloseHandle(cpu->hThread); CloseHandle(cpu->hThread);
#endif #endif
cpu->halt_cond = NULL; cpu->halt_cond = NULL;

View File

@ -78,17 +78,15 @@ static void release_common(void *t)
g_free(uc->system_memory); g_free(uc->system_memory);
if(uc->qemu_thread_data) if (uc->qemu_thread_data)
free(uc->qemu_thread_data); free(uc->qemu_thread_data);
#if TCG_TARGET_REG_BITS == 32 #if TCG_TARGET_REG_BITS == 32
for(int i = 0; i < s->nb_globals; i++) for(int i = 0; i < s->nb_globals; i++) {
{
TCGTemp *ts = &s->temps[i]; TCGTemp *ts = &s->temps[i];
if(ts->base_type == TCG_TYPE_I64) if (ts->base_type == TCG_TYPE_I64) {
{ if (ts->name && ((strcmp(ts->name+(strlen(ts->name)-2), "_0") == 0) ||
if(ts->name && ((strcmp(ts->name+(strlen(ts->name)-2), "_0") == 0) || (strcmp(ts->name+(strlen(ts->name)-2), "_1") == 0))) (strcmp(ts->name+(strlen(ts->name)-2), "_1") == 0))) {
{
free((void *)ts->name); free((void *)ts->name);
} }
} }

View File

@ -107,8 +107,7 @@ int machine_initialize(struct uc_struct *uc)
module_call_init(uc, MODULE_INIT_MACHINE); module_call_init(uc, MODULE_INIT_MACHINE);
// this will auto initialize all register objects above. // this will auto initialize all register objects above.
machine_class = find_default_machine(uc, uc->arch); machine_class = find_default_machine(uc, uc->arch);
if(!uc->machine_state) if (!uc->machine_state) {
{
if (machine_class == NULL) { if (machine_class == NULL) {
//fprintf(stderr, "No machine specified, and there is no default.\n" //fprintf(stderr, "No machine specified, and there is no default.\n"
// "Use -machine help to list supported machines!\n"); // "Use -machine help to list supported machines!\n");

3
uc.c
View File

@ -277,9 +277,6 @@ uc_err uc_close(uc_engine *uc)
free(uc->ram_list.dirty_memory[i]); free(uc->ram_list.dirty_memory[i]);
} }
// TODO: remove uc->root (created with object_new())
//uc->root->free(uc->root);
free(uc->hook_callbacks); free(uc->hook_callbacks);
free(uc->mapped_blocks); free(uc->mapped_blocks);