From 0886e53572524f79f9a8ad77a70c7a40e20e791a Mon Sep 17 00:00:00 2001 From: lazymio Date: Sun, 6 Oct 2024 23:32:16 +0800 Subject: [PATCH] Format code --- include/unicorn/unicorn.h | 2 +- qemu/target/i386/unicorn.c | 10 +++++----- qemu/target/tricore/unicorn.c | 2 +- tests/unit/test_x86.c | 19 +++++++++---------- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/include/unicorn/unicorn.h b/include/unicorn/unicorn.h index 7bee9b802f..791cfa6df9 100644 --- a/include/unicorn/unicorn.h +++ b/include/unicorn/unicorn.h @@ -65,7 +65,7 @@ typedef size_t uc_hook; #define UNICORN_DEPRECATED __declspec(deprecated) #else #pragma message( \ - "WARNING: You need to implement UNICORN_DEPRECATED for this compiler") + "WARNING: You need to implement UNICORN_DEPRECATED for this compiler") #define UNICORN_DEPRECATED #endif diff --git a/qemu/target/i386/unicorn.c b/qemu/target/i386/unicorn.c index 2ed4ca336f..3d6968b9b4 100644 --- a/qemu/target/i386/unicorn.c +++ b/qemu/target/i386/unicorn.c @@ -287,7 +287,7 @@ uc_err reg_read(void *_env, int mode, unsigned int regid, void *value, case UC_X86_REG_XMM7: { CHECK_REG_TYPE(uint64_t[2]); uint64_t *dst = (uint64_t *)value; - const ZMMReg* const reg = &env->xmm_regs[regid - UC_X86_REG_XMM0]; + const ZMMReg *const reg = &env->xmm_regs[regid - UC_X86_REG_XMM0]; dst[0] = reg->ZMM_Q(0); dst[1] = reg->ZMM_Q(1); return ret; @@ -314,7 +314,7 @@ uc_err reg_read(void *_env, int mode, unsigned int regid, void *value, case UC_X86_REG_YMM7: { CHECK_REG_TYPE(uint64_t[4]); uint64_t *dst = (uint64_t *)value; - const ZMMReg* const reg = &env->xmm_regs[regid - UC_X86_REG_YMM0]; + const ZMMReg *const reg = &env->xmm_regs[regid - UC_X86_REG_YMM0]; dst[0] = reg->ZMM_Q(0); dst[1] = reg->ZMM_Q(1); dst[2] = reg->ZMM_Q(2); @@ -978,7 +978,7 @@ uc_err reg_read(void *_env, int mode, unsigned int regid, void *value, case UC_X86_REG_XMM31: { CHECK_REG_TYPE(uint64_t[2]); uint64_t *dst = (uint64_t *)value; - const ZMMReg* const reg = &env->xmm_regs[regid - UC_X86_REG_XMM0]; + const ZMMReg *const reg = &env->xmm_regs[regid - UC_X86_REG_XMM0]; dst[0] = reg->ZMM_Q(0); dst[1] = reg->ZMM_Q(1); break; @@ -1009,7 +1009,7 @@ uc_err reg_read(void *_env, int mode, unsigned int regid, void *value, case UC_X86_REG_YMM31: { CHECK_REG_TYPE(uint64_t[4]); uint64_t *dst = (uint64_t *)value; - const ZMMReg* const reg = &env->xmm_regs[regid - UC_X86_REG_YMM0]; + const ZMMReg *const reg = &env->xmm_regs[regid - UC_X86_REG_YMM0]; dst[0] = reg->ZMM_Q(0); dst[1] = reg->ZMM_Q(1); dst[2] = reg->ZMM_Q(2); @@ -1050,7 +1050,7 @@ uc_err reg_read(void *_env, int mode, unsigned int regid, void *value, case UC_X86_REG_ZMM31: { CHECK_REG_TYPE(uint64_t[8]); uint64_t *dst = (uint64_t *)value; - const ZMMReg* const reg = &env->xmm_regs[regid - UC_X86_REG_ZMM0]; + const ZMMReg *const reg = &env->xmm_regs[regid - UC_X86_REG_ZMM0]; dst[0] = reg->ZMM_Q(0); dst[1] = reg->ZMM_Q(1); dst[2] = reg->ZMM_Q(2); diff --git a/qemu/target/tricore/unicorn.c b/qemu/target/tricore/unicorn.c index 43a31f5482..ba27a26481 100644 --- a/qemu/target/tricore/unicorn.c +++ b/qemu/target/tricore/unicorn.c @@ -241,7 +241,7 @@ uc_err reg_write(void *_env, int mode, unsigned int regid, const void *value, break; } } - + CHECK_RET_DEPRECATE(ret, regid); return ret; } diff --git a/tests/unit/test_x86.c b/tests/unit/test_x86.c index a7d3909aab..c3d0b15776 100644 --- a/tests/unit/test_x86.c +++ b/tests/unit/test_x86.c @@ -1799,22 +1799,20 @@ static void test_rex_x64(void) } static bool test_x86_ro_segfault_cb(uc_engine *uc, uc_mem_type type, - uint64_t address, int size, - uint64_t value, void *user_data) + uint64_t address, int size, uint64_t value, + void *user_data) { - const char code[] = - "\xA1\x00\x10\x00\x00\xA1\x00\x10\x00\x00"; + const char code[] = "\xA1\x00\x10\x00\x00\xA1\x00\x10\x00\x00"; OK(uc_mem_write(uc, address, code, sizeof(code) - 1)); return true; } static void test_x86_ro_segfault(void) { - uc_engine* uc; + uc_engine *uc; // mov eax, [0x1000] // mov eax, [0x1000] - const char code[] = - "\xA1\x00\x10\x00\x00\xA1\x00\x10\x00\x00"; + const char code[] = "\xA1\x00\x10\x00\x00\xA1\x00\x10\x00\x00"; uint32_t out; uc_hook hh; @@ -1822,11 +1820,12 @@ static void test_x86_ro_segfault(void) OK(uc_mem_map(uc, 0, 0x1000, UC_PROT_ALL)); OK(uc_mem_write(uc, 0, code, sizeof(code) - 1)); 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_reg_read(uc, UC_X86_REG_EAX, (void*)&out)); + OK(uc_reg_read(uc, UC_X86_REG_EAX, (void *)&out)); TEST_CHECK(out == 0x001000a1); OK(uc_close(uc)); }