CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/Core/MIPS/IR/IRInterpreter.h
Views: 1401
1
#pragma once
2
3
#include "Common/CommonTypes.h"
4
#include "Core/Core.h"
5
#include "Core/MemMap.h"
6
7
class MIPSState;
8
struct IRInst;
9
10
u32 IRRunBreakpoint(u32 pc);
11
u32 IRRunMemCheck(u32 pc, u32 addr);
12
u32 IRInterpret(MIPSState *ms, const IRInst *inst);
13
14
void IRApplyRounding();
15
void IRRestoreRounding();
16
17
template <uint32_t alignment>
18
u32 RunValidateAddress(u32 pc, u32 addr, u32 isWrite) {
19
const auto toss = [&](MemoryExceptionType t) {
20
Core_MemoryException(addr, alignment, pc, t);
21
return coreState != CORE_RUNNING ? 1 : 0;
22
};
23
24
if (!Memory::IsValidRange(addr, alignment)) {
25
MemoryExceptionType t = isWrite == 1 ? MemoryExceptionType::WRITE_WORD : MemoryExceptionType::READ_WORD;
26
if constexpr (alignment > 4)
27
t = isWrite ? MemoryExceptionType::WRITE_BLOCK : MemoryExceptionType::READ_BLOCK;
28
return toss(t);
29
}
30
if constexpr (alignment > 1)
31
if ((addr & (alignment - 1)) != 0)
32
return toss(MemoryExceptionType::ALIGNMENT);
33
return 0;
34
}
35
36