mirror of
https://github.com/ran-j/PS2Recomp.git
synced 2026-09-29 01:47:44 -04:00
Feature/added execution guess gs psmt (#104)
* fix: CRITICAL fix on code gen on generating BEQ translation, I added a small yeld because goto could spin forever and monopolize guest execution * feat: add scratchpad alias base and improve scratchpad address handling * feat: added debug logging on GifArbiter for submit and drain operations * feat: add interrupt and thread management syscall implementations fix: change some IDs calls to match ps2sdk * feat: added vif1 logs * feat: added logs on gs gpu feat: added performLocalToLocalTransfer to GS emulation path for TRXDIR = 2. (emulates the PS2 GS “copy this rectangle from one place in VRAM to another”) * feat: added PSMT8 and refactor PSMT4 * feat: some identation on vu1 feat: added some logs on vu1 * feat: added GuestExecutionScope to temporarily stop owning guest execution, then restore it exactly as it was. feat: added vsync wizardry feat: added some regression test * fix: fix gs logger * feat: remove extra logs I think they will help no one feat: move join all threads to prevent the app to get stuck on close, but now it random crash on closing feat: one more small test on psmt4 to try fix ghosting on re code veronica * feat: added a small case for exporter from ghidra for metal slug 3 * feat: added ugly code to pass on test
This commit is contained in:
@@ -251,6 +251,73 @@ void register_ps2_runtime_interrupt_tests()
|
||||
cleanupRuntime(env);
|
||||
});
|
||||
|
||||
tc.Run("negative interrupt-safe EE syscall ids dispatch", [](TestCase &t)
|
||||
{
|
||||
notifyRuntimeStop();
|
||||
TestEnv env;
|
||||
|
||||
constexpr uint32_t kEventParamAddr = 0x1200u;
|
||||
constexpr uint32_t kStatusAddr = 0x1210u;
|
||||
|
||||
const uint32_t eventParam[3] = {
|
||||
0u,
|
||||
0u,
|
||||
0u
|
||||
};
|
||||
std::memcpy(env.rdram.data() + kEventParamAddr, eventParam, sizeof(eventParam));
|
||||
|
||||
R5900Context createCtx{};
|
||||
setRegU32(createCtx, 4, kEventParamAddr);
|
||||
CreateEventFlag(env.rdram.data(), &createCtx, &env.runtime);
|
||||
const int32_t eid = getRegS32(createCtx, 2);
|
||||
t.IsTrue(eid > 0, "CreateEventFlag should return a valid event id");
|
||||
|
||||
R5900Context disableIntcCtx{};
|
||||
setRegU32(disableIntcCtx, 4, 2u);
|
||||
t.IsTrue(callSyscall(static_cast<uint32_t>(-0x1B), env.rdram.data(), &disableIntcCtx, &env.runtime),
|
||||
"negative iDisableIntc syscall id should dispatch");
|
||||
t.Equals(getRegS32(disableIntcCtx, 2), KE_OK, "negative iDisableIntc should return KE_OK");
|
||||
|
||||
R5900Context enableIntcCtx{};
|
||||
setRegU32(enableIntcCtx, 4, 2u);
|
||||
t.IsTrue(callSyscall(static_cast<uint32_t>(-0x1A), env.rdram.data(), &enableIntcCtx, &env.runtime),
|
||||
"negative iEnableIntc syscall id should dispatch");
|
||||
t.Equals(getRegS32(enableIntcCtx, 2), KE_OK, "negative iEnableIntc should return KE_OK");
|
||||
|
||||
R5900Context disableDmacCtx{};
|
||||
setRegU32(disableDmacCtx, 4, 5u);
|
||||
t.IsTrue(callSyscall(static_cast<uint32_t>(-0x1D), env.rdram.data(), &disableDmacCtx, &env.runtime),
|
||||
"negative iDisableDmac syscall id should dispatch");
|
||||
t.Equals(getRegS32(disableDmacCtx, 2), KE_OK, "negative iDisableDmac should return KE_OK");
|
||||
|
||||
R5900Context enableDmacCtx{};
|
||||
setRegU32(enableDmacCtx, 4, 5u);
|
||||
t.IsTrue(callSyscall(static_cast<uint32_t>(-0x1C), env.rdram.data(), &enableDmacCtx, &env.runtime),
|
||||
"negative iEnableDmac syscall id should dispatch");
|
||||
t.Equals(getRegS32(enableDmacCtx, 2), KE_OK, "negative iEnableDmac should return KE_OK");
|
||||
|
||||
R5900Context setEventFlagCtx{};
|
||||
setRegU32(setEventFlagCtx, 4, static_cast<uint32_t>(eid));
|
||||
setRegU32(setEventFlagCtx, 5, 0x6u);
|
||||
t.IsTrue(callSyscall(static_cast<uint32_t>(-0x53), env.rdram.data(), &setEventFlagCtx, &env.runtime),
|
||||
"negative iSetEventFlag syscall id should dispatch");
|
||||
t.Equals(getRegS32(setEventFlagCtx, 2), KE_OK, "negative iSetEventFlag should return KE_OK");
|
||||
|
||||
R5900Context referCtx{};
|
||||
setRegU32(referCtx, 4, static_cast<uint32_t>(eid));
|
||||
setRegU32(referCtx, 5, kStatusAddr);
|
||||
ReferEventFlagStatus(env.rdram.data(), &referCtx, &env.runtime);
|
||||
t.Equals(getRegS32(referCtx, 2), KE_OK, "ReferEventFlagStatus should succeed after iSetEventFlag");
|
||||
t.Equals(readGuestU32(env.rdram.data(), kStatusAddr + 12u), 0x6u,
|
||||
"negative iSetEventFlag should publish the requested bits");
|
||||
|
||||
R5900Context deleteCtx{};
|
||||
setRegU32(deleteCtx, 4, static_cast<uint32_t>(eid));
|
||||
DeleteEventFlag(env.rdram.data(), &deleteCtx, &env.runtime);
|
||||
|
||||
cleanupRuntime(env);
|
||||
});
|
||||
|
||||
tc.Run("WaitEventFlag blocks and wakes when SetEventFlag publishes bits", [](TestCase &t)
|
||||
{
|
||||
notifyRuntimeStop();
|
||||
|
||||
Reference in New Issue
Block a user