Various platform buildfixes

This commit is contained in:
Henrik Rydgård 2020-07-13 09:17:42 +02:00
parent a56f391713
commit 6f97c3d422
11 changed files with 22 additions and 13 deletions

View File

@ -36,7 +36,8 @@
static BadAccessHandler g_badAccessHandler;
#ifdef _WIN32
// We cannot handle exceptions in UWP builds. Bleh.
#if PPSSPP_PLATFORM(WINDOWS) && !PPSSPP_PLATFORM(UWP)
static PVOID g_vectoredExceptionHandle;

View File

@ -395,6 +395,7 @@ const char *ExceptionTypeAsString(ExceptionType type) {
const char *MemoryExceptionTypeAsString(MemoryExceptionType type) {
switch (type) {
case MemoryExceptionType::UNKNOWN: return "Unknown";
case MemoryExceptionType::READ_WORD: return "Read Word";
case MemoryExceptionType::WRITE_WORD: return "Write Word";
case MemoryExceptionType::READ_BLOCK: return "Read Block";

View File

@ -81,6 +81,7 @@ bool Core_GetPowerSaving();
enum class MemoryExceptionType {
NONE,
UNKNOWN,
READ_WORD,
WRITE_WORD,
READ_BLOCK,

View File

@ -97,6 +97,11 @@ void FireMhzChange() {
}
void SetClockFrequencyHz(int cpuHz) {
if (cpuHz <= 0) {
// Paranoid check, protecting against division by zero and similar nonsense.
return;
}
// When the mhz changes, we keep track of what "time" it was before hand.
// This way, time always moves forward, even if mhz is changed.
lastGlobalTimeUs = GetGlobalTimeUs();

View File

@ -254,7 +254,7 @@ void ArmJit::GenerateFixedCode() {
crashHandler = GetCodePtr();
MOVP2R(R0, &coreState);
MOVI2R(R1, CORE_ERROR);
MOVI2R(R1, CORE_RUNTIME_ERROR);
STR(R1, R0, 0);
B(quitLoop);

View File

@ -289,7 +289,7 @@ void Arm64Jit::GenerateFixedCode(const JitOptions &jo) {
crashHandler = GetCodePtr();
MOVP2R(SCRATCH1_64, &coreState);
MOVI2R(SCRATCH2, CORE_ERROR);
MOVI2R(SCRATCH2, CORE_RUNTIME_ERROR);
STR(INDEX_UNSIGNED, SCRATCH2, SCRATCH1_64, 0);
B(quitLoop);

View File

@ -542,6 +542,8 @@ bool HandleFault(uintptr_t hostAddress, void *ctx) {
} else {
type = MemoryExceptionType::READ_WORD;
}
} else {
type = MemoryExceptionType::UNKNOWN;
}
if (success && g_Config.bIgnoreBadMemAccess) {

View File

@ -265,17 +265,15 @@ static void BranchExceptionAndSystem(uint32_t w, uint64_t addr, Instruction *ins
}
}
void Arm64AnalyzeLoadStore(uint64_t addr, uint32_t w, Arm64LSInstructionInfo *info) {
bool Arm64AnalyzeLoadStore(uint64_t addr, uint32_t w, Arm64LSInstructionInfo *info) {
*info = {};
info->instructionSize = 4;
int id = (w >> 25) & 0xF;
switch (id) {
case 4: case 6: case 0xC: case 0xE:
info->isLoadOrStore = true;
break;
default:
ERROR_LOG(CPU, "Tried to disassemble %08x at %p as a load/store instruction", w, (void *)addr);
return; // not the expected instruction
return false; // not the expected instruction
}
info->size = w >> 30;
@ -298,6 +296,7 @@ void Arm64AnalyzeLoadStore(uint64_t addr, uint32_t w, Arm64LSInstructionInfo *in
info->isPairLoadStore = true;
// TODO
}
return true;
}
static void LoadStore(uint32_t w, uint64_t addr, Instruction *instr) {

View File

@ -18,7 +18,7 @@
// Basic ARM64 disassembler.
// No promises of accuracy, mostly just made to debug JIT code.
#include <stdint.h>
#include <cstdint>
typedef bool (*SymbolCallback)(char *buffer, int bufsize, uint8_t *address);
@ -28,8 +28,6 @@ void Arm64Dis(uint64_t addr, uint32_t w, char *output, int bufsize, bool include
struct Arm64LSInstructionInfo {
int instructionSize;
bool isLoadOrStore;
bool isIntegerLoadStore;
bool isFPLoadStore;
bool isPairLoadStore;
@ -44,4 +42,4 @@ struct Arm64LSInstructionInfo {
// TODO: more.
};
void Arm64AnalyzeLoadStore(uint64_t addr, uint32_t op, Arm64LSInstructionInfo *info);
bool Arm64AnalyzeLoadStore(uint64_t addr, uint32_t op, Arm64LSInstructionInfo *info);

View File

@ -760,11 +760,13 @@ static bool DisasmNeon(uint32_t op, char *text) {
return false;
}
void ArmAnalyzeLoadStore(uint32_t addr, uint32_t op, ArmLSInstructionInfo *info) {
bool ArmAnalyzeLoadStore(uint32_t addr, uint32_t op, ArmLSInstructionInfo *info) {
*info = {};
info->instructionSize = 4;
// TODO
return false;
}

View File

@ -47,4 +47,4 @@ struct ArmLSInstructionInfo {
// TODO: more.
};
void ArmAnalyzeLoadStore(uint32_t addr, uint32_t op, ArmLSInstructionInfo *info);
bool ArmAnalyzeLoadStore(uint32_t addr, uint32_t op, ArmLSInstructionInfo *info);