From 46f5bb51e918828d99f3a2fc6b2292e05c63e5b5 Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Wed, 21 Jan 2009 04:55:55 +0000 Subject: [PATCH] Removed "noreturn" declspec from the iR5900-32.cpp Dispatcher functions, which simply supressed the generation of an unreachable "ret" at the end of the naked functions. GCC doesn't support the directive anyway. Removed some __MINGW32__ specific code, and added a GCC-friendly #define for declaring __naked functions. (another optimization directive in MSVC which GCC doesn't support and/or ignores) git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@616 a6443dda-0b58-4228-96e9-037be469359c --- common/PS2Etypes.h | 15 +++++---- pcsx2/PrecompiledHeader.h | 25 --------------- pcsx2/x86/ix86-32/iR5900-32.cpp | 55 ++------------------------------- pcsx2/xmlpatchloader.cpp | 2 +- 4 files changed, 11 insertions(+), 86 deletions(-) diff --git a/common/PS2Etypes.h b/common/PS2Etypes.h index 2cb32f425b..d980530d66 100644 --- a/common/PS2Etypes.h +++ b/common/PS2Etypes.h @@ -87,6 +87,8 @@ typedef unsigned int uint; #define PCSX2_ALIGNED16(x) __declspec(align(16)) x #define PCSX2_ALIGNED16_DECL(x) __declspec(align(16)) x +#define __naked __declspec(naked) + #else // _MSC_VER #ifdef __LINUX__ @@ -107,7 +109,7 @@ typedef uint64_t u64; typedef uintptr_t uptr; typedef intptr_t sptr; -#else // __LINUX__ +#else // HAVE_STDINT_H typedef char s8; typedef short s16; @@ -119,7 +121,7 @@ typedef unsigned short u16; typedef unsigned int u32; typedef unsigned long long u64; -#endif // __LINUX__ +#endif // HAVE_STDINT_H typedef unsigned int uint; @@ -133,15 +135,12 @@ typedef union _LARGE_INTEGER #define __unused __attribute__((unused)) #define _inline __inline__ __attribute__((unused)) #define __forceinline __attribute__((always_inline,unused)) -#endif +#define __naked // GCC lacks the naked specifier + +#endif // __LINUX__ -#if defined(__MINGW32__) -#define PCSX2_ALIGNED(alig,x) __declspec(align(alig)) x -#define PCSX2_ALIGNED16(x) __declspec(align(16)) x -#else #define PCSX2_ALIGNED(alig,x) x __attribute((aligned(alig))) #define PCSX2_ALIGNED16(x) x __attribute((aligned(16))) -#endif #define PCSX2_ALIGNED16_DECL(x) x diff --git a/pcsx2/PrecompiledHeader.h b/pcsx2/PrecompiledHeader.h index 50a80d28bc..72836c11d9 100644 --- a/pcsx2/PrecompiledHeader.h +++ b/pcsx2/PrecompiledHeader.h @@ -67,31 +67,6 @@ using std::string; // we use it enough, so bring it into the global namespace. # define strnicmp _strnicmp # define stricmp _stricmp -#elif defined(__MINGW32__) - -# include -# include -# define BOOL int -# include // posix_memalign() -# undef TRUE -# undef FALSE -# define TRUE 1 -# define FALSE 0 - -# define __declspec(x) -# define __assume(x) ; -# define strnicmp strncasecmp -# define stricmp strcasecmp -# include -//# pragma intrinsic (InterlockedAnd) -// Definitions added Feb 16, 2006 by efp -//# define __declspec(x) -# include -# define __forceinline inline -# define _aligned_malloc(x,y) __mingw_aligned_malloc(x,y) -# define _aligned_free(x) __mingw_aligned_free(x) -# define pthread_mutex__unlock pthread_mutex_unlock - #else // must be GCC... # include diff --git a/pcsx2/x86/ix86-32/iR5900-32.cpp b/pcsx2/x86/ix86-32/iR5900-32.cpp index 62de2ff9c6..1da6d9ec06 100644 --- a/pcsx2/x86/ix86-32/iR5900-32.cpp +++ b/pcsx2/x86/ix86-32/iR5900-32.cpp @@ -576,34 +576,6 @@ static void recShutdown( void ) #pragma warning(disable:4731) // frame pointer register 'ebp' modified by inline assembly code -/* -static __forceinline __declspec(naked) void execute( void ) -{ -#ifdef _MSC_VER - __asm pusha; -#else - __asm__("pusha\n"); -#endif - - BASEBLOCK* pblock = PC_GETBLOCK(cpuRegs.pc); - - if ( !pblock->pFnptr || pblock->startpc != cpuRegs.pc ) - recRecompile(cpuRegs.pc); - - assert( pblock->pFnptr != 0 ); - - g_EEFreezeRegs = true; - ((R5900FNPTR)pblock->pFnptr)(); - -#ifdef _MSC_VER - __asm popa; -#else - __asm__("popa\n"); -#endif - - g_EEFreezeRegs = false; -}*/ - void recStep( void ) { } @@ -634,7 +606,7 @@ static u32 g_EEDispatchTemp; // jumped to when invalid pc address // EDX contains the jump addr to modify -static __declspec(naked,noreturn) void Dispatcher() +static __naked void Dispatcher() { // EDX contains the jump addr to modify __asm push edx @@ -677,7 +649,7 @@ CheckPtr: // edx - baseblock->startpc // stack - x86Ptr -static __declspec(naked,noreturn) void DispatcherClear() +static __naked void DispatcherClear() { // EDX contains the current pc __asm mov cpuRegs.pc, edx @@ -721,7 +693,7 @@ static __declspec(naked,noreturn) void DispatcherClear() } // called when jumping to variable pc address -static __declspec(naked,noreturn) void DispatcherReg() +static __naked void DispatcherReg() { s_pDispatchBlock = PC_GETBLOCK(cpuRegs.pc); @@ -1524,27 +1496,6 @@ void recompileNextInstruction(int delayslot) // g_cpuHasConstReg = 1; } -//__declspec(naked) void iDummyBlock() -//{ -//// g_lastpc = cpuRegs.pc; -//// -//// do { -//// cpuRegs.cycle = g_nextBranchCycle; -//// cpuBranchTest(); -//// } while(g_lastpc == cpuRegs.pc); -//// -//// __asm jmp DispatcherReg -// __asm { -//RepDummy: -// add cpuRegs.cycle, 9 -// call cpuBranchTest -// cmp cpuRegs.pc, 0x81fc0 -// je RepDummy -// jmp DispatcherReg -// } -//} - - extern u32 psxdump; static void printfn() diff --git a/pcsx2/xmlpatchloader.cpp b/pcsx2/xmlpatchloader.cpp index 76900e7310..a123e47a10 100644 --- a/pcsx2/xmlpatchloader.cpp +++ b/pcsx2/xmlpatchloader.cpp @@ -32,7 +32,7 @@ using namespace std; #include #endif -#if !defined(_WIN32) && !defined(__MINGW32__) +#if !defined(_WIN32) #ifndef strnicmp #define strnicmp strncasecmp #endif