Add unit tests for mips

This commit is contained in:
mio
2025-04-11 11:58:42 +08:00
parent e376f98224
commit 9ec0f7558f

View File

@@ -200,6 +200,30 @@ static void test_mips_mips_fpr(void)
OK(uc_close(uc));
}
static void test_mips_simple_coredump_2134(void)
{
uc_engine *uc;
// ks.asm("li $t1, 0x42f6e979;mtc1 $t1, $f1")
const char code[] = "\x25\xc8\x80\x03\x25\x78\xe0\x03\x09\xf8\x20\x03\x10\x00\x18\x24";
uc_common_setup(&uc, UC_ARCH_MIPS, UC_MODE_MIPS32, code, sizeof(code) - 1);
OK(uc_emu_start(uc, code_start, code_start + sizeof(code) - 1, 0, 0));
OK(uc_close(uc));
}
static void test_mips_simple_coredump_2137(void)
{
uc_engine *uc;
// ks.asm("li $t1, 0x42f6e979;mtc1 $t1, $f1")
const char code[] = "\x1c\x00\x40\x54\xe8\x00\xc4\xaf";
uc_common_setup(&uc, UC_ARCH_MIPS, UC_MODE_MIPS32, code, sizeof(code) - 1);
OK(uc_emu_start(uc, code_start, code_start + sizeof(code) - 1, 0, 0));
OK(uc_close(uc));
}
TEST_LIST = {
{"test_mips_stop_at_branch", test_mips_stop_at_branch},
{"test_mips_stop_at_delay_slot", test_mips_stop_at_delay_slot},
@@ -210,4 +234,6 @@ TEST_LIST = {
{"test_mips_mips_fpr", test_mips_mips_fpr},
{"test_mips_stop_delay_slot_from_qiling",
test_mips_stop_delay_slot_from_qiling},
{"test_mips_simple_coredump_2134", test_mips_simple_coredump_2134},
{"test_mips_simple_coredump_2137", test_mips_simple_coredump_2137},
{NULL, NULL}};