Format code
This commit is contained in:
@@ -1799,11 +1799,10 @@ static void test_rex_x64(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool test_x86_ro_segfault_cb(uc_engine *uc, uc_mem_type type,
|
static bool test_x86_ro_segfault_cb(uc_engine *uc, uc_mem_type type,
|
||||||
uint64_t address, int size,
|
uint64_t address, int size, uint64_t value,
|
||||||
uint64_t value, void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
const char code[] =
|
const char code[] = "\xA1\x00\x10\x00\x00\xA1\x00\x10\x00\x00";
|
||||||
"\xA1\x00\x10\x00\x00\xA1\x00\x10\x00\x00";
|
|
||||||
OK(uc_mem_write(uc, address, code, sizeof(code) - 1));
|
OK(uc_mem_write(uc, address, code, sizeof(code) - 1));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1813,8 +1812,7 @@ static void test_x86_ro_segfault(void)
|
|||||||
uc_engine *uc;
|
uc_engine *uc;
|
||||||
// mov eax, [0x1000]
|
// mov eax, [0x1000]
|
||||||
// mov eax, [0x1000]
|
// mov eax, [0x1000]
|
||||||
const char code[] =
|
const char code[] = "\xA1\x00\x10\x00\x00\xA1\x00\x10\x00\x00";
|
||||||
"\xA1\x00\x10\x00\x00\xA1\x00\x10\x00\x00";
|
|
||||||
uint32_t out;
|
uint32_t out;
|
||||||
uc_hook hh;
|
uc_hook hh;
|
||||||
|
|
||||||
@@ -1823,7 +1821,8 @@ static void test_x86_ro_segfault(void)
|
|||||||
OK(uc_mem_write(uc, 0, code, sizeof(code) - 1));
|
OK(uc_mem_write(uc, 0, code, sizeof(code) - 1));
|
||||||
OK(uc_mem_map(uc, 0x1000, 0x1000, UC_PROT_READ));
|
OK(uc_mem_map(uc, 0x1000, 0x1000, UC_PROT_READ));
|
||||||
|
|
||||||
OK(uc_hook_add(uc, &hh, UC_HOOK_MEM_READ, test_x86_ro_segfault_cb, NULL, 1, 0));
|
OK(uc_hook_add(uc, &hh, UC_HOOK_MEM_READ, test_x86_ro_segfault_cb, NULL, 1,
|
||||||
|
0));
|
||||||
OK(uc_emu_start(uc, 0, sizeof(code) - 1, 0, 0));
|
OK(uc_emu_start(uc, 0, sizeof(code) - 1, 0, 0));
|
||||||
|
|
||||||
OK(uc_reg_read(uc, UC_X86_REG_EAX, (void *)&out));
|
OK(uc_reg_read(uc, UC_X86_REG_EAX, (void *)&out));
|
||||||
|
|||||||
Reference in New Issue
Block a user