From cecc7cbe73b4ea34ee86147d670e1392d23211d3 Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Sun, 1 Mar 2009 05:24:44 +0000 Subject: [PATCH] Linux: Fix the SysPageFaultExceptionFilter so that it aligns to the pagesize. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@640 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/Linux/LnxSysExec.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/pcsx2/Linux/LnxSysExec.cpp b/pcsx2/Linux/LnxSysExec.cpp index 46b833369..1affbbe8c 100644 --- a/pcsx2/Linux/LnxSysExec.cpp +++ b/pcsx2/Linux/LnxSysExec.cpp @@ -48,17 +48,17 @@ void ReleaseLinuxExceptionHandler() // Code this later. } +static const uint m_pagemask = getpagesize()-1; // Linux implementation of SIGSEGV handler. Bind it using sigaction(). -// This is my shot in the dark. Probably needs some work. Good luck! (air) void SysPageFaultExceptionFilter( int signal, siginfo_t *info, void * ) { int err; //DevCon::Error("SysPageFaultExceptionFilter!"); // get bad virtual address - u32 offset = (u8*)info->si_addr - psM; - + uptr offset = (u8*)info->si_addr - psM; + DevCon::Status( "Protected memory cleanup. Offset 0x%x", params offset ); if (offset>=Ps2MemSize::Base) @@ -67,11 +67,10 @@ void SysPageFaultExceptionFilter( int signal, siginfo_t *info, void * ) // Instigate a crash or abort emulation or something. assert( false ); } - - mmap_ClearCpuBlock( offset ); + + mmap_ClearCpuBlock( offset & m_pagemask ); } - // For issuing notices to both the status bar and the console at the same time. // Single-line text only please! Mutli-line msgs should be directed to the // console directly, thanks. @@ -961,8 +960,6 @@ void SysMunmap(uptr base, u32 size) munmap((uptr*)base, size); } -static const int m_pagemask = getpagesize()-1; - void SysMemProtect( void* baseaddr, size_t size, PageProtectionMode mode, bool allowExecution ) { int lnxmode = 0;