diff options
author | 2015-03-30 20:30:18 +0200 | |
---|---|---|
committer | 2015-03-30 20:30:18 +0200 | |
commit | de541d79eea8f7527ff33440f6081474606738e3 (patch) | |
tree | 459ce3fb21267b71553e0ca9360213855ed79b40 /src | |
parent | 4e89e12e0269fb31b157d5064799985a730c0877 (diff) |
removed windows/osinline.h and placed MSVC dependent files in top folder (nw)
moved MSVC defines from winprefix.h to osdcomm.h
removed empty file compilation - porttime.c
removed osinline.h in windows and sdl and change files using them.
Diffstat (limited to 'src')
-rw-r--r-- | src/osd/eivc.h (renamed from src/osd/windows/eivc.h) | 0 | ||||
-rw-r--r-- | src/osd/eivcx86.h (renamed from src/osd/windows/eivcx86.h) | 0 | ||||
-rw-r--r-- | src/osd/eminline.h | 114 | ||||
-rw-r--r-- | src/osd/modules/opengl/gl_shader_mgr.c | 1 | ||||
-rw-r--r-- | src/osd/modules/sync/sync_ntc.c | 1 | ||||
-rw-r--r-- | src/osd/modules/sync/sync_os2.c | 1 | ||||
-rw-r--r-- | src/osd/modules/sync/sync_sdl.c | 1 | ||||
-rw-r--r-- | src/osd/modules/sync/sync_windows.c | 2 | ||||
-rw-r--r-- | src/osd/osdcomm.h | 19 | ||||
-rw-r--r-- | src/osd/sdl/osinline.h | 92 | ||||
-rw-r--r-- | src/osd/sdl/sdlprefix.h | 5 | ||||
-rw-r--r-- | src/osd/sdl/watchdog.c | 4 | ||||
-rw-r--r-- | src/osd/windows/osinline.h | 51 | ||||
-rw-r--r-- | src/osd/windows/winprefix.h | 28 |
14 files changed, 133 insertions, 186 deletions
diff --git a/src/osd/windows/eivc.h b/src/osd/eivc.h index 93927b1712b..93927b1712b 100644 --- a/src/osd/windows/eivc.h +++ b/src/osd/eivc.h diff --git a/src/osd/windows/eivcx86.h b/src/osd/eivcx86.h index b834bc2aa25..b834bc2aa25 100644 --- a/src/osd/windows/eivcx86.h +++ b/src/osd/eivcx86.h diff --git a/src/osd/eminline.h b/src/osd/eminline.h index 3e3f8398e5a..0772d3eea98 100644 --- a/src/osd/eminline.h +++ b/src/osd/eminline.h @@ -18,16 +18,126 @@ #if defined(__GNUC__) #if defined(__i386__) || defined(__x86_64__) + + +INLINE void ATTR_FORCE_INLINE +osd_yield_processor(void) +{ + __asm__ __volatile__ ( " rep ; nop ;" ); +} + + +#if defined(__x86_64__) + +//============================================================ +// osd_exchange64 +//============================================================ + +INLINE INT64 ATTR_UNUSED ATTR_NONNULL(1) ATTR_FORCE_INLINE +_osd_exchange64(INT64 volatile *ptr, INT64 exchange) +{ + register INT64 ret; + __asm__ __volatile__ ( + " lock ; xchg %[exchange], %[ptr] ;" + : [ptr] "+m" (*ptr) + , [ret] "=r" (ret) + : [exchange] "1" (exchange) + ); + return ret; +} +#define osd_exchange64 _osd_exchange64 + +#endif /* __x86_64__ */ + + +#elif defined(__ppc__) || defined (__PPC__) || defined(__ppc64__) || defined(__PPC64__) + + +INLINE void ATTR_FORCE_INLINE +osd_yield_processor(void) +{ + __asm__ __volatile__ ( " nop \n nop \n" ); +} + + + +#if defined(__ppc64__) || defined(__PPC64__) + +//============================================================ +// osd_exchange64 +//============================================================ + +INLINE INT64 ATTR_UNUSED ATTR_NONNULL(1) ATTR_FORCE_INLINE +_osd_exchange64(INT64 volatile *ptr, INT64 exchange) +{ + register INT64 ret; + __asm__ __volatile__ ( + "1: ldarx %[ret], 0, %[ptr] \n" + " stdcx. %[exchange], 0, %[ptr] \n" + " bne- 1b \n" + : [ret] "=&r" (ret) + : [ptr] "r" (ptr) + , [exchange] "r" (exchange) + : "cr0" + ); + return ret; +} +#define osd_exchange64 _osd_exchange64 + +#endif /* __ppc64__ || __PPC64__ */ + +#endif + +#if defined(__i386__) || defined(__x86_64__) #include "eigccx86.h" #elif defined(__ppc__) || defined (__PPC__) || defined(__ppc64__) || defined(__PPC64__) #include "eigccppc.h" #else -#include "osinline.h" +#error "no matching assembler implementations found - please compile with NOASM=1" +#endif + +#else + +#if defined(_MSC_VER) + +#if (defined(_M_IX86) || defined(_M_X64)) +#include "eivcx86.h" +#endif + +#include "eivc.h" + +INT32 win_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange); +INT32 win_atomic_exchange32(INT32 volatile *ptr, INT32 exchange); +INT32 win_atomic_add32(INT32 volatile *ptr, INT32 delta); + +#ifdef PTR64 +INT64 win_compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange); #endif + +#ifndef compare_exchange32 +#define compare_exchange32 win_compare_exchange32 +#endif /* compare_exchange32 */ + +#ifdef PTR64 +#ifndef compare_exchange64 +#define compare_exchange64 win_compare_exchange64 +#endif /* compare_exchange64 */ +#endif + +#ifndef atomic_exchange32 +#define atomic_exchange32 win_atomic_exchange32 +#endif /* atomic_exchange32 */ + + +#ifndef atomic_add32 +#define atomic_add32 win_atomic_add32 +#endif /* atomic_add32 */ #else -#include "osinline.h" +#error "no matching assembler implementations found - please compile with NOASM=1" + +#endif #endif #endif diff --git a/src/osd/modules/opengl/gl_shader_mgr.c b/src/osd/modules/opengl/gl_shader_mgr.c index 75d4b777cca..46fbc825aa6 100644 --- a/src/osd/modules/opengl/gl_shader_mgr.c +++ b/src/osd/modules/opengl/gl_shader_mgr.c @@ -1,6 +1,7 @@ #include <stdio.h> /* snprintf */ #include <stdlib.h> /* malloc */ +#include "osdcomm.h" #include "osd_opengl.h" #include "gl_shader_mgr.h" diff --git a/src/osd/modules/sync/sync_ntc.c b/src/osd/modules/sync/sync_ntc.c index 9da576b5149..025e5b37713 100644 --- a/src/osd/modules/sync/sync_ntc.c +++ b/src/osd/modules/sync/sync_ntc.c @@ -31,7 +31,6 @@ // MAME headers #include "osdcore.h" -#include "osinline.h" #include "osdsync.h" #include "eminline.h" diff --git a/src/osd/modules/sync/sync_os2.c b/src/osd/modules/sync/sync_os2.c index 5526b26cf3b..75164c517c5 100644 --- a/src/osd/modules/sync/sync_os2.c +++ b/src/osd/modules/sync/sync_os2.c @@ -21,7 +21,6 @@ // MAME headers #include "osdcore.h" -#include "osinline.h" #include "osdsync.h" #include "eminline.h" diff --git a/src/osd/modules/sync/sync_sdl.c b/src/osd/modules/sync/sync_sdl.c index cea1337c7f8..56e2ad15639 100644 --- a/src/osd/modules/sync/sync_sdl.c +++ b/src/osd/modules/sync/sync_sdl.c @@ -18,7 +18,6 @@ // MAME headers #include "osdcore.h" -#include "osinline.h" #include "osdsync.h" #include "eminline.h" diff --git a/src/osd/modules/sync/sync_windows.c b/src/osd/modules/sync/sync_windows.c index 85ee4f35fd7..c3d93c75fc9 100644 --- a/src/osd/modules/sync/sync_windows.c +++ b/src/osd/modules/sync/sync_windows.c @@ -14,7 +14,7 @@ // MAME headers #include "osdcore.h" -#include "osinline.h" +#include "eminline.h" #include "osdsync.h" diff --git a/src/osd/osdcomm.h b/src/osd/osdcomm.h index 4c7835579ac..ec5f6dc2ab3 100644 --- a/src/osd/osdcomm.h +++ b/src/osd/osdcomm.h @@ -223,4 +223,23 @@ typedef UINT32 FPTR; #define __has_feature(x) 0 #endif +#ifdef _MSC_VER +#include <malloc.h> +#if _MSC_VER < 1900 // < VS2015 +#define snprintf _snprintf +#if _MSC_VER < 1800 // VS2013 or earlier +#define alloca _alloca +#define round(x) floor((x) + 0.5) +#define strtoll _strtoi64 +#define _USE_MATH_DEFINES +#include <math.h> +static __inline double fmin(double x, double y){ return (x < y) ? x : y; } +static __inline double fmax(double x, double y){ return (x > y) ? x : y; } +static __inline double log2(double x) { return log(x) * M_LOG2E; } +#endif // VS2013 +#else // VS2015 +#define _CRT_STDIO_LEGACY_WIDE_SPECIFIERS +#endif +#endif + #endif /* __OSDCOMM_H__ */ diff --git a/src/osd/sdl/osinline.h b/src/osd/sdl/osinline.h deleted file mode 100644 index 20a5ad62509..00000000000 --- a/src/osd/sdl/osinline.h +++ /dev/null @@ -1,92 +0,0 @@ -//============================================================ -// -// osinline.h - GNU C inline functions -// -//============================================================ - -#ifndef __OSINLINE__ -#define __OSINLINE__ - -#include "eminline.h" - - -//============================================================ -// INLINE FUNCTIONS -//============================================================ - -#if defined(__i386__) || defined(__x86_64__) - - -INLINE void ATTR_FORCE_INLINE -osd_yield_processor(void) -{ - __asm__ __volatile__ ( " rep ; nop ;" ); -} - - -#if defined(__x86_64__) - -//============================================================ -// osd_exchange64 -//============================================================ - -INLINE INT64 ATTR_UNUSED ATTR_NONNULL(1) ATTR_FORCE_INLINE -_osd_exchange64(INT64 volatile *ptr, INT64 exchange) -{ - register INT64 ret; - __asm__ __volatile__ ( - " lock ; xchg %[exchange], %[ptr] ;" - : [ptr] "+m" (*ptr) - , [ret] "=r" (ret) - : [exchange] "1" (exchange) - ); - return ret; -} -#define osd_exchange64 _osd_exchange64 - -#endif /* __x86_64__ */ - - -#elif defined(__ppc__) || defined (__PPC__) || defined(__ppc64__) || defined(__PPC64__) - - -INLINE void ATTR_FORCE_INLINE -osd_yield_processor(void) -{ - __asm__ __volatile__ ( " nop \n nop \n" ); -} - - - -#if defined(__ppc64__) || defined(__PPC64__) - -//============================================================ -// osd_exchange64 -//============================================================ - -INLINE INT64 ATTR_UNUSED ATTR_NONNULL(1) ATTR_FORCE_INLINE -_osd_exchange64(INT64 volatile *ptr, INT64 exchange) -{ - register INT64 ret; - __asm__ __volatile__ ( - "1: ldarx %[ret], 0, %[ptr] \n" - " stdcx. %[exchange], 0, %[ptr] \n" - " bne- 1b \n" - : [ret] "=&r" (ret) - : [ptr] "r" (ptr) - , [exchange] "r" (exchange) - : "cr0" - ); - return ret; -} -#define osd_exchange64 _osd_exchange64 - -#endif /* __ppc64__ || __PPC64__ */ - -#else - -#error "no matching assembler implementations found - please compile with NOASM=1" - -#endif - -#endif /* __OSINLINE__ */ diff --git a/src/osd/sdl/sdlprefix.h b/src/osd/sdl/sdlprefix.h index 9aff11e17f0..617155dbe2a 100644 --- a/src/osd/sdl/sdlprefix.h +++ b/src/osd/sdl/sdlprefix.h @@ -77,11 +77,6 @@ struct _IO_FILE {}; //_IO_FILE is an opaque type in the emscripten libc which m #endif /* SDLMAME_UNIX */ -#ifdef _MSC_VER -void *__cdecl _alloca(size_t); -#define alloca _alloca -#endif - #ifdef __GNUC__ #define alloca __builtin_alloca #endif diff --git a/src/osd/sdl/watchdog.c b/src/osd/sdl/watchdog.c index d8456cdb15a..fa7ead22224 100644 --- a/src/osd/sdl/watchdog.c +++ b/src/osd/sdl/watchdog.c @@ -11,11 +11,7 @@ #include "osdcomm.h" #include "osdcore.h" -#ifdef SDLMAME_NOASM #include "eminline.h" -#else -#include "osinline.h" -#endif #include "watchdog.h" #include "modules/lib/osdlib.h" diff --git a/src/osd/windows/osinline.h b/src/osd/windows/osinline.h deleted file mode 100644 index 3e28c982cf3..00000000000 --- a/src/osd/windows/osinline.h +++ /dev/null @@ -1,51 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Aaron Giles -//============================================================ -// -// osinline.h -// -// Inline implementations for non-GCC Win32 compilers -// -//============================================================ - -#ifndef __OSINLINE__ -#define __OSINLINE__ - -#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) -#include "eivcx86.h" -#endif - -#if defined(_MSC_VER) -#include "eivc.h" -#endif - -INT32 win_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange); -INT32 win_atomic_exchange32(INT32 volatile *ptr, INT32 exchange); -INT32 win_atomic_add32(INT32 volatile *ptr, INT32 delta); - -#ifdef PTR64 -INT64 win_compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange); -#endif - - -#ifndef compare_exchange32 -#define compare_exchange32 win_compare_exchange32 -#endif /* compare_exchange32 */ - -#ifdef PTR64 -#ifndef compare_exchange64 -#define compare_exchange64 win_compare_exchange64 -#endif /* compare_exchange64 */ -#endif - -#ifndef atomic_exchange32 -#define atomic_exchange32 win_atomic_exchange32 -#endif /* atomic_exchange32 */ - - -#ifndef atomic_add32 -#define atomic_add32 win_atomic_add32 -#endif /* atomic_add32 */ - - -#endif /* __OSINLINE__ */ diff --git a/src/osd/windows/winprefix.h b/src/osd/windows/winprefix.h index a705a2f7399..ea9db3f5650 100644 --- a/src/osd/windows/winprefix.h +++ b/src/osd/windows/winprefix.h @@ -10,34 +10,6 @@ #define _WIN32_WINNT 0x0501 // Windows XP #endif -#ifdef _MSC_VER -#include <malloc.h> -#if _MSC_VER < 1900 // < VS2015 -#define snprintf _snprintf -#if _MSC_VER < 1800 // VS2013 or earlier -#define alloca _alloca -#define round(x) floor((x) + 0.5) -#define strtoll _strtoi64 -#define _USE_MATH_DEFINES -#include <math.h> -static __inline double fmin(double x, double y){ return (x < y) ? x : y; } -static __inline double fmax(double x, double y){ return (x > y) ? x : y; } -static __inline double log2(double x) { return log(x) * M_LOG2E; } -#if _MSC_VER < 1500 // VS2008 or earlier -#define vsnprintf _vsnprintf -#endif // VS2008 -#endif // VS2013 -#else // VS2015 -#pragma warning (disable: 4091) -#pragma warning (disable: 4267) -#pragma warning (disable: 4456 4457 4458 4459) -#pragma warning (disable: 4463) -#pragma warning (disable: 4838) -#pragma warning (disable: 5025 5026 5027) -#define _CRT_STDIO_LEGACY_WIDE_SPECIFIERS -#endif -#endif - #ifdef __GNUC__ #ifndef alloca #define alloca __builtin_alloca |