From 283224290de99808de71276304a8ec62b8ec6827 Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Wed, 27 Oct 2010 23:58:10 +0000 Subject: [PATCH] newHostVM: Fix linux/gcc compilation errors. PCSX2 doesn't work yet tho -- crashes on startup and I don't have a proper debug environment setup to trace and troubleshoot it. git-svn-id: http://pcsx2.googlecode.com/svn/branches/newHostVM@3977 96395faa-99c1-11dd-bbfe-3dabce05a288 --- common/src/Utilities/CMakeLists.txt | 2 +- common/src/Utilities/Linux/LnxHostSys.cpp | 25 ++++++++++++----------- pcsx2/Linux/LnxHostSys.cpp | 8 +++++--- pcsx2/System.cpp | 4 ++-- pcsx2/x86/microVU.cpp | 2 +- 5 files changed, 22 insertions(+), 19 deletions(-) diff --git a/common/src/Utilities/CMakeLists.txt b/common/src/Utilities/CMakeLists.txt index a659c5b4c0..7b61fcd33b 100644 --- a/common/src/Utilities/CMakeLists.txt +++ b/common/src/Utilities/CMakeLists.txt @@ -146,7 +146,7 @@ set(UtilitiesHeaders ../../include/Utilities/HashMap.h ../../include/Utilities/lnx_memzero.h ../../include/Utilities/MemcpyFast.h - ../../include/Utilities/MemsetFast.h + ../../include/Utilities/MemsetFast.inl ../../include/Utilities/Path.h ../../include/Utilities/PageFaultSource.h ../../include/Utilities/pxCheckBox.h diff --git a/common/src/Utilities/Linux/LnxHostSys.cpp b/common/src/Utilities/Linux/LnxHostSys.cpp index a453b03e8f..16c5a22161 100644 --- a/common/src/Utilities/Linux/LnxHostSys.cpp +++ b/common/src/Utilities/Linux/LnxHostSys.cpp @@ -18,10 +18,11 @@ #include #include +#include static __ri void PageSizeAssertionTest( size_t size ) { - pxAssert( (__pagesize == getpagesize()), pxsFmt( + pxAssertMsg( (__pagesize == getpagesize()), pxsFmt( "Internal system error: Operating system pagesize does not match compiled pagesize.\n\t" L"\tOS Page Size: 0x%x (%d), Compiled Page Size: 0x%x (%u)", getpagesize(), getpagesize(), __pagesize, __pagesize ) @@ -64,26 +65,26 @@ void HostSys::MmapReset(void* base, size_t size) // pretty well stops all PCSX2 threads anyway). Munmap(base, size); - void* result = Mmap(base, size); + void* result = Mmap((uptr)base, size); - pxAssertRel (result != base, pxsFmt( + pxAssertRel ((uptr)result != (uptr)base, pxsFmt( "Virtual memory decommit failed: memory at 0x%08X -> 0x%08X could not be remapped. " "This is likely caused by multi-thread memory contention.", base, base+size )); } -void* HostSys::Mmap(void* base, size_t size) +void* HostSys::Mmap(uptr base, size_t size) { PageSizeAssertionTest(size); // MAP_ANONYMOUS - means we have no associated file handle (or device). - return mmap(base, size, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + return mmap((void*)base, size, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); } -void HostSys::Munmap(void* base, size_t size) +void HostSys::Munmap(uptr base, size_t size) { - munmap(base, size); + munmap((void*)base, size); } void HostSys::MemProtect( void* baseaddr, size_t size, const PageProtectionMode& mode ) @@ -103,20 +104,20 @@ void HostSys::MemProtect( void* baseaddr, size_t size, const PageProtectionMode& switch(errno) { case EINVAL: - pxFailDev(pxsFmt(L"mprotect returned EINVAL @ 0x%08X -> 0x%08X (mode=%s)"), - baseaddr, (uptr)baseaddr+size, mode.ToString().c_str() + pxFailDev(pxsFmt(L"mprotect returned EINVAL @ 0x%08X -> 0x%08X (mode=%s)", + baseaddr, (uptr)baseaddr+size, mode.ToString().c_str()) ); break; case ENOMEM: - throw Exception::OutOfMemory( psxFmt( L"mprotect failed @ 0x%08X -> 0x%08X (mode=%s)"), - baseaddr, (uptr)baseaddr+size, mode.ToString().c_str() + throw Exception::OutOfMemory( pxsFmt( L"mprotect failed @ 0x%08X -> 0x%08X (mode=%s)", + baseaddr, (uptr)baseaddr+size, mode.ToString().c_str()) ); break; case EACCES: break; } - throw Exception::OutOfMemory() + throw Exception::OutOfMemory(); } } diff --git a/pcsx2/Linux/LnxHostSys.cpp b/pcsx2/Linux/LnxHostSys.cpp index 709539334f..1d46634e7d 100644 --- a/pcsx2/Linux/LnxHostSys.cpp +++ b/pcsx2/Linux/LnxHostSys.cpp @@ -18,7 +18,8 @@ #include #include #include "Common.h" -#include "System/PageFaultSource.h" + +#include "Utilities/PageFaultSource.h" extern void SignalExit(int sig); @@ -30,11 +31,11 @@ static void SysPageFaultSignalFilter( int signal, siginfo_t *siginfo, void * ) // Note: Use of most stdio functions isn't safe here. Avoid console logs, // assertions, file logs, or just about anything else useful. - Source_PageFault.Dispatch( PageFaultInfo( (uptr)siginfo->si_addr & ~m_pagemask ) ); + Source_PageFault->Dispatch( PageFaultInfo( (uptr)siginfo->si_addr & ~m_pagemask ) ); // resumes execution right where we left off (re-executes instruction that // caused the SIGSEGV). - if( Source_PageFault.WasHandled() ) return; + if( Source_PageFault->WasHandled() ) return; // Bad mojo! Completely invalid address. // Instigate a trap if we're in a debugger, and if not then do a SIGKILL. @@ -45,6 +46,7 @@ static void SysPageFaultSignalFilter( int signal, siginfo_t *siginfo, void * ) void InstallSignalHandler() { + Console.WriteLn("Installing POSIX SIGSEGV handler..."); struct sigaction sa; sigemptyset(&sa.sa_mask); diff --git a/pcsx2/System.cpp b/pcsx2/System.cpp index ecb33f9d90..9a4a349650 100644 --- a/pcsx2/System.cpp +++ b/pcsx2/System.cpp @@ -510,14 +510,14 @@ u8* SysMmapEx(uptr base, u32 size, uptr bounds, const char *caller) if( (Mem == NULL) || (bounds != 0 && (((uptr)Mem + size) > bounds)) ) { - if( base != NULL ) + if( base ) { DbgCon.Warning( "First try failed allocating %s at address 0x%x", caller, base ); // Let's try again at an OS-picked memory area, and then hope it meets needed // boundschecking criteria below. SafeSysMunmap( Mem, size ); - Mem = (u8*)HostSys::Mmap( NULL, size ); + Mem = (u8*)HostSys::Mmap( 0, size ); } if( (bounds != 0) && (((uptr)Mem + size) > bounds) ) diff --git a/pcsx2/x86/microVU.cpp b/pcsx2/x86/microVU.cpp index f6c409cb99..976f4f9306 100644 --- a/pcsx2/x86/microVU.cpp +++ b/pcsx2/x86/microVU.cpp @@ -18,7 +18,7 @@ #include "PrecompiledHeader.h" #include "Common.h" #include "microVU.h" -#include "RecTypes.h" +#include "System/RecTypes.h" // Include all the *.inl files (Needed because C++ sucks with templates and *.cpp files) #include "microVU_Clamp.inl"