diff --git a/common/build/Utilities/utilities.vcxproj b/common/build/Utilities/utilities.vcxproj
index bd582a3c5e..1994af3c2e 100644
--- a/common/build/Utilities/utilities.vcxproj
+++ b/common/build/Utilities/utilities.vcxproj
@@ -74,7 +74,9 @@
-
+
+ true
+
diff --git a/common/include/Utilities/win_memzero.h b/common/include/Utilities/win_memzero.h
index b07d5f6efa..13473b132e 100644
--- a/common/include/Utilities/win_memzero.h
+++ b/common/include/Utilities/win_memzero.h
@@ -22,132 +22,12 @@
// These functions are meant for memset operations of constant length only.
// For dynamic length clears, use the C-compiler provided memset instead.
-// MemZero Code Strategies:
-// I use a trick to help the MSVC compiler optimize it's asm code better. The compiler
-// won't optimize local variables very well because it insists in storing them on the
-// stack and then loading them out of the stack when I use them from inline ASM, and
-// it won't allow me to use template parameters in inline asm code either. But I can
-// assign the template parameters to enums, and then use the enums from asm code.
-// Yeah, silly, but it works. :D (air)
-
-// All methods defined in this header use template in combination with the aforementioned
-// enumerations to generate very efficient and compact inlined code. These optimized
-// memsets work on the theory that most uses of memset involve static arrays and
-// structures, which are constant in size, thus allowing us to generate optimal compile-
-// time code for each use of the function.
-
-// Use of CLD (Clear Direction Flag):
-// On Windows platforms the ABI declares that the direction flag should be cleared upon
-// entry of *any* function. Therefore there is no need to have CLD prior to our use of
-// rep strosd here.
-
-// Notes on XMM0's "storage" area (_xmm_backup):
-// Unfortunately there's no way to guarantee alignment for this variable. If I use the
-// __declspec(aligned(16)) decorator, MSVC fails to inline the function since stack
-// alignment requires prep work. And for the same reason it's not possible to check the
-// alignment of the stack at compile time, so I'm forced to use movups to store and
-// retrieve xmm0.
-
-// MSVC Template Issue:
-// MSVC treats int template parameters like macro insertions. That is, if you have a
-// a template parameter in the form of "func<10-5>()", MSVC inserts 10-5 into the
-// templated function, causing order-of-operation problems (sigh). The normal fix would
-// be to assign the template parameter to a static const int inside each function, but that
-// won't fly with the enums optimization. So in order to fix the problem I define a macro
-// that encapsulates the template parameter inside parenthesis for us:
-
-#define MZFbytes (_bytes)
-
-// Code is only called in the init so no need to bother with ASM
template< u8 data, size_t bytes >
static __fi void memset_8( void *dest )
{
memset(dest, data, bytes);
}
-// This is unused on Windows.
-template< u32 data, size_t MZFbytes >
-static __fi void memset_32( void *dest )
-{
- if( MZFbytes == 0 ) return;
-
- // Assertion: data length must be a multiple of 32 bits
- pxAssume( (MZFbytes & 0x3) == 0 );
-
- //u64 _xmm_backup[2];
-
- // This function only works on 32-bit alignments of data copied.
- // If the data length is not a factor of 32 bits, the C++ optimizing compiler will
- // probably just generate mysteriously broken code in Release builds. ;)
-
- pxAssume( (MZFbytes & 0x3) == 0 );
-
- enum
- {
- remdat = MZFbytes>>2,
- data32 = data
- };
-
- // macro to execute the x86/32 "stosd" copies.
- switch( remdat )
- {
- case 1:
- *(u32*)dest = data32;
- return;
-
- case 2:
- ((u32*)dest)[0] = data32;
- ((u32*)dest)[1] = data32;
- return;
-
- case 3:
- __asm
- {
- mov edi, dest;
- mov eax, data32;
- stosd;
- stosd;
- stosd;
- }
- return;
-
- case 4:
- __asm
- {
- mov edi, dest;
- mov eax, data32;
- stosd;
- stosd;
- stosd;
- stosd;
- }
- return;
-
- case 5:
- __asm
- {
- mov edi, dest;
- mov eax, data32;
- stosd;
- stosd;
- stosd;
- stosd;
- stosd;
- }
- return;
-
- default:
- __asm
- {
- mov ecx, remdat;
- mov edi, dest;
- mov eax, data32;
- rep stosd;
- }
- return
- }
-}
-
// This method can clear any object-like entity -- which is anything that is not a pointer.
// Structures, static arrays, etc. No need to include sizeof() crap, this does it automatically
// for you!
@@ -163,13 +43,3 @@ static __fi void memset8( T& object )
{
memset_8( &object );
}
-
-// This method clears an object with the given 32 bit value.
-// This is also unused.
-template< u32 data, typename T >
-static __fi void memset32( T& object )
-{
- memset_32( &object );
-}
-
-#undef MZFbytes
diff --git a/common/src/Utilities/Windows/WinThreads.cpp b/common/src/Utilities/Windows/WinThreads.cpp
index e6cd326a67..5073cbcbfb 100644
--- a/common/src/Utilities/Windows/WinThreads.cpp
+++ b/common/src/Utilities/Windows/WinThreads.cpp
@@ -33,7 +33,7 @@ __fi void Threading::Sleep( int ms )
// improve performance and reduce cpu power consumption.
__fi void Threading::SpinWait()
{
- __asm pause;
+ _mm_pause();
}
__fi void Threading::EnableHiresScheduler()
diff --git a/common/src/x86emitter/WinCpuDetect.cpp b/common/src/x86emitter/WinCpuDetect.cpp
index 7de69371e6..f612404d83 100644
--- a/common/src/x86emitter/WinCpuDetect.cpp
+++ b/common/src/x86emitter/WinCpuDetect.cpp
@@ -1,5 +1,5 @@
/* Cpudetection lib
- * Copyright (C) 2002-2010 PCSX2 Dev Team
+ * Copyright (C) 2002-2016 PCSX2 Dev Team
*
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Found-
@@ -19,55 +19,53 @@
void x86capabilities::CountLogicalCores()
{
- DWORD vProcessCPUs;
- DWORD vSystemCPUs;
+ DWORD_PTR vProcessCPUs;
+ DWORD_PTR vSystemCPUs;
LogicalCores = 1;
- if( !GetProcessAffinityMask (GetCurrentProcess (),
- &vProcessCPUs, &vSystemCPUs) ) return;
+ if (!GetProcessAffinityMask(GetCurrentProcess(), &vProcessCPUs, &vSystemCPUs))
+ return;
uint CPUs = 0;
- DWORD bit;
-
- for (bit = 1; bit != 0; bit <<= 1)
- {
+ for (DWORD_PTR bit = 1; bit != 0; bit <<= 1)
if (vSystemCPUs & bit)
CPUs++;
- }
LogicalCores = CPUs;
}
SingleCoreAffinity::SingleCoreAffinity()
{
- s_threadId = NULL;
- s_oldmask = ERROR_INVALID_PARAMETER;
+ s_threadId = nullptr;
+ s_oldmask = ERROR_INVALID_PARAMETER;
- DWORD_PTR availProcCpus, availSysCpus;
- if( !GetProcessAffinityMask( GetCurrentProcess(), &availProcCpus, &availSysCpus ) ) return;
+ DWORD_PTR availProcCpus;
+ DWORD_PTR availSysCpus;
+ if (!GetProcessAffinityMask(GetCurrentProcess(), &availProcCpus, &availSysCpus))
+ return;
- int i;
- for( i=0; i<32; ++i )
- {
- if( availProcCpus & (1<.
- */
-
-#ifndef _SAMPLPROF_H_
-#define _SAMPLPROF_H_
-
-#include "Common.h"
-
-// The profiler does not have a Linux version yet.
-// So for now we turn it into duds for non-Win32 platforms.
-
-#ifdef _WIN32
-
-void ProfilerInit();
-void ProfilerTerm();
-void ProfilerSetEnabled(bool Enabled);
-void ProfilerRegisterSource(const char* Name, const void* buff, u32 sz);
-void ProfilerRegisterSource(const char* Name, const void* function);
-void ProfilerTerminateSource( const char* Name );
-
-void ProfilerRegisterSource(const wxString& Name, const void* buff, u32 sz);
-void ProfilerRegisterSource(const wxString& Name, const void* function);
-void ProfilerTerminateSource( const wxString& Name );
-
-#else
-
-// Disables the profiler in Debug & Linux builds.
-// Profiling info in debug builds isn't much use anyway and the console
-// popups are annoying when you're trying to trace debug logs and stuff.
-
-#define ProfilerInit() (void)0
-#define ProfilerTerm() (void)0
-#define ProfilerSetEnabled(...) (void)0
-#define ProfilerRegisterSource(...) (void)0
-#define ProfilerTerminateSource(...) (void)0
-
-#endif
-
-#endif
diff --git a/pcsx2/System.cpp b/pcsx2/System.cpp
index 5b8bad51d3..a0aa170996 100644
--- a/pcsx2/System.cpp
+++ b/pcsx2/System.cpp
@@ -20,8 +20,6 @@
#include "newVif.h"
#include "MTVU.h"
-#include "SamplProf.h"
-
#include "Elfheader.h"
#include "System/RecTypes.h"
@@ -43,8 +41,6 @@ RecompiledCodeReserve::RecompiledCodeReserve( const wxString& name, uint defComm
m_blocksize = (1024 * 128) / __pagesize;
m_prot_mode = PageAccess_Any();
m_def_commit = defCommit / __pagesize;
-
- m_profiler_registered = false;
}
RecompiledCodeReserve::~RecompiledCodeReserve() throw()
@@ -55,17 +51,12 @@ RecompiledCodeReserve::~RecompiledCodeReserve() throw()
void RecompiledCodeReserve::_registerProfiler()
{
if (m_profiler_name.IsEmpty() || !IsOk()) return;
- ProfilerRegisterSource( m_profiler_name, m_baseptr, GetReserveSizeInBytes() );
- m_profiler_registered = true;
- // Could potentially be integrated into ProfilerRegisterSource
Perf::any.map((uptr)m_baseptr, GetReserveSizeInBytes(), m_profiler_name.ToUTF8());
}
void RecompiledCodeReserve::_termProfiler()
{
- if (m_profiler_registered)
- ProfilerTerminateSource( m_profiler_name );
}
uint RecompiledCodeReserve::_calcDefaultCommitInBlocks() const
diff --git a/pcsx2/System/RecTypes.h b/pcsx2/System/RecTypes.h
index 73c64af4af..91de2a6f73 100644
--- a/pcsx2/System/RecTypes.h
+++ b/pcsx2/System/RecTypes.h
@@ -34,7 +34,6 @@ protected:
uint m_def_commit;
wxString m_profiler_name;
- bool m_profiler_registered;
public:
RecompiledCodeReserve( const wxString& name=wxEmptyString, uint defCommit = 0 );
diff --git a/pcsx2/windows/SamplProf.cpp b/pcsx2/windows/SamplProf.cpp
deleted file mode 100644
index 024fbee9d9..0000000000
--- a/pcsx2/windows/SamplProf.cpp
+++ /dev/null
@@ -1,356 +0,0 @@
-/* PCSX2 - PS2 Emulator for PCs
- * Copyright (C) 2002-2010 PCSX2 Dev Team
- *
- * PCSX2 is free software: you can redistribute it and/or modify it under the terms
- * of the GNU Lesser General Public License as published by the Free Software Found-
- * ation, either version 3 of the License, or (at your option) any later version.
- *
- * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with PCSX2.
- * If not, see .
- */
-
-#include "PrecompiledHeader.h"
-#include "Utilities/RedtapeWindows.h"
-
-#include "SamplProf.h"
-#include