Format code

This commit is contained in:
mio
2024-09-21 17:59:23 +08:00
parent a5fa548049
commit 87c0b86248
3 changed files with 32 additions and 11 deletions

View File

@@ -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

View File

@@ -1682,7 +1682,9 @@ static void test_bswap_ax(void)
{
uint8_t code[] = {
// bswap ax
0x66, 0x0F, 0xC8,
0x66,
0x0F,
0xC8,
};
TEST_CODE(UC_MODE_32, code);
TEST_IN_REG(EAX, 0x44332211);
@@ -1692,7 +1694,9 @@ static void test_bswap_ax(void)
{
uint8_t code[] = {
// bswap ax
0x66, 0x0F, 0xC8,
0x66,
0x0F,
0xC8,
};
TEST_CODE(UC_MODE_64, code);
TEST_IN_REG(RAX, 0x8877665544332211);
@@ -1702,7 +1706,10 @@ static void test_bswap_ax(void)
{
uint8_t code[] = {
// bswap rax (66h ignored)
0x66, 0x48, 0x0F, 0xC8,
0x66,
0x48,
0x0F,
0xC8,
};
TEST_CODE(UC_MODE_64, code);
TEST_IN_REG(RAX, 0x8877665544332211);
@@ -1712,7 +1719,10 @@ static void test_bswap_ax(void)
{
uint8_t code[] = {
// bswap ax (rex ignored)
0x48, 0x66, 0x0F, 0xC8,
0x48,
0x66,
0x0F,
0xC8,
};
TEST_CODE(UC_MODE_64, code);
TEST_IN_REG(RAX, 0x8877665544332211);
@@ -1722,7 +1732,8 @@ static void test_bswap_ax(void)
{
uint8_t code[] = {
// bswap eax
0x0F, 0xC8,
0x0F,
0xC8,
};
TEST_CODE(UC_MODE_32, code);
TEST_IN_REG(EAX, 0x44332211);
@@ -1732,7 +1743,8 @@ static void test_bswap_ax(void)
{
uint8_t code[] = {
// bswap eax
0x0F, 0xC8,
0x0F,
0xC8,
};
TEST_CODE(UC_MODE_64, code);
TEST_IN_REG(RAX, 0x8877665544332211);
@@ -1746,7 +1758,10 @@ static void test_rex_x64(void)
{
uint8_t code[] = {
// mov ax, bx (rex.w ignored)
0x48, 0x66, 0x89, 0xD8,
0x48,
0x66,
0x89,
0xD8,
};
TEST_CODE(UC_MODE_64, code);
TEST_IN_REG(RAX, 0x8877665544332211);
@@ -1757,7 +1772,10 @@ static void test_rex_x64(void)
{
uint8_t code[] = {
// mov rax, rbx (66h ignored)
0x66, 0x48, 0x89, 0xD8,
0x66,
0x48,
0x89,
0xD8,
};
TEST_CODE(UC_MODE_64, code);
TEST_IN_REG(RAX, 0x8877665544332211);
@@ -1768,7 +1786,9 @@ static void test_rex_x64(void)
{
uint8_t code[] = {
// mov ax, bx (expected encoding)
0x66, 0x89, 0xD8,
0x66,
0x89,
0xD8,
};
TEST_CODE(UC_MODE_64, code);
TEST_IN_REG(RAX, 0x8877665544332211);

3
uc.c
View File

@@ -2837,7 +2837,8 @@ static uc_err uc_restore_latest_snapshot(struct uc_struct *uc)
subregions_link, subregion_next)
{
uc->memory_filter_subregions(subregion, uc->snapshot_level);
if (subregion->priority >= uc->snapshot_level || (!subregion->terminates && QTAILQ_EMPTY(&subregion->subregions))) {
if (subregion->priority >= uc->snapshot_level ||
(!subregion->terminates && QTAILQ_EMPTY(&subregion->subregions))) {
uc->memory_unmap(uc, subregion);
}
}