mirror of https://github.com/PCSX2/pcsx2.git
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
This commit is contained in:
parent
4dec10976d
commit
283224290d
|
@ -146,7 +146,7 @@ set(UtilitiesHeaders
|
||||||
../../include/Utilities/HashMap.h
|
../../include/Utilities/HashMap.h
|
||||||
../../include/Utilities/lnx_memzero.h
|
../../include/Utilities/lnx_memzero.h
|
||||||
../../include/Utilities/MemcpyFast.h
|
../../include/Utilities/MemcpyFast.h
|
||||||
../../include/Utilities/MemsetFast.h
|
../../include/Utilities/MemsetFast.inl
|
||||||
../../include/Utilities/Path.h
|
../../include/Utilities/Path.h
|
||||||
../../include/Utilities/PageFaultSource.h
|
../../include/Utilities/PageFaultSource.h
|
||||||
../../include/Utilities/pxCheckBox.h
|
../../include/Utilities/pxCheckBox.h
|
||||||
|
|
|
@ -18,10 +18,11 @@
|
||||||
|
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
static __ri void PageSizeAssertionTest( size_t size )
|
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"
|
"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)",
|
L"\tOS Page Size: 0x%x (%d), Compiled Page Size: 0x%x (%u)",
|
||||||
getpagesize(), getpagesize(), __pagesize, __pagesize )
|
getpagesize(), getpagesize(), __pagesize, __pagesize )
|
||||||
|
@ -64,26 +65,26 @@ void HostSys::MmapReset(void* base, size_t size)
|
||||||
// pretty well stops all PCSX2 threads anyway).
|
// pretty well stops all PCSX2 threads anyway).
|
||||||
|
|
||||||
Munmap(base, size);
|
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. "
|
"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
|
"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);
|
PageSizeAssertionTest(size);
|
||||||
|
|
||||||
// MAP_ANONYMOUS - means we have no associated file handle (or device).
|
// 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 )
|
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)
|
switch(errno)
|
||||||
{
|
{
|
||||||
case EINVAL:
|
case EINVAL:
|
||||||
pxFailDev(pxsFmt(L"mprotect returned EINVAL @ 0x%08X -> 0x%08X (mode=%s)"),
|
pxFailDev(pxsFmt(L"mprotect returned EINVAL @ 0x%08X -> 0x%08X (mode=%s)",
|
||||||
baseaddr, (uptr)baseaddr+size, mode.ToString().c_str()
|
baseaddr, (uptr)baseaddr+size, mode.ToString().c_str())
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENOMEM:
|
case ENOMEM:
|
||||||
throw Exception::OutOfMemory( psxFmt( L"mprotect failed @ 0x%08X -> 0x%08X (mode=%s)"),
|
throw Exception::OutOfMemory( pxsFmt( L"mprotect failed @ 0x%08X -> 0x%08X (mode=%s)",
|
||||||
baseaddr, (uptr)baseaddr+size, mode.ToString().c_str()
|
baseaddr, (uptr)baseaddr+size, mode.ToString().c_str())
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EACCES:
|
case EACCES:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
throw Exception::OutOfMemory()
|
throw Exception::OutOfMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,8 @@
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "System/PageFaultSource.h"
|
|
||||||
|
#include "Utilities/PageFaultSource.h"
|
||||||
|
|
||||||
extern void SignalExit(int sig);
|
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,
|
// Note: Use of most stdio functions isn't safe here. Avoid console logs,
|
||||||
// assertions, file logs, or just about anything else useful.
|
// 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
|
// resumes execution right where we left off (re-executes instruction that
|
||||||
// caused the SIGSEGV).
|
// caused the SIGSEGV).
|
||||||
if( Source_PageFault.WasHandled() ) return;
|
if( Source_PageFault->WasHandled() ) return;
|
||||||
|
|
||||||
// Bad mojo! Completely invalid address.
|
// Bad mojo! Completely invalid address.
|
||||||
// Instigate a trap if we're in a debugger, and if not then do a SIGKILL.
|
// 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()
|
void InstallSignalHandler()
|
||||||
{
|
{
|
||||||
|
Console.WriteLn("Installing POSIX SIGSEGV handler...");
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
|
||||||
sigemptyset(&sa.sa_mask);
|
sigemptyset(&sa.sa_mask);
|
||||||
|
|
|
@ -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( (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 );
|
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
|
// Let's try again at an OS-picked memory area, and then hope it meets needed
|
||||||
// boundschecking criteria below.
|
// boundschecking criteria below.
|
||||||
SafeSysMunmap( Mem, size );
|
SafeSysMunmap( Mem, size );
|
||||||
Mem = (u8*)HostSys::Mmap( NULL, size );
|
Mem = (u8*)HostSys::Mmap( 0, size );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (bounds != 0) && (((uptr)Mem + size) > bounds) )
|
if( (bounds != 0) && (((uptr)Mem + size) > bounds) )
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "PrecompiledHeader.h"
|
#include "PrecompiledHeader.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "microVU.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 all the *.inl files (Needed because C++ sucks with templates and *.cpp files)
|
||||||
#include "microVU_Clamp.inl"
|
#include "microVU_Clamp.inl"
|
||||||
|
|
Loading…
Reference in New Issue