Skip to content

Commit a40128b

Browse files
wtdcodeAntelox
authored andcommitted
Further fix incorrect register size
1 parent 4b6b782 commit a40128b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tests/unit/test_x86.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,12 @@ static void QuickTest_run(QuickTest *test)
5252
OK(uc_reg_write(uc, UC_X86_REG_ESP, &stack_top));
5353
}
5454
for (size_t i = 0; i < test->in_count; i++) {
55-
OK(uc_reg_write(uc, test->in_regs[i].reg, &test->in_regs[i].value));
55+
if (test->mode == UC_MODE_64) {
56+
OK(uc_reg_write(uc, test->in_regs[i].reg, &test->in_regs[i].value));
57+
} else {
58+
uint32_t reg = test->in_regs[i].value & 0xFFFFFFFF;
59+
OK(uc_reg_write(uc, test->in_regs[i].reg, &reg));
60+
}
5661
}
5762
OK(uc_emu_start(uc, MEM_TEXT, MEM_TEXT + test->code_size, 0, 0));
5863
for (size_t i = 0; i < test->out_count; i++) {
@@ -1704,7 +1709,8 @@ static void test_x86_64_not_overwriting_tmp0_for_pc_update(void)
17041709
uc_hook hk;
17051710
const char code[] = "\x48\xb9\xff\xff\xff\xff\xff\xff\xff\xff\x48\x89\x0c"
17061711
"\x24\x48\xd3\x24\x24\x73\x0a";
1707-
uint64_t rsp, pc, eflags;
1712+
uint64_t rsp, pc;
1713+
uint32_t eflags;
17081714

17091715
// 0x1000: movabs rcx, 0xffffffffffffffff
17101716
// 0x100a: mov qword ptr [rsp], rcx

0 commit comments

Comments
 (0)