Properly honor UNICORN_HAS_ (#757)

* Properly honor UNICORN_HAS_

* Oops missed that
This commit is contained in:
radare 2017-02-24 03:00:36 +01:00 committed by Nguyen Anh Quynh
parent 8f488a101c
commit 8acd6d47c9

21
uc.c
View file

@ -130,7 +130,6 @@ bool uc_arch_supported(uc_arch arch)
#ifdef UNICORN_HAS_X86 #ifdef UNICORN_HAS_X86
case UC_ARCH_X86: return true; case UC_ARCH_X86: return true;
#endif #endif
/* Invalid or disabled arch */ /* Invalid or disabled arch */
default: return false; default: return false;
} }
@ -535,11 +534,12 @@ uc_err uc_emu_start(uc_engine* uc, uint64_t begin, uint64_t until, uint64_t time
switch(uc->arch) { switch(uc->arch) {
default: default:
break; break;
#ifdef UNICORN_HAS_M68K
case UC_ARCH_M68K: case UC_ARCH_M68K:
uc_reg_write(uc, UC_M68K_REG_PC, &begin); uc_reg_write(uc, UC_M68K_REG_PC, &begin);
break; break;
#endif
#ifdef UNICORN_HAS_X86
case UC_ARCH_X86: case UC_ARCH_X86:
switch(uc->mode) { switch(uc->mode) {
default: default:
@ -555,24 +555,29 @@ uc_err uc_emu_start(uc_engine* uc, uint64_t begin, uint64_t until, uint64_t time
break; break;
} }
break; break;
#endif
#ifdef UNICORN_HAS_ARM
case UC_ARCH_ARM: case UC_ARCH_ARM:
uc_reg_write(uc, UC_ARM_REG_R15, &begin); uc_reg_write(uc, UC_ARM_REG_R15, &begin);
break; break;
#endif
#ifdef UNICORN_HAS_ARM64
case UC_ARCH_ARM64: case UC_ARCH_ARM64:
uc_reg_write(uc, UC_ARM64_REG_PC, &begin); uc_reg_write(uc, UC_ARM64_REG_PC, &begin);
break; break;
#endif
#ifdef UNICORN_HAS_MIPS
case UC_ARCH_MIPS: case UC_ARCH_MIPS:
// TODO: MIPS32/MIPS64/BIGENDIAN etc // TODO: MIPS32/MIPS64/BIGENDIAN etc
uc_reg_write(uc, UC_MIPS_REG_PC, &begin); uc_reg_write(uc, UC_MIPS_REG_PC, &begin);
break; break;
#endif
#ifdef UNICORN_HAS_SPARC
case UC_ARCH_SPARC: case UC_ARCH_SPARC:
// TODO: Sparc/Sparc64 // TODO: Sparc/Sparc64
uc_reg_write(uc, UC_SPARC_REG_PC, &begin); uc_reg_write(uc, UC_SPARC_REG_PC, &begin);
break; break;
#endif
} }
uc->stop_request = false; uc->stop_request = false;
@ -1138,8 +1143,10 @@ uc_err uc_query(uc_engine *uc, uc_query_type type, size_t *result)
} }
switch(uc->arch) { switch(uc->arch) {
#ifdef UNICORN_HAS_ARM
case UC_ARCH_ARM: case UC_ARCH_ARM:
return uc->query(uc, type, result); return uc->query(uc, type, result);
#endif
default: default:
return UC_ERR_ARG; return UC_ERR_ARG;
} }