This commit is contained in:
2021-11-01 09:41:25 +01:00
parent 3dd2e0f95d
commit 0a3e46bf4f
3 changed files with 16 additions and 36 deletions

View File

@@ -172,18 +172,21 @@ void cpu_stop_current(struct uc_struct *uc)
}
// Unicorn: Why addr - 1?
// 0: INC ecx
// 1: DEC edx <--- We put exit here, then the range of TB is [0, 1)
//
// While tb_invalidate_phys_range invalides [start, end)
//
// This function is designed to used with g_tree_foreach
static inline gboolean uc_exit_invalidate_iter(gpointer key, gpointer val, gpointer data) {
static inline gboolean uc_exit_invalidate_iter(gpointer key, gpointer val, gpointer data)
{
uint64_t exit = *((uint64_t*)key);
uc_engine* uc = (uc_engine*)data;
uc_engine *uc = (uc_engine*)data;
if (exit != 0) {
// Unicorn: Why addr - 1?
//
// 0: INC ecx
// 1: DEC edx <--- We put exit here, then the range of TB is [0, 1)
//
// While tb_invalidate_phys_range invalides [start, end)
//
// This function is designed to used with g_tree_foreach
uc->uc_invalidate_tb(uc, exit - 1, 1);
}