check arguments, return error instead of raising exceptions. (#1125)
* check arguments, return error instaed of raising exceptions. close #1117. * remove empty lines. remove thr underscore prefix in function name.
This commit is contained in:
committed by
Nguyen Anh Quynh
parent
bc572be472
commit
23a426625f
@@ -795,6 +795,7 @@ int x86_reg_write(struct uc_struct *uc, unsigned int *regs, void *const *vals, i
|
||||
{
|
||||
CPUState *mycpu = uc->cpu;
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
unsigned int regid = regs[i];
|
||||
@@ -1015,21 +1016,45 @@ int x86_reg_write(struct uc_struct *uc, unsigned int *regs, void *const *vals, i
|
||||
uc_emu_stop(uc);
|
||||
break;
|
||||
case UC_X86_REG_CS:
|
||||
ret = uc_check_cpu_x86_load_seg(&X86_CPU(uc, mycpu)->env, R_CS, *(uint16_t *)value);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
cpu_x86_load_seg(&X86_CPU(uc, mycpu)->env, R_CS, *(uint16_t *)value);
|
||||
break;
|
||||
case UC_X86_REG_DS:
|
||||
ret = uc_check_cpu_x86_load_seg(&X86_CPU(uc, mycpu)->env, R_DS, *(uint16_t *)value);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
cpu_x86_load_seg(&X86_CPU(uc, mycpu)->env, R_DS, *(uint16_t *)value);
|
||||
break;
|
||||
case UC_X86_REG_SS:
|
||||
ret = uc_check_cpu_x86_load_seg(&X86_CPU(uc, mycpu)->env, R_SS, *(uint16_t *)value);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
cpu_x86_load_seg(&X86_CPU(uc, mycpu)->env, R_SS, *(uint16_t *)value);
|
||||
break;
|
||||
case UC_X86_REG_ES:
|
||||
ret = uc_check_cpu_x86_load_seg(&X86_CPU(uc, mycpu)->env, R_ES, *(uint16_t *)value);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
cpu_x86_load_seg(&X86_CPU(uc, mycpu)->env, R_ES, *(uint16_t *)value);
|
||||
break;
|
||||
case UC_X86_REG_FS:
|
||||
ret = uc_check_cpu_x86_load_seg(&X86_CPU(uc, mycpu)->env, R_FS, *(uint16_t *)value);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
cpu_x86_load_seg(&X86_CPU(uc, mycpu)->env, R_FS, *(uint16_t *)value);
|
||||
break;
|
||||
case UC_X86_REG_GS:
|
||||
ret = uc_check_cpu_x86_load_seg(&X86_CPU(uc, mycpu)->env, R_GS, *(uint16_t *)value);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
cpu_x86_load_seg(&X86_CPU(uc, mycpu)->env, R_GS, *(uint16_t *)value);
|
||||
break;
|
||||
case UC_X86_REG_IDTR:
|
||||
@@ -1226,9 +1251,17 @@ int x86_reg_write(struct uc_struct *uc, unsigned int *regs, void *const *vals, i
|
||||
X86_CPU(uc, mycpu)->env.segs[R_ES].selector = *(uint16_t *)value;
|
||||
break;
|
||||
case UC_X86_REG_FS:
|
||||
ret = uc_check_cpu_x86_load_seg(&X86_CPU(uc, mycpu)->env, R_FS, *(uint16_t *)value);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
cpu_x86_load_seg(&X86_CPU(uc, mycpu)->env, R_FS, *(uint16_t *)value);
|
||||
break;
|
||||
case UC_X86_REG_GS:
|
||||
ret = uc_check_cpu_x86_load_seg(&X86_CPU(uc, mycpu)->env, R_GS, *(uint16_t *)value);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
cpu_x86_load_seg(&X86_CPU(uc, mycpu)->env, R_GS, *(uint16_t *)value);
|
||||
break;
|
||||
case UC_X86_REG_R8:
|
||||
|
||||
Reference in New Issue
Block a user