Skip to content

Commit 9ec6b0b

Browse files
committed
Add a test for fpr
1 parent c974498 commit 9ec6b0b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/unit/test_mips.c

+18
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,29 @@ static void test_mips_mips16(void)
147147
OK(uc_close(uc));
148148
}
149149

150+
static void test_mips_mips_fpr(void)
151+
{
152+
uc_engine *uc;
153+
uint64_t r_f1;
154+
// ks.asm("li $t1, 0x42f6e979;mtc1 $t1, $f1")
155+
const char code[] = "\xf6\x42\x09\x3c\x79\xe9\x29\x35\x00\x08\x89\x44";
156+
uc_common_setup(&uc, UC_ARCH_MIPS, UC_MODE_MIPS32, code, sizeof(code) - 1);
157+
158+
OK(uc_emu_start(uc, code_start, code_start + sizeof(code) - 1, 0, 0));
159+
160+
OK(uc_reg_read(uc, UC_MIPS_REG_F1, (void *)&r_f1));
161+
162+
TEST_CHECK(r_f1 = 0x42f6e979);
163+
164+
OK(uc_close(uc));
165+
}
166+
150167
TEST_LIST = {
151168
{"test_mips_stop_at_branch", test_mips_stop_at_branch},
152169
{"test_mips_stop_at_delay_slot", test_mips_stop_at_delay_slot},
153170
{"test_mips_el_ori", test_mips_el_ori},
154171
{"test_mips_eb_ori", test_mips_eb_ori},
155172
{"test_mips_lwx_exception_issue_1314", test_mips_lwx_exception_issue_1314},
156173
{"test_mips_mips16", test_mips_mips16},
174+
{"test_mips_mips_fpr", test_mips_mips_fpr},
157175
{NULL, NULL}};

0 commit comments

Comments
 (0)