verify hardware mode for ARM. this fixes issue #16

This commit is contained in:
Nguyen Anh Quynh
2015-08-24 09:50:55 +08:00
parent cd072b4e20
commit bb34eebd24
2 changed files with 25 additions and 4 deletions

8
uc.c
View File

@ -177,6 +177,14 @@ uc_err uc_open(uc_arch arch, uc_mode mode, uch *handle)
#ifdef UNICORN_HAS_ARM
case UC_ARCH_ARM:
uc->init_arch = arm_uc_init;
// verify mode
if (mode != UC_MODE_ARM && mode != UC_MODE_THUMB) {
*handle = 0;
free(uc);
return UC_ERR_MODE;
}
if (mode == UC_MODE_THUMB)
uc->thumb = 1;
break;