diff --git a/src/codegen_new/codegen_allocator.c b/src/codegen_new/codegen_allocator.c index 157c3cc0b..c3fca66b7 100644 --- a/src/codegen_new/codegen_allocator.c +++ b/src/codegen_new/codegen_allocator.c @@ -192,11 +192,7 @@ codegen_allocator_clean_blocks(UNUSED(struct mem_block_t *block)) { #if defined __ARM_EABI__ || defined __aarch64__ || defined _M_ARM64 while (1) { -# ifndef _MSC_VER __clear_cache(&mem_block_alloc[block->offset], &mem_block_alloc[block->offset + MEM_BLOCK_SIZE]); -# else - FlushInstructionCache(GetCurrentProcess(), &mem_block_alloc[block->offset], MEM_BLOCK_SIZE); -# endif if (block->next) block = &mem_blocks[block->next - 1]; else diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 25564082b..865e76ffb 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -446,16 +446,14 @@ typedef struct { # define CPU_STATUS_MASK 0xffff0000 #endif -#ifdef _MSC_VER -# define COMPILE_TIME_ASSERT(expr) /*nada*/ + +#ifdef EXTREME_DEBUG +# define COMPILE_TIME_ASSERT(expr) typedef char COMP_TIME_ASSERT[(expr) ? 1 : 0]; #else -# ifdef EXTREME_DEBUG -# define COMPILE_TIME_ASSERT(expr) typedef char COMP_TIME_ASSERT[(expr) ? 1 : 0]; -# else -# define COMPILE_TIME_ASSERT(expr) /*nada*/ -# endif +# define COMPILE_TIME_ASSERT(expr) /*nada*/ #endif + COMPILE_TIME_ASSERT(sizeof(cpu_state_t) <= 128) #define cpu_state_offset(MEMBER) ((uint8_t) ((uintptr_t) &cpu_state.MEMBER - (uintptr_t) &cpu_state - 128)) diff --git a/src/cpu/x87_ops.h b/src/cpu/x87_ops.h index e581652d4..4d099885a 100644 --- a/src/cpu/x87_ops.h +++ b/src/cpu/x87_ops.h @@ -33,9 +33,6 @@ #endif #include "x87_timings.h" -#ifdef _MSC_VER -# include -#endif #include "x87_ops_conv.h" #ifdef ENABLE_FPU_LOG @@ -390,8 +387,7 @@ x87_compare(double a, double b) if ((fpu_type < FPU_287XL) && !(cpu_state.npxc & 0x1000) && ((a == INFINITY) || (a == -INFINITY)) && ((b == INFINITY) || (b == -INFINITY))) eb = ea; -# if !defined(_MSC_VER) || defined(__clang__) - /* Memory barrier, to force GCC to write to the input parameters + /* Memory barrier, to force GCC to write to the input parameters * before the compare rather than after */ __asm volatile("" : @@ -406,17 +402,7 @@ x87_compare(double a, double b) "fnstsw %0\n" : "=m"(result) : "m"(ea), "m"(eb)); -# else - _ReadWriteBarrier(); - _asm - { - fld eb - fld ea - fclex - fcompp - fnstsw result - } -# endif + return result & (FPU_SW_C0 | FPU_SW_C2 | FPU_SW_C3); #else @@ -451,7 +437,6 @@ x87_ucompare(double a, double b) #ifdef X87_INLINE_ASM uint32_t result; -# if !defined(_MSC_VER) || defined(__clang__) /* Memory barrier, to force GCC to write to the input parameters * before the compare rather than after */ __asm volatile("" @@ -467,17 +452,6 @@ x87_ucompare(double a, double b) "fnstsw %0\n" : "=m"(result) : "m"(a), "m"(b)); -# else - _ReadWriteBarrier(); - _asm - { - fld b - fld a - fclex - fcompp - fnstsw result - } -# endif return result & (FPU_SW_C0 | FPU_SW_C2 | FPU_SW_C3); #else diff --git a/src/floppy/fdd_pcjs.c b/src/floppy/fdd_pcjs.c index 2193048c6..b1494cd38 100644 --- a/src/floppy/fdd_pcjs.c +++ b/src/floppy/fdd_pcjs.c @@ -18,11 +18,7 @@ #include #include #include -#ifndef _MSC_VER #include -#else -#include -#endif #define HAVE_STDARG_H #include <86box/86box.h> #include <86box/timer.h> diff --git a/src/include/86box/plat.h b/src/include/86box/plat.h index 7b2f0c12f..2d28ec9bc 100644 --- a/src/include/86box/plat.h +++ b/src/include/86box/plat.h @@ -69,19 +69,10 @@ extern int strnicmp(const char *s1, const char *s2, size_t n); # define fseeko64 fseeko # define ftello64 ftello # define off64_t off_t -#elif defined(_MSC_VER) -// # define fopen64 fopen -# define fseeko64 _fseeki64 -# define ftello64 _ftelli64 -# define off64_t off_t #endif -#ifdef _MSC_VER -# define UNUSED(arg) arg -#else /* A hack (GCC-specific?) to allow us to ignore unused parameters. */ # define UNUSED(arg) __attribute__((unused)) arg -#endif /* Return the size (in wchar's) of a wchar_t array. */ #define sizeof_w(x) (sizeof((x)) / sizeof(wchar_t)) @@ -97,17 +88,14 @@ extern "C" { # define atomic_flag_t atomic_flag # define atomic_bool_t atomic_bool -#ifdef _MSC_VER -# define fallthrough do {} while (0) /* fallthrough */ + +#if __has_attribute(fallthrough) +# define fallthrough __attribute__((fallthrough)) #else -# if __has_attribute(fallthrough) -# define fallthrough __attribute__((fallthrough)) -# else -# if __has_attribute(__fallthrough__) -# define fallthrough __attribute__((__fallthrough__)) -# endif -# define fallthrough do {} while (0) /* fallthrough */ +# if __has_attribute(__fallthrough__) +# define fallthrough __attribute__((__fallthrough__)) # endif +# define fallthrough do {} while (0) /* fallthrough */ #endif #endif diff --git a/src/include/86box/plat_fallthrough.h b/src/include/86box/plat_fallthrough.h index 2ba000848..1221f03fa 100644 --- a/src/include/86box/plat_fallthrough.h +++ b/src/include/86box/plat_fallthrough.h @@ -16,18 +16,16 @@ #define EMU_PLAT_FALLTHROUGH_H #ifndef EMU_PLAT_H -#ifdef _MSC_VER -# define fallthrough do {} while (0) /* fallthrough */ + +#if __has_attribute(fallthrough) +# define fallthrough __attribute__((fallthrough)) #else -# if __has_attribute(fallthrough) -# define fallthrough __attribute__((fallthrough)) -# else -# if __has_attribute(__fallthrough__) -# define fallthrough __attribute__((__fallthrough__)) -# endif -# define fallthrough do {} while (0) /* fallthrough */ +# if __has_attribute(__fallthrough__) +# define fallthrough __attribute__((__fallthrough__)) # endif +# define fallthrough do {} while (0) /* fallthrough */ #endif + #endif #endif /*EMU_PLAT_FALLTHROUGH_H*/ diff --git a/src/include/86box/plat_unused.h b/src/include/86box/plat_unused.h index 4688a615b..4090f3358 100644 --- a/src/include/86box/plat_unused.h +++ b/src/include/86box/plat_unused.h @@ -19,12 +19,9 @@ #define EMU_PLAT_UNUSED_H #ifndef EMU_PLAT_H -#ifdef _MSC_VER -# define UNUSED(arg) arg -#else /* A hack (GCC-specific?) to allow us to ignore unused parameters. */ + # define UNUSED(arg) __attribute__((unused)) arg -#endif -#endif +#endif #endif /*EMU_PLAT_UNUSED_H*/ diff --git a/src/include/86box/vid_voodoo_codegen_x86-64.h b/src/include/86box/vid_voodoo_codegen_x86-64.h index 8b1413ad4..0e43c15bd 100644 --- a/src/include/86box/vid_voodoo_codegen_x86-64.h +++ b/src/include/86box/vid_voodoo_codegen_x86-64.h @@ -8,11 +8,7 @@ #ifndef VIDEO_VOODOO_CODEGEN_X86_64_H #define VIDEO_VOODOO_CODEGEN_X86_64_H -#ifdef _MSC_VER -# include -#else -# include -#endif +#include #define BLOCK_NUM 8 #define BLOCK_MASK (BLOCK_NUM - 1) diff --git a/src/include/86box/vid_voodoo_codegen_x86.h b/src/include/86box/vid_voodoo_codegen_x86.h index 996bd28f1..f479a5413 100644 --- a/src/include/86box/vid_voodoo_codegen_x86.h +++ b/src/include/86box/vid_voodoo_codegen_x86.h @@ -8,11 +8,7 @@ #ifndef VIDEO_VOODOO_CODEGEN_X86_H #define VIDEO_VOODOO_CODEGEN_X86_H -#ifdef _MSC_VER -# include -#else -# include -#endif +#include #define BLOCK_NUM 8 #define BLOCK_MASK (BLOCK_NUM - 1) diff --git a/src/network/network.c b/src/network/network.c index 3f854f356..8680d6c64 100644 --- a/src/network/network.c +++ b/src/network/network.c @@ -52,9 +52,7 @@ #include #include #include -#ifndef _MSC_VER #include -#endif #include #define HAVE_STDARG_H #include <86box/86box.h> diff --git a/src/utils/random.c b/src/utils/random.c index 6ed6c1d0c..5658bc3fb 100644 --- a/src/utils/random.c +++ b/src/utils/random.c @@ -51,16 +51,10 @@ rdtsc(void) #if defined(__x86_64__) unsigned int hi; unsigned int lo; -# ifdef _MSC_VER - __asm { - rdtsc - mov hi, edx ; EDX:EAX is already standard return!! - mov lo, eax - } -# else + __asm__ __volatile__("rdtsc" : "=a"(lo), "=d"(hi)); -# endif + return ((unsigned long long) lo) | (((unsigned long long) hi) << 32); #else return time(NULL);