mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Be pedantic about stack overflow on Linux and OS X.
Add some magic to the fault handler to handle stack overflow due to BLR optimization, and disable the optimization if fastmem is not enabled.
This commit is contained in:
@ -158,6 +158,25 @@ void FreeAlignedMemory(void* ptr)
|
||||
}
|
||||
}
|
||||
|
||||
void ReadProtectMemory(void* ptr, size_t size)
|
||||
{
|
||||
bool error_occurred = false;
|
||||
|
||||
#ifdef _WIN32
|
||||
DWORD oldValue;
|
||||
if (!VirtualProtect(ptr, size, PAGE_NOACCESS, &oldValue))
|
||||
error_occurred = true;
|
||||
#else
|
||||
int retval = mprotect(ptr, size, PROT_NONE);
|
||||
|
||||
if (retval != 0)
|
||||
error_occurred = true;
|
||||
#endif
|
||||
|
||||
if (error_occurred)
|
||||
PanicAlert("ReadProtectMemory failed!\n%s", GetLastErrorMsg());
|
||||
}
|
||||
|
||||
void WriteProtectMemory(void* ptr, size_t size, bool allowExecute)
|
||||
{
|
||||
bool error_occurred = false;
|
||||
|
@ -12,8 +12,12 @@ void* AllocateMemoryPages(size_t size);
|
||||
void FreeMemoryPages(void* ptr, size_t size);
|
||||
void* AllocateAlignedMemory(size_t size,size_t alignment);
|
||||
void FreeAlignedMemory(void* ptr);
|
||||
void ReadProtectMemory(void* ptr, size_t size);
|
||||
void WriteProtectMemory(void* ptr, size_t size, bool executable = false);
|
||||
void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute = false);
|
||||
std::string MemUsage();
|
||||
|
||||
void GuardMemoryMake(void* ptr, size_t size);
|
||||
void GuardMemoryUnmake(void* ptr, size_t size);
|
||||
|
||||
inline int GetPageSize() { return 4096; }
|
||||
|
@ -1766,6 +1766,8 @@ void XEmitter::ANDN(int bits, X64Reg regOp1, X64Reg regOp2, OpArg arg) {WriteBMI
|
||||
void XEmitter::LOCK() { Write8(0xF0); }
|
||||
void XEmitter::REP() { Write8(0xF3); }
|
||||
void XEmitter::REPNE() { Write8(0xF2); }
|
||||
void XEmitter::FSOverride() { Write8(0x64); }
|
||||
void XEmitter::GSOverride() { Write8(0x65); }
|
||||
|
||||
void XEmitter::FWAIT()
|
||||
{
|
||||
|
@ -467,6 +467,8 @@ public:
|
||||
void LOCK();
|
||||
void REP();
|
||||
void REPNE();
|
||||
void FSOverride();
|
||||
void GSOverride();
|
||||
|
||||
// x87
|
||||
enum x87StatusWordBits {
|
||||
|
Reference in New Issue
Block a user