mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-22 21:09:52 +00:00
jit: Add more reasonable estimates for RX protect.
This commit is contained in:
parent
5294a64828
commit
b2798c7ada
@ -80,7 +80,7 @@ public:
|
||||
// If not WX Exclusive, no need to call ProtectMemoryPages because we never change the protection from RWX.
|
||||
PoisonMemory(offset);
|
||||
ResetCodePtr(offset);
|
||||
if (PlatformIsWXExclusive()) {
|
||||
if (PlatformIsWXExclusive() && offset != 0) {
|
||||
// Need to re-protect the part we didn't clear.
|
||||
ProtectMemoryPages(region, offset, MEM_PROT_READ | MEM_PROT_EXEC);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ void ThunkManager::Init()
|
||||
#endif
|
||||
|
||||
AllocCodeSpace(THUNK_ARENA_SIZE);
|
||||
BeginWrite();
|
||||
BeginWrite(512);
|
||||
save_regs = GetCodePtr();
|
||||
#if PPSSPP_ARCH(AMD64)
|
||||
for (int i = 2; i < ABI_GetNumXMMRegs(); i++)
|
||||
@ -151,7 +151,7 @@ const void *ThunkManager::ProtectFunction(const void *function, int num_params)
|
||||
|
||||
_assert_msg_(region != nullptr, "Can't protect functions before the emu is started.");
|
||||
|
||||
BeginWrite();
|
||||
BeginWrite(128);
|
||||
const u8 *call_point = GetCodePtr();
|
||||
Enter(this, true);
|
||||
|
||||
|
@ -71,8 +71,8 @@ namespace MIPSComp {
|
||||
using namespace ArmJitConstants;
|
||||
|
||||
void ArmJit::GenerateFixedCode() {
|
||||
BeginWrite(GetMemoryProtectPageSize());
|
||||
const u8 *start = AlignCodePage();
|
||||
BeginWrite();
|
||||
|
||||
// LR == SCRATCHREG2 on ARM32 so it needs to be pushed.
|
||||
restoreRoundingMode = AlignCode16(); {
|
||||
|
@ -234,7 +234,7 @@ void ArmJit::Compile(u32 em_address) {
|
||||
ClearCache();
|
||||
}
|
||||
|
||||
BeginWrite();
|
||||
BeginWrite(JitBlockCache::MAX_BLOCK_INSTRUCTIONS * 16);
|
||||
|
||||
int block_num = blocks.AllocateBlock(em_address);
|
||||
JitBlock *b = blocks.GetBlock(block_num);
|
||||
|
@ -97,8 +97,8 @@ namespace MIPSComp {
|
||||
using namespace Arm64JitConstants;
|
||||
|
||||
void Arm64Jit::GenerateFixedCode(const JitOptions &jo) {
|
||||
BeginWrite(GetMemoryProtectPageSize());
|
||||
const u8 *start = AlignCodePage();
|
||||
BeginWrite();
|
||||
|
||||
if (jo.useStaticAlloc) {
|
||||
saveStaticRegisters = AlignCode16();
|
||||
|
@ -230,7 +230,7 @@ void Arm64Jit::Compile(u32 em_address) {
|
||||
ClearCache();
|
||||
}
|
||||
|
||||
BeginWrite(4);
|
||||
BeginWrite(JitBlockCache::MAX_BLOCK_INSTRUCTIONS * 16);
|
||||
|
||||
int block_num = blocks.AllocateBlock(em_address);
|
||||
JitBlock *b = blocks.GetBlock(block_num);
|
||||
|
@ -66,8 +66,8 @@ void ImHere() {
|
||||
}
|
||||
|
||||
void Jit::GenerateFixedCode(JitOptions &jo) {
|
||||
BeginWrite(GetMemoryProtectPageSize());
|
||||
AlignCodePage();
|
||||
BeginWrite();
|
||||
|
||||
restoreRoundingMode = AlignCode16(); {
|
||||
STMXCSR(MIPSSTATE_VAR(temp));
|
||||
|
@ -281,7 +281,8 @@ void Jit::Compile(u32 em_address) {
|
||||
return;
|
||||
}
|
||||
|
||||
BeginWrite();
|
||||
// Sometimes we compile fairly large blocks, although it's uncommon.
|
||||
BeginWrite(JitBlockCache::MAX_BLOCK_INSTRUCTIONS * 16);
|
||||
|
||||
int block_num = blocks.AllocateBlock(em_address);
|
||||
JitBlock *b = blocks.GetBlock(block_num);
|
||||
|
@ -462,7 +462,7 @@ void JitSafeMemFuncs::Init(ThunkManager *thunks) {
|
||||
AllocCodeSpace(FUNCS_ARENA_SIZE);
|
||||
thunks_ = thunks;
|
||||
|
||||
BeginWrite();
|
||||
BeginWrite(1024);
|
||||
readU32 = GetCodePtr();
|
||||
CreateReadFunc(32, (const void *)&Memory::Read_U32);
|
||||
readU16 = GetCodePtr();
|
||||
|
@ -161,7 +161,7 @@ static const JitLookup jitLookup[] = {
|
||||
|
||||
JittedVertexDecoder VertexDecoderJitCache::Compile(const VertexDecoder &dec, int32_t *jittedSize) {
|
||||
dec_ = &dec;
|
||||
BeginWrite();
|
||||
BeginWrite(4096);
|
||||
const u8 *start = AlignCode16();
|
||||
|
||||
bool prescaleStep = false;
|
||||
|
@ -143,7 +143,7 @@ static const JitLookup jitLookup[] = {
|
||||
JittedVertexDecoder VertexDecoderJitCache::Compile(const VertexDecoder &dec, int32_t *jittedSize) {
|
||||
dec_ = &dec;
|
||||
|
||||
BeginWrite();
|
||||
BeginWrite(4096);
|
||||
const u8 *start = AlignCode16();
|
||||
|
||||
bool prescaleStep = false;
|
||||
|
@ -164,7 +164,7 @@ static const JitLookup jitLookup[] = {
|
||||
|
||||
JittedVertexDecoder VertexDecoderJitCache::Compile(const VertexDecoder &dec, int32_t *jittedSize) {
|
||||
dec_ = &dec;
|
||||
BeginWrite();
|
||||
BeginWrite(4096);
|
||||
const u8 *start = this->AlignCode16();
|
||||
|
||||
#if PPSSPP_ARCH(X86)
|
||||
|
@ -42,11 +42,12 @@ SingleFunc PixelJitCache::CompileSingle(const PixelFuncID &id) {
|
||||
RegCache::GEN_ARG_ID,
|
||||
});
|
||||
|
||||
BeginWrite();
|
||||
BeginWrite(64);
|
||||
Describe("Init");
|
||||
WriteConstantPool(id);
|
||||
|
||||
const u8 *resetPos = AlignCode16();
|
||||
EndWrite();
|
||||
bool success = true;
|
||||
|
||||
#if PPSSPP_PLATFORM(WINDOWS)
|
||||
|
@ -420,7 +420,7 @@ int CodeBlock::WriteProlog(int extraStack, const std::vector<RegCache::Reg> &vec
|
||||
#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
|
||||
using namespace Gen;
|
||||
|
||||
BeginWrite();
|
||||
BeginWrite(32768);
|
||||
AlignCode16();
|
||||
lastPrologStart_ = GetWritableCodePtr();
|
||||
|
||||
|
@ -45,7 +45,7 @@ FetchFunc SamplerJitCache::CompileFetch(const SamplerID &id) {
|
||||
regCache_.ForceRetain(RegCache::GEN_RESULT);
|
||||
regCache_.ChangeReg(XMM0, RegCache::VEC_RESULT);
|
||||
|
||||
BeginWrite();
|
||||
BeginWrite(2048);
|
||||
Describe("Init");
|
||||
const u8 *start = AlignCode16();
|
||||
|
||||
@ -122,7 +122,7 @@ FetchFunc SamplerJitCache::CompileFetch(const SamplerID &id) {
|
||||
|
||||
NearestFunc SamplerJitCache::CompileNearest(const SamplerID &id) {
|
||||
_assert_msg_(!id.fetch && !id.linear, "Fetch and linear should be cleared on sampler id");
|
||||
BeginWrite();
|
||||
BeginWrite(2048);
|
||||
Describe("Init");
|
||||
|
||||
// Let's drop some helpful constants here.
|
||||
@ -438,7 +438,7 @@ NearestFunc SamplerJitCache::CompileNearest(const SamplerID &id) {
|
||||
|
||||
LinearFunc SamplerJitCache::CompileLinear(const SamplerID &id) {
|
||||
_assert_msg_(id.linear && !id.fetch, "Only linear should be set on sampler id");
|
||||
BeginWrite();
|
||||
BeginWrite(2048);
|
||||
Describe("Init");
|
||||
|
||||
// We don't use stackArgPos_ here, this is just for DXT.
|
||||
|
Loading…
Reference in New Issue
Block a user