Format code
This commit is contained in:
@ -28,7 +28,8 @@ static void test_arm64_until()
|
|||||||
uint64_t r_pc = 0x00000000;
|
uint64_t r_pc = 0x00000000;
|
||||||
uint64_t r_x28 = 0x12341234;
|
uint64_t r_x28 = 0x12341234;
|
||||||
|
|
||||||
uc_common_setup(&uc, UC_ARCH_ARM64, UC_MODE_ARM, code, sizeof(code) - 1, UC_CPU_AARCH64_A72);
|
uc_common_setup(&uc, UC_ARCH_ARM64, UC_MODE_ARM, code, sizeof(code) - 1,
|
||||||
|
UC_CPU_AARCH64_A72);
|
||||||
|
|
||||||
// initialize machine registers
|
// initialize machine registers
|
||||||
OK(uc_reg_write(uc, UC_ARM64_REG_X16, &r_x16));
|
OK(uc_reg_write(uc, UC_ARM64_REG_X16, &r_x16));
|
||||||
@ -55,7 +56,8 @@ static void test_arm64_code_patching()
|
|||||||
{
|
{
|
||||||
uc_engine *uc;
|
uc_engine *uc;
|
||||||
char code[] = "\x00\x04\x00\x11"; // add w0, w0, 0x1
|
char code[] = "\x00\x04\x00\x11"; // add w0, w0, 0x1
|
||||||
uc_common_setup(&uc, UC_ARCH_ARM64, UC_MODE_ARM, code, sizeof(code) - 1, UC_CPU_AARCH64_A72);
|
uc_common_setup(&uc, UC_ARCH_ARM64, UC_MODE_ARM, code, sizeof(code) - 1,
|
||||||
|
UC_CPU_AARCH64_A72);
|
||||||
// zero out x0
|
// zero out x0
|
||||||
uint64_t r_x0 = 0x0;
|
uint64_t r_x0 = 0x0;
|
||||||
OK(uc_reg_write(uc, UC_ARM64_REG_X0, &r_x0));
|
OK(uc_reg_write(uc, UC_ARM64_REG_X0, &r_x0));
|
||||||
@ -84,7 +86,8 @@ static void test_arm64_code_patching_count()
|
|||||||
{
|
{
|
||||||
uc_engine *uc;
|
uc_engine *uc;
|
||||||
char code[] = "\x00\x04\x00\x11"; // add w0, w0, 0x1
|
char code[] = "\x00\x04\x00\x11"; // add w0, w0, 0x1
|
||||||
uc_common_setup(&uc, UC_ARCH_ARM64, UC_MODE_ARM, code, sizeof(code) - 1, UC_CPU_AARCH64_A72);
|
uc_common_setup(&uc, UC_ARCH_ARM64, UC_MODE_ARM, code, sizeof(code) - 1,
|
||||||
|
UC_CPU_AARCH64_A72);
|
||||||
// zero out x0
|
// zero out x0
|
||||||
uint64_t r_x0 = 0x0;
|
uint64_t r_x0 = 0x0;
|
||||||
OK(uc_reg_write(uc, UC_ARM64_REG_X0, &r_x0));
|
OK(uc_reg_write(uc, UC_ARM64_REG_X0, &r_x0));
|
||||||
@ -110,12 +113,14 @@ static void test_arm64_code_patching_count()
|
|||||||
OK(uc_close(uc));
|
OK(uc_close(uc));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_arm64_v8_pac() {
|
static void test_arm64_v8_pac()
|
||||||
|
{
|
||||||
uc_engine *uc;
|
uc_engine *uc;
|
||||||
char code[] = "\x28\xfd\xea\xc8"; // casal x10, x8, [x9]
|
char code[] = "\x28\xfd\xea\xc8"; // casal x10, x8, [x9]
|
||||||
uint64_t r_x9, r_x8, mem;
|
uint64_t r_x9, r_x8, mem;
|
||||||
|
|
||||||
uc_common_setup(&uc, UC_ARCH_ARM64, UC_MODE_ARM, code, sizeof(code) - 1, UC_CPU_AARCH64_MAX);
|
uc_common_setup(&uc, UC_ARCH_ARM64, UC_MODE_ARM, code, sizeof(code) - 1,
|
||||||
|
UC_CPU_AARCH64_MAX);
|
||||||
|
|
||||||
OK(uc_mem_map(uc, 0x40000, 0x1000, UC_PROT_ALL));
|
OK(uc_mem_map(uc, 0x40000, 0x1000, UC_PROT_ALL));
|
||||||
OK(uc_mem_write(uc, 0x40000, "\x00\x00\x00\x00\x00\x00\x00\x00", 8));
|
OK(uc_mem_write(uc, 0x40000, "\x00\x00\x00\x00\x00\x00\x00\x00", 8));
|
||||||
@ -126,7 +131,7 @@ static void test_arm64_v8_pac() {
|
|||||||
|
|
||||||
OK(uc_emu_start(uc, code_start, code_start + sizeof(code) - 1, 0, 0));
|
OK(uc_emu_start(uc, code_start, code_start + sizeof(code) - 1, 0, 0));
|
||||||
|
|
||||||
OK(uc_mem_read(uc, 0x40000, (void*)&mem, 8));
|
OK(uc_mem_read(uc, 0x40000, (void *)&mem, 8));
|
||||||
|
|
||||||
TEST_CHECK(mem == r_x8);
|
TEST_CHECK(mem == r_x8);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user