mirror of
				https://github.com/libsdl-org/SDL.git
				synced 2025-11-04 01:34:38 +00:00 
			
		
		
		
	Make sure the memory barrier functions are always available, and now they are implemented on Android __ARM_ARCH_5TE__
This commit is contained in:
		@@ -20,7 +20,7 @@ LOCAL_SRC_FILES := \
 | 
				
			|||||||
	$(wildcard $(LOCAL_PATH)/src/audio/*.c) \
 | 
						$(wildcard $(LOCAL_PATH)/src/audio/*.c) \
 | 
				
			||||||
	$(wildcard $(LOCAL_PATH)/src/audio/android/*.c) \
 | 
						$(wildcard $(LOCAL_PATH)/src/audio/android/*.c) \
 | 
				
			||||||
	$(wildcard $(LOCAL_PATH)/src/audio/dummy/*.c) \
 | 
						$(wildcard $(LOCAL_PATH)/src/audio/dummy/*.c) \
 | 
				
			||||||
	$(LOCAL_PATH)/src/atomic/SDL_atomic.c \
 | 
						$(LOCAL_PATH)/src/atomic/SDL_atomic.c.arm \
 | 
				
			||||||
	$(LOCAL_PATH)/src/atomic/SDL_spinlock.c.arm \
 | 
						$(LOCAL_PATH)/src/atomic/SDL_spinlock.c.arm \
 | 
				
			||||||
	$(wildcard $(LOCAL_PATH)/src/core/android/*.c) \
 | 
						$(wildcard $(LOCAL_PATH)/src/core/android/*.c) \
 | 
				
			||||||
	$(wildcard $(LOCAL_PATH)/src/cpuinfo/*.c) \
 | 
						$(wildcard $(LOCAL_PATH)/src/cpuinfo/*.c) \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -149,6 +149,9 @@ void _ReadWriteBarrier(void);
 | 
				
			|||||||
 * For more information on these semantics, take a look at the blog post:
 | 
					 * For more information on these semantics, take a look at the blog post:
 | 
				
			||||||
 * http://preshing.com/20120913/acquire-and-release-semantics
 | 
					 * http://preshing.com/20120913/acquire-and-release-semantics
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void);
 | 
				
			||||||
 | 
					extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
 | 
					#if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
 | 
				
			||||||
#define SDL_MemoryBarrierRelease()   __asm__ __volatile__ ("lwsync" : : : "memory")
 | 
					#define SDL_MemoryBarrierRelease()   __asm__ __volatile__ ("lwsync" : : : "memory")
 | 
				
			||||||
#define SDL_MemoryBarrierAcquire()   __asm__ __volatile__ ("lwsync" : : : "memory")
 | 
					#define SDL_MemoryBarrierAcquire()   __asm__ __volatile__ ("lwsync" : : : "memory")
 | 
				
			||||||
@@ -156,11 +159,11 @@ void _ReadWriteBarrier(void);
 | 
				
			|||||||
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__)
 | 
					#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__)
 | 
				
			||||||
#define SDL_MemoryBarrierRelease()   __asm__ __volatile__ ("dmb ish" : : : "memory")
 | 
					#define SDL_MemoryBarrierRelease()   __asm__ __volatile__ ("dmb ish" : : : "memory")
 | 
				
			||||||
#define SDL_MemoryBarrierAcquire()   __asm__ __volatile__ ("dmb ish" : : : "memory")
 | 
					#define SDL_MemoryBarrierAcquire()   __asm__ __volatile__ ("dmb ish" : : : "memory")
 | 
				
			||||||
#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)
 | 
					#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_5TE__)
 | 
				
			||||||
#ifdef __thumb__
 | 
					#ifdef __thumb__
 | 
				
			||||||
/* The mcr instruction isn't available in thumb mode, use real functions */
 | 
					/* The mcr instruction isn't available in thumb mode, use real functions */
 | 
				
			||||||
extern DECLSPEC void SDLCALL SDL_MemoryBarrierRelease(void);
 | 
					#define SDL_MemoryBarrierRelease()   SDL_MemoryBarrierReleaseFunction()
 | 
				
			||||||
extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire(void);
 | 
					#define SDL_MemoryBarrierAcquire()   SDL_MemoryBarrierAcquireFunction()
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#define SDL_MemoryBarrierRelease()   __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
 | 
					#define SDL_MemoryBarrierRelease()   __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
 | 
				
			||||||
#define SDL_MemoryBarrierAcquire()   __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
 | 
					#define SDL_MemoryBarrierAcquire()   __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -228,19 +228,16 @@ SDL_AtomicGetPtr(void **a)
 | 
				
			|||||||
    return value;
 | 
					    return value;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __thumb__
 | 
					void
 | 
				
			||||||
#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)
 | 
					SDL_MemoryBarrierReleaseFunction(void)
 | 
				
			||||||
__asm__(
 | 
					{
 | 
				
			||||||
"   .align 2\n"
 | 
					    SDL_MemoryBarrierRelease();
 | 
				
			||||||
"   .globl _SDL_MemoryBarrierRelease\n"
 | 
					}
 | 
				
			||||||
"   .globl _SDL_MemoryBarrierAcquire\n"
 | 
					
 | 
				
			||||||
"_SDL_MemoryBarrierRelease:\n"
 | 
					void
 | 
				
			||||||
"_SDL_MemoryBarrierAcquire:\n"
 | 
					SDL_MemoryBarrierAcquireFunction(void)
 | 
				
			||||||
"   mov r0, #0\n"
 | 
					{
 | 
				
			||||||
"   mcr p15, 0, r0, c7, c10, 5\n"
 | 
					    SDL_MemoryBarrierAcquire();
 | 
				
			||||||
"   bx lr\n"
 | 
					}
 | 
				
			||||||
);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* vi: set ts=4 sw=4 expandtab: */
 | 
					/* vi: set ts=4 sw=4 expandtab: */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,12 +27,6 @@
 | 
				
			|||||||
#error You should not be here.
 | 
					#error You should not be here.
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* so annoying. */
 | 
					 | 
				
			||||||
#if defined(__thumb__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__))
 | 
					 | 
				
			||||||
#define SDL_MemoryBarrierRelease SDL_MemoryBarrierRelease_REAL
 | 
					 | 
				
			||||||
#define SDL_MemoryBarrierAcquire SDL_MemoryBarrierAcquire_REAL
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define SDL_SetError SDL_SetError_REAL
 | 
					#define SDL_SetError SDL_SetError_REAL
 | 
				
			||||||
#define SDL_Log SDL_Log_REAL
 | 
					#define SDL_Log SDL_Log_REAL
 | 
				
			||||||
#define SDL_LogVerbose SDL_LogVerbose_REAL
 | 
					#define SDL_LogVerbose SDL_LogVerbose_REAL
 | 
				
			||||||
@@ -627,3 +621,5 @@
 | 
				
			|||||||
#define SDL_JoystickGetAxisInitialState SDL_JoystickGetAxisInitialState_REAL
 | 
					#define SDL_JoystickGetAxisInitialState SDL_JoystickGetAxisInitialState_REAL
 | 
				
			||||||
#define SDL_JoystickGetDeviceType SDL_JoystickGetDeviceType_REAL
 | 
					#define SDL_JoystickGetDeviceType SDL_JoystickGetDeviceType_REAL
 | 
				
			||||||
#define SDL_JoystickGetType SDL_JoystickGetType_REAL
 | 
					#define SDL_JoystickGetType SDL_JoystickGetType_REAL
 | 
				
			||||||
 | 
					#define SDL_MemoryBarrierReleaseFunction SDL_MemoryBarrierReleaseFunction_REAL
 | 
				
			||||||
 | 
					#define SDL_MemoryBarrierAcquireFunction SDL_MemoryBarrierAcquireFunction_REAL
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -60,12 +60,6 @@ SDL_DYNAPI_PROC(SDL_RWops*,SDL_RWFromFP,(FILE *a, SDL_bool b),(a,b),return)
 | 
				
			|||||||
SDL_DYNAPI_PROC(SDL_RWops*,SDL_RWFromFP,(void *a, SDL_bool b),(a,b),return)
 | 
					SDL_DYNAPI_PROC(SDL_RWops*,SDL_RWFromFP,(void *a, SDL_bool b),(a,b),return)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* so annoying. */
 | 
					 | 
				
			||||||
#if defined(__thumb__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__))
 | 
					 | 
				
			||||||
SDL_DYNAPI_PROC(void,SDL_MemoryBarrierRelease,(void),(),)
 | 
					 | 
				
			||||||
SDL_DYNAPI_PROC(void,SDL_MemoryBarrierAcquire,(void),(),)
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifdef __WIN32__
 | 
					#ifdef __WIN32__
 | 
				
			||||||
SDL_DYNAPI_PROC(int,SDL_RegisterApp,(char *a, Uint32 b, void *c),(a,b,c),return)
 | 
					SDL_DYNAPI_PROC(int,SDL_RegisterApp,(char *a, Uint32 b, void *c),(a,b,c),return)
 | 
				
			||||||
SDL_DYNAPI_PROC(void,SDL_UnregisterApp,(void),(),)
 | 
					SDL_DYNAPI_PROC(void,SDL_UnregisterApp,(void),(),)
 | 
				
			||||||
@@ -659,3 +653,5 @@ SDL_DYNAPI_PROC(char*,SDL_GameControllerMappingForIndex,(int a),(a),return)
 | 
				
			|||||||
SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickGetAxisInitialState,(SDL_Joystick *a, int b, Sint16 *c),(a,b,c),return)
 | 
					SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickGetAxisInitialState,(SDL_Joystick *a, int b, Sint16 *c),(a,b,c),return)
 | 
				
			||||||
SDL_DYNAPI_PROC(SDL_JoystickType,SDL_JoystickGetDeviceType,(int a),(a),return)
 | 
					SDL_DYNAPI_PROC(SDL_JoystickType,SDL_JoystickGetDeviceType,(int a),(a),return)
 | 
				
			||||||
SDL_DYNAPI_PROC(SDL_JoystickType,SDL_JoystickGetType,(SDL_Joystick *a),(a),return)
 | 
					SDL_DYNAPI_PROC(SDL_JoystickType,SDL_JoystickGetType,(SDL_Joystick *a),(a),return)
 | 
				
			||||||
 | 
					SDL_DYNAPI_PROC(void,SDL_MemoryBarrierReleaseFunction,(void),(),)
 | 
				
			||||||
 | 
					SDL_DYNAPI_PROC(void,SDL_MemoryBarrierAcquireFunction,(void),(),)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user