Fix PPC32 fault when timer-spr access

Access to TB, DEC registers was lead to crash
spr_read_decr and others are changed to spr_read_generic
spr_write_decr and others are changed to spr_write_generic
This commit is contained in:
dotcirill
2023-12-06 01:58:50 +03:00
parent c0adcfb5e5
commit b0ea433772
2 changed files with 40 additions and 0 deletions

View File

@@ -105,8 +105,23 @@ static void test_ppc32_cr(void)
OK(uc_close(uc));
}
static void test_ppc32_spr_time(void)
{
char code[] = ("\x7c\x76\x02\xa6" // mfspr r3, DEC
"\x7c\x6d\x42\xa6" // mfspr r3, TBUr
);
uc_engine *uc;
uc_common_setup(&uc, UC_ARCH_PPC, UC_MODE_32 | UC_MODE_BIG_ENDIAN, 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_ppc32_add", test_ppc32_add},
{"test_ppc32_fadd", test_ppc32_fadd},
{"test_ppc32_sc", test_ppc32_sc},
{"test_ppc32_cr", test_ppc32_cr},
{"test_ppc32_spr_time", test_ppc32_spr_time},
{NULL, NULL}};