Improvements to crash screen.

Part of #13299

Use the new tests/cpu/crash tests in pspautotest to test this code
(manually).
This commit is contained in:
Henrik Rydgård 2020-12-19 19:16:04 +01:00
parent 0da96ff119
commit ac6715baa9
5 changed files with 34 additions and 16 deletions

View File

@ -145,10 +145,8 @@ bool X86AnalyzeMOV(const unsigned char *codePtr, LSInstructionInfo &info)
info.displacement = *((s32 *)codePtr);
codePtr += displacementSize;
if (accessType == 1)
if (accessType == 1) // reg/mem
{
info.isMemoryWrite = true;
//Write access
switch (codeByte)
{
case MOVE_8BIT: //move 8-bit immediate
@ -182,9 +180,11 @@ bool X86AnalyzeMOV(const unsigned char *codePtr, LSInstructionInfo &info)
}
break;
case MOVE_REG_TO_MEM: //move reg to memory
info.isMemoryWrite = true;
break;
case MOVE_MEM_TO_REG:
info.isMemoryWrite = false;
break;
default:
@ -195,6 +195,7 @@ bool X86AnalyzeMOV(const unsigned char *codePtr, LSInstructionInfo &info)
else
{
// Memory read
info.isMemoryWrite = false;
//mov eax, dword ptr [rax] == 8b 00
switch (codeByte)

View File

@ -42,7 +42,11 @@ public:
const std::string discID = GetValueString("DISC_ID");
if (discID.empty()) {
std::string fakeID = GenerateFakeID();
WARN_LOG(LOADER, "No DiscID found - generating a fake one: %s", fakeID.c_str());
WARN_LOG(LOADER, "No DiscID found - generating a fake one: '%s'", fakeID.c_str());
ValueData data;
data.type = VT_UTF8;
data.s_value = fakeID;
values["DISC_ID"] = data;
return fakeID;
}
return discID;

View File

@ -113,11 +113,13 @@ bool HandleFault(uintptr_t hostAddress, void *ctx) {
int instructionSize = 4;
#if PPSSPP_ARCH(AMD64) || PPSSPP_ARCH(X86)
// X86, X86-64. Variable instruction size so need to analyze the mov instruction in detail.
instructionSize = 15;
// To ignore the access, we need to disassemble the instruction and modify context->CTX_PC
LSInstructionInfo info{};
success = X86AnalyzeMOV(codePtr, info);
instructionSize = info.instructionSize;
if (success)
instructionSize = info.instructionSize;
#elif PPSSPP_ARCH(ARM64)
uint32_t word;
memcpy(&word, codePtr, 4);
@ -133,7 +135,7 @@ bool HandleFault(uintptr_t hostAddress, void *ctx) {
#endif
std::string disassembly;
if (success && DisassembleNativeAt(codePtr, instructionSize, &disassembly)) {
if (DisassembleNativeAt(codePtr, instructionSize, &disassembly)) {
infoString += disassembly + "\n";
}

View File

@ -1269,21 +1269,23 @@ static void DrawCrashDump(DrawBuffer *draw2d) {
// TODO: Draw a lot more information. Full register set, and so on.
#ifdef _DEBUG
char build[] = "Debug";
char build[] = "debug";
#else
char build[] = "Release";
char build[] = "release";
#endif
std::string sysName = System_GetProperty(SYSPROP_NAME);
int sysVersion = System_GetPropertyInt(SYSPROP_SYSTEMVERSION);
snprintf(statbuf, sizeof(statbuf), R"(%s
Game ID (Title): %s (%s)
PPSSPP build: %s (%s)
ABI: %s
%s (%s)
%s v%d (%s)
)",
ExceptionTypeAsString(info.type),
g_paramSFO.GetDiscID().c_str(),
g_paramSFO.GetValueString("TITLE").c_str(),
versionString,
build,
GetCompilerABI()
g_paramSFO.GetDiscID().c_str(), g_paramSFO.GetValueString("TITLE").c_str(),
versionString, build,
sysName.c_str(), sysVersion, GetCompilerABI()
);
draw2d->SetFontScale(.7f, .7f);
@ -1323,6 +1325,15 @@ BREAK
std::string kernelState = __KernelStateSummary();
draw2d->DrawTextShadow(ubuntu24, kernelState.c_str(), x, y, 0xFFFFFFFF);
// Draw some additional stuff to the right.
snprintf(statbuf, sizeof(statbuf),
"CPU Core: %d\n"
"Locked CPU freq: %d MHz\n",
g_Config.iCpuCore,
g_Config.iLockedCPUSpeed);
draw2d->DrawTextShadow(ubuntu24, statbuf, 420, 50, 0xFFFFFFFF);
}
static void DrawAudioDebugStats(DrawBuffer *draw2d, const Bounds &bounds) {

@ -1 +1 @@
Subproject commit 879e7959eb3251133fcc4ccf26b0ef35d9d43f8e
Subproject commit 7e4a1e750997e95df8a1f04f9a6396801adf7113