add new API uc_query() to query internal status of emulator at runtime

This commit is contained in:
Nguyen Anh Quynh
2016-01-23 17:14:44 +08:00
parent 9c2017e115
commit 4dbad9aa9b
4 changed files with 47 additions and 0 deletions

View File

@@ -108,6 +108,19 @@ static bool arm_stop_interrupt(int intno)
}
}
static uc_err arm_query(struct uc_struct *uc, uc_query_type type, size_t *result)
{
CPUState *mycpu = first_cpu;
switch(type) {
case UC_QUERY_ARM_MODE:
*result = (ARM_CPU(uc, mycpu)->env.thumb != 0);
return UC_ERR_OK;
default:
return UC_ERR_ARG;
}
}
void arm_uc_init(struct uc_struct* uc)
{
register_accel_types(uc);
@@ -118,5 +131,6 @@ void arm_uc_init(struct uc_struct* uc)
uc->reg_reset = arm_reg_reset;
uc->set_pc = arm_set_pc;
uc->stop_interrupt = arm_stop_interrupt;
uc->query = arm_query;
uc_common_init(uc);
}