A stronger test and handle addr_end = 0
This commit is contained in:
@@ -633,7 +633,7 @@ static void test_x86_hook_cpuid()
|
||||
static void test_x86_clear_tb_cache()
|
||||
{
|
||||
uc_engine *uc;
|
||||
char code[] = "\x83\xc1\x01\x4a"; // INC ecx; DEC edx;
|
||||
char code[] = "\x83\xc1\x01\x4a"; // ADD ecx, 1; DEC edx;
|
||||
int r_ecx = 0x1234;
|
||||
int r_edx = 0x7890;
|
||||
uint64_t code_start = 0x1240; // Choose this address by design
|
||||
@@ -645,6 +645,10 @@ static void test_x86_clear_tb_cache()
|
||||
OK(uc_reg_write(uc, UC_X86_REG_ECX, &r_ecx));
|
||||
OK(uc_reg_write(uc, UC_X86_REG_EDX, &r_edx));
|
||||
|
||||
// This emulation should take no effect at all.
|
||||
OK(uc_emu_start(uc, code_start, code_start, 0, 0));
|
||||
|
||||
// Emulate ADD ecx, 1.
|
||||
OK(uc_emu_start(uc, code_start, code_start + 3, 0, 0));
|
||||
|
||||
// If tb cache is not cleared, edx would be still 0x7890
|
||||
|
||||
Reference in New Issue
Block a user