From d18ab50520ee667b4fb56a7a75304bdd19c554fe Mon Sep 17 00:00:00 2001 From: Sonicadvance1 Date: Fri, 5 Mar 2010 09:23:28 +0000 Subject: [PATCH] Add a universal option to the osx flag, does not work yet since scons strips out the -arch flag that it thinks is a duplicate, add to linker flags since cross compiling on OSX was failing since it was trying to link everything as the wrong arch. Re-Enable the loadstores in 32bit Dolphin in OSX, due to the reason described in the comments (Fast 32bit OSX!). Add an alert if the memory space ends up above 32bit in *nix sides, since it will ALWAYS be above in 64bit OSX, Will try to fix. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5155 8ced0084-cf51-0410-be5f-012b33b47a6e --- SConstruct | 7 ++++++- Source/Core/Common/Src/MemoryUtil.cpp | 7 +++++++ Source/Core/Core/Src/CoreParameter.cpp | 5 +++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index e5c6907aa1..a8ac71c853 100644 --- a/SConstruct +++ b/SConstruct @@ -124,7 +124,7 @@ vars.AddVariables( ignorecase = 2 ), EnumVariable('osx', 'Choose a backend (WIP)', '32cocoa', - allowed_values = ('32x11', '32cocoa', '64cocoa'), + allowed_values = ('32x11', '32cocoa', '64cocoa', 'universal'), ignorecase = 2 ), PathVariable('wxconfig', 'Path to the wxconfig', None), @@ -328,9 +328,14 @@ if sys.platform != 'darwin': if sys.platform == 'darwin': if env['osx'] == '64cocoa': compileFlags += ['-arch' , 'x86_64', '-m64' ] + env['LINKFLAGS'] += ['-arch' , 'x86_64', '-m64' ] conf.Define('MAP_32BIT', 0) if env['osx'] == '32cocoa': compileFlags += ['-arch' , 'i386', '-m32' ] + env['LINKFLAGS'] += ['-arch' , 'i386', '-m32' ] + if env['osx'] == 'universal': + compileFlags += ['-arch i386', '-arch x86_64'] + env['LINKFLAGS'] += ['-arch i386', '-arch x86_64'] if not env['osx'] == '32x11': env['HAVE_X11'] = 0 env['HAVE_COCOA'] = 1 diff --git a/Source/Core/Common/Src/MemoryUtil.cpp b/Source/Core/Common/Src/MemoryUtil.cpp index a6c89615ab..5ccf5729d5 100644 --- a/Source/Core/Common/Src/MemoryUtil.cpp +++ b/Source/Core/Common/Src/MemoryUtil.cpp @@ -62,6 +62,13 @@ void* AllocateExecutableMemory(size_t size, bool low) , -1, 0); // | MAP_FIXED // printf("Mapped executable memory at %p (size %i)\n", retval, size); + if ((u64)ptr >= 0x80000000) + { + // Should only happen in 64bit OSX + // Just a reminder, to show a OSX user that it may fail + PanicAlert("Executable memory ended up above 2GB!"); + } + if (!retval) { PanicAlert("Failed to allocate executable memory, errno=%i", errno); diff --git a/Source/Core/Core/Src/CoreParameter.cpp b/Source/Core/Core/Src/CoreParameter.cpp index 7ce1c3f8e4..c3e952aad5 100644 --- a/Source/Core/Core/Src/CoreParameter.cpp +++ b/Source/Core/Core/Src/CoreParameter.cpp @@ -87,8 +87,13 @@ void SCoreStartupParameter::LoadDefaults() // These are required for the JIT cores to work in OSX // Older revs (~4854) Only required LoadStorePaired to be turned off // Newer revs (~4890) require both turned off + #ifdef __x86_64__ + // These work fine in 32bit OSX + // Since the reason why 64bit OSX fails out is due to casting (u32)(u64) + // Since all 64bit applications are above the 32bit memory boundary bJITLoadStoreOff = true; bJITLoadStorePairedOff = true; + #endif #elif defined(__linux__) // Similar to OSX, something with LoadStorePaired seems to cause // crashes on linux. Only Win32 seems to be forgiving enough to