Undo the disaster that was the patch to unicorn github issue #266 and fix it correctly. makes normal self-modifying code work.

This commit is contained in:
Andrew Dutcher
2016-07-14 09:40:45 -07:00
parent 236b6e9085
commit 97b10da133
9 changed files with 24 additions and 8 deletions

View File

@@ -179,12 +179,12 @@ static int cpu_gen_code(CPUArchState *env, TranslationBlock *tb, int *gen_code_s
gen_intermediate_code(env, tb);
// Unicorn: when tracing block, patch 1st operand for block size
if (env->uc->block_addr == tb->pc && HOOK_EXISTS_BOUNDED(env->uc, UC_HOOK_BLOCK, tb->pc)) {
// Unicorn: when tracing block, patch block size operand for callback
if (env->uc->size_arg != -1 && HOOK_EXISTS_BOUNDED(env->uc, UC_HOOK_BLOCK, tb->pc)) {
if (env->uc->block_full) // block size is unknown
*(s->gen_opparam_buf + 1) = 0;
*(s->gen_opparam_buf + env->uc->size_arg) = 0;
else
*(s->gen_opparam_buf + 1) = tb->size;
*(s->gen_opparam_buf + env->uc->size_arg) = tb->size;
}
/* generate machine code */