From 95517a9741175f15124dc11e132620a23bec7a19 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Mon, 5 Sep 2011 09:43:23 -0700 Subject: vs2010: Disable LTCG for realz --- Source/Core/Common/Common.vcxproj | 2 -- 1 file changed, 2 deletions(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Common.vcxproj b/Source/Core/Common/Common.vcxproj index d29043eb7d..732fc7258c 100644 --- a/Source/Core/Common/Common.vcxproj +++ b/Source/Core/Common/Common.vcxproj @@ -45,7 +45,6 @@ false StaticLibrary MultiByte - true StaticLibrary @@ -56,7 +55,6 @@ false StaticLibrary MultiByte - true StaticLibrary -- cgit v1.2.3 From 3939f9595a87393482df617465888f4ed46b6d94 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Wed, 7 Sep 2011 20:20:29 +0200 Subject: Add runtime checks to make sure we aren't overoptimizing the pixel shader cache. --- Source/Core/Common/Src/MsgHandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/MsgHandler.cpp b/Source/Core/Common/Src/MsgHandler.cpp index 3f68e1d29a..17c40d76f8 100644 --- a/Source/Core/Common/Src/MsgHandler.cpp +++ b/Source/Core/Common/Src/MsgHandler.cpp @@ -53,7 +53,7 @@ bool MsgAlert(bool yes_no, int Style, const char* format, ...) { // Read message and write it to the log std::string caption; - char buffer[2048]; + char buffer[4096]; static std::string info_caption; static std::string warn_caption; @@ -86,7 +86,7 @@ bool MsgAlert(bool yes_no, int Style, const char* format, ...) va_list args; va_start(args, format); - CharArrayFromFormatV(buffer, 2047, str_translator(format).c_str(), args); + CharArrayFromFormatV(buffer, sizeof(buffer)-1, str_translator(format).c_str(), args); va_end(args); ERROR_LOG(MASTER_LOG, "%s: %s", caption.c_str(), buffer); -- cgit v1.2.3 From 6c7bda6851b39d358f9b951739156e07345ccfa4 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Thu, 8 Sep 2011 02:09:44 +0200 Subject: Various fixes and cleanups. --- Source/Core/Common/Src/LinearDiskCache.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/LinearDiskCache.h b/Source/Core/Common/Src/LinearDiskCache.h index 7a124aaa7b..a2f758b416 100644 --- a/Source/Core/Common/Src/LinearDiskCache.h +++ b/Source/Core/Common/Src/LinearDiskCache.h @@ -21,12 +21,10 @@ #include "Common.h" #include -// Update this to the current SVN revision every time you change shader generation code. -// We don't automatically get this from SVN_REV because that would mean regenerating the -// shader cache for every revision, graphics-related or not, which is simply annoying. +// Increment this every time you change shader generation code. enum { - LINEAR_DISKCACHE_VER = 6964 + LINEAR_DISKCACHE_VER = 6965 }; // On disk format: -- cgit v1.2.3 From b28348066e083d532d5ab62c93ce0f1dc5c217ed Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Fri, 9 Sep 2011 00:32:04 +0200 Subject: Improve the shader UID debugging stuff and merge it to VideoCommon, effectively enabling it in D3D9 and D3D11 as well. --- Source/Core/Common/Src/MsgHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/MsgHandler.cpp b/Source/Core/Common/Src/MsgHandler.cpp index 17c40d76f8..7c666227aa 100644 --- a/Source/Core/Common/Src/MsgHandler.cpp +++ b/Source/Core/Common/Src/MsgHandler.cpp @@ -53,7 +53,7 @@ bool MsgAlert(bool yes_no, int Style, const char* format, ...) { // Read message and write it to the log std::string caption; - char buffer[4096]; + char buffer[2048]; static std::string info_caption; static std::string warn_caption; -- cgit v1.2.3 From 8c691767da71d041580d362b3b822d50e85d46da Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Sat, 27 Aug 2011 20:42:11 +0200 Subject: Various changes which improve FreeBSD support. Patches by martymac, all credits go to him ;) --- Source/Core/Common/Src/CPUDetect.cpp | 9 +++++++ Source/Core/Common/Src/CommonFuncs.h | 6 +++++ Source/Core/Common/Src/MemoryUtil.cpp | 48 ++++++++++++++++++++++++++++++----- 3 files changed, 57 insertions(+), 6 deletions(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/CPUDetect.cpp b/Source/Core/Common/Src/CPUDetect.cpp index 810c5d2a59..7c231b0a69 100644 --- a/Source/Core/Common/Src/CPUDetect.cpp +++ b/Source/Core/Common/Src/CPUDetect.cpp @@ -32,6 +32,10 @@ //#include #include +#if defined __FreeBSD__ +#include +#include +#else static inline void do_cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { @@ -65,15 +69,20 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx, ); #endif } +#endif /* defined __FreeBSD__ */ static void __cpuid(int info[4], int x) { +#if defined __FreeBSD__ + do_cpuid((unsigned int)x, (unsigned int*)info); +#else unsigned int eax = x, ebx = 0, ecx = 0, edx = 0; do_cpuid(&eax, &ebx, &ecx, &edx); info[0] = eax; info[1] = ebx; info[2] = ecx; info[3] = edx; +#endif } #endif diff --git a/Source/Core/Common/Src/CommonFuncs.h b/Source/Core/Common/Src/CommonFuncs.h index 7dd156f42e..c79137780d 100644 --- a/Source/Core/Common/Src/CommonFuncs.h +++ b/Source/Core/Common/Src/CommonFuncs.h @@ -45,6 +45,8 @@ _mm_shuffle_epi8(__m128i a, __m128i mask) #include #ifdef __linux__ #include +#elif defined __FreeBSD__ +#include #endif // go to debugger mode @@ -137,6 +139,10 @@ inline __attribute__((always_inline)) u32 swap32(u32 _data) {return __builtin_bswap32(_data);} inline __attribute__((always_inline)) u64 swap64(u64 _data) {return __builtin_bswap64(_data);} +#elif __FreeBSD__ +inline u16 swap16(u16 _data) {return bswap16(_data);} +inline u32 swap32(u32 _data) {return bswap32(_data);} +inline u64 swap64(u64 _data) {return bswap64(_data);} #else // Slow generic implementation. inline u16 swap16(u16 data) {return (data >> 8) | (data << 8);} diff --git a/Source/Core/Common/Src/MemoryUtil.cpp b/Source/Core/Common/Src/MemoryUtil.cpp index bc65f856f4..65c70e0c5e 100644 --- a/Source/Core/Common/Src/MemoryUtil.cpp +++ b/Source/Core/Common/Src/MemoryUtil.cpp @@ -27,28 +27,64 @@ #include #endif +#if !defined(MAP_32BIT) +#include +#define PAGE_MASK (getpagesize() - 1) +#define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK)) +#endif + // This is purposely not a full wrapper for virtualalloc/mmap, but it // provides exactly the primitive operations that Dolphin needs. void* AllocateExecutableMemory(size_t size, bool low) { -#ifdef _WIN32 + static char *map_hint = 0; +#if defined(__x86_64__) && !defined(MAP_32BIT) + if (low && (!map_hint)) + map_hint = (char*)round_page(512*1024*1024); /* 0.5 GB rounded up to the next page */ +#endif + +#if defined(_WIN32) void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE); #else - void* ptr = mmap(0, size, PROT_READ | PROT_WRITE | PROT_EXEC, + void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE -#if defined __linux__ && defined __x86_64__ +#if defined(__x86_64__) +#if defined(MAP_32BIT) | (low ? MAP_32BIT : 0) -#endif +#else + | (low ? MAP_FIXED : 0) +#endif /* defined(MAP_32BIT) */ +#endif /* defined(__x86_64__) */ , -1, 0); -#endif +#endif /* defined(_WIN32) */ // printf("Mapped executable memory at %p (size %ld)\n", ptr, // (unsigned long)size); +#if defined(__FreeBSD__) + if (ptr == MAP_FAILED) + { + ptr = NULL; +#else if (ptr == NULL) + { +#endif PanicAlert("Failed to allocate executable memory"); -#ifdef _M_X64 + } +#if defined(__x86_64__) && !defined(MAP_32BIT) + else + { + if (low) + { + map_hint += size; + map_hint = (char*)round_page(map_hint); /* round up to the next page */ + // printf("Next map will (hopefully) be at %p\n", map_hint); + } + } +#endif + +#if defined(_M_X64) if ((u64)ptr >= 0x80000000 && low == true) PanicAlert("Executable memory ended up above 2GB!"); #endif -- cgit v1.2.3 From 5dcb212fc7b65dcc25829b1ee42ef03898023f1e Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Tue, 6 Sep 2011 14:45:05 +0200 Subject: Fix Windows build. --- Source/Core/Common/Src/MemoryUtil.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/MemoryUtil.cpp b/Source/Core/Common/Src/MemoryUtil.cpp index 65c70e0c5e..2d64a434f1 100644 --- a/Source/Core/Common/Src/MemoryUtil.cpp +++ b/Source/Core/Common/Src/MemoryUtil.cpp @@ -27,7 +27,7 @@ #include #endif -#if !defined(MAP_32BIT) +#if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT) #include #define PAGE_MASK (getpagesize() - 1) #define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK)) @@ -38,15 +38,14 @@ void* AllocateExecutableMemory(size_t size, bool low) { +#if defined(_WIN32) + void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE); +#else static char *map_hint = 0; #if defined(__x86_64__) && !defined(MAP_32BIT) if (low && (!map_hint)) map_hint = (char*)round_page(512*1024*1024); /* 0.5 GB rounded up to the next page */ #endif - -#if defined(_WIN32) - void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE); -#else void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE #if defined(__x86_64__) @@ -72,7 +71,7 @@ void* AllocateExecutableMemory(size_t size, bool low) #endif PanicAlert("Failed to allocate executable memory"); } -#if defined(__x86_64__) && !defined(MAP_32BIT) +#if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT) else { if (low) -- cgit v1.2.3 From 81c614fa07dd4949351d1fd13f9bbf03a956cdac Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Thu, 29 Sep 2011 23:32:05 +0200 Subject: Clean up various things. --- Source/Core/Common/Src/LinearDiskCache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/LinearDiskCache.h b/Source/Core/Common/Src/LinearDiskCache.h index a2f758b416..450392e70a 100644 --- a/Source/Core/Common/Src/LinearDiskCache.h +++ b/Source/Core/Common/Src/LinearDiskCache.h @@ -24,7 +24,7 @@ // Increment this every time you change shader generation code. enum { - LINEAR_DISKCACHE_VER = 6965 + LINEAR_DISKCACHE_VER = 6966 }; // On disk format: -- cgit v1.2.3 From 0e1383b788cdc4975ab595b9b9969b9db1878b94 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Thu, 29 Sep 2011 22:55:28 +0200 Subject: Bump disk cache version. --- Source/Core/Common/Src/LinearDiskCache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/LinearDiskCache.h b/Source/Core/Common/Src/LinearDiskCache.h index 450392e70a..f213d2959e 100644 --- a/Source/Core/Common/Src/LinearDiskCache.h +++ b/Source/Core/Common/Src/LinearDiskCache.h @@ -24,7 +24,7 @@ // Increment this every time you change shader generation code. enum { - LINEAR_DISKCACHE_VER = 6966 + LINEAR_DISKCACHE_VER = 6967 }; // On disk format: -- cgit v1.2.3 From d3e639a3979205dc3ec52e6205170b03bbde3a1c Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Sat, 1 Oct 2011 21:03:51 -0500 Subject: fix build issue with intel compiler and fix some unsafe string usages, patch by FilthyMonkey --- Source/Core/Common/Src/Common.h | 2 +- Source/Core/Common/Src/Version.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/Common.h b/Source/Core/Common/Src/Common.h index bc9b4dc051..888a206d5d 100644 --- a/Source/Core/Common/Src/Common.h +++ b/Source/Core/Common/Src/Common.h @@ -143,7 +143,7 @@ private: #define _M_SSE 0x301 #elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) #define _M_SSE 0x301 -#elif _MSC_VER >= 1500 // Visual Studio 2008 +#elif (_MSC_VER >= 1500) || __INTEL_COMPILER // Visual Studio 2008 #define _M_SSE 0x402 #endif diff --git a/Source/Core/Common/Src/Version.cpp b/Source/Core/Common/Src/Version.cpp index f3d30398c8..97e232785d 100644 --- a/Source/Core/Common/Src/Version.cpp +++ b/Source/Core/Common/Src/Version.cpp @@ -30,7 +30,12 @@ const char *scm_rev_str = "Dolphin " #if !SCM_IS_MASTER "[" SCM_BRANCH_STR "] " #endif + +#ifdef __INTEL_COMPILER + BUILD_TYPE_STR SCM_DESC_STR "-ICC"; +#else BUILD_TYPE_STR SCM_DESC_STR; +#endif #ifdef _M_X64 #define NP_ARCH "x64" -- cgit v1.2.3 From d8def74dd1cda90af4fc523cc836ca3e36bb2126 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Mon, 3 Oct 2011 22:53:24 -0700 Subject: add portaudio headers and windows static libs to Externals, enable by default in windows build. --- Source/Core/Common/Src/Common.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/Common.h b/Source/Core/Common/Src/Common.h index 888a206d5d..f08a4d1bfe 100644 --- a/Source/Core/Common/Src/Common.h +++ b/Source/Core/Common/Src/Common.h @@ -89,6 +89,8 @@ private: // Since it is always around on windows #define HAVE_WX 1 + #define HAVE_PORTAUDIO 1 + // Debug definitions #if defined(_DEBUG) #include -- cgit v1.2.3 From b62cac2ca93006c3deae1b4406588ec218d1d0ba Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Sun, 20 Nov 2011 15:50:33 -0800 Subject: Allow modifying main ram size at compile time by changing Memory::REALRAM_SIZE. --- Source/Core/Common/Src/CommonFuncs.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/CommonFuncs.h b/Source/Core/Common/Src/CommonFuncs.h index c79137780d..74d317d95f 100644 --- a/Source/Core/Common/Src/CommonFuncs.h +++ b/Source/Core/Common/Src/CommonFuncs.h @@ -27,6 +27,13 @@ template struct CompileTimeAssert; template<> struct CompileTimeAssert {}; +#define b2(x) ( (x) | ( (x) >> 1) ) +#define b4(x) ( b2(x) | ( b2(x) >> 2) ) +#define b8(x) ( b4(x) | ( b4(x) >> 4) ) +#define b16(x) ( b8(x) | ( b8(x) >> 8) ) +#define b32(x) (b16(x) | (b16(x) >>16) ) +#define ROUND_UP_POW2(x) (b32(x - 1) + 1) + #if defined __GNUC__ && !defined __SSSE3__ #include static __inline __m128i __attribute__((__always_inline__)) -- cgit v1.2.3 From 29865e63664d5b513d0f06e9414fbe0b7a43bd49 Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Wed, 30 Nov 2011 00:37:57 +0100 Subject: Avoid virtual memory range collision between JIT and emulated RAM. Passing MAP_FIXED to mmap causes already mapped pages in the requested region to be replaced. On Mac OS X this caused pages for JIT-generatd code to appear in the memory range previously auto-allocated for the RAM of the emulated machine. This led to a hang at boot time. The same problem can probably occur on FreeBSD, but not on Linux since MAP_32BIT is used there instead of MAP_FIXED. The solution is to not use MAP_FIXED, but instead rely on the OS honoring the hinted address which is below 4 GB: we don't need an exact match, just a low address. --- Source/Core/Common/Src/MemoryUtil.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/MemoryUtil.cpp b/Source/Core/Common/Src/MemoryUtil.cpp index 2d64a434f1..3e3cafa335 100644 --- a/Source/Core/Common/Src/MemoryUtil.cpp +++ b/Source/Core/Common/Src/MemoryUtil.cpp @@ -43,18 +43,20 @@ void* AllocateExecutableMemory(size_t size, bool low) #else static char *map_hint = 0; #if defined(__x86_64__) && !defined(MAP_32BIT) + // This OS has no flag to enforce allocation below the 4 GB boundary, + // but if we hint that we want a low address it is very likely we will + // get one. + // An older version of this code used MAP_FIXED, but that has the side + // effect of discarding already mapped pages that happen to be in the + // requested virtual memory range (such as the emulated RAM, sometimes). if (low && (!map_hint)) map_hint = (char*)round_page(512*1024*1024); /* 0.5 GB rounded up to the next page */ #endif void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE -#if defined(__x86_64__) -#if defined(MAP_32BIT) +#if defined(__x86_64__) && defined(MAP_32BIT) | (low ? MAP_32BIT : 0) -#else - | (low ? MAP_FIXED : 0) -#endif /* defined(MAP_32BIT) */ -#endif /* defined(__x86_64__) */ +#endif , -1, 0); #endif /* defined(_WIN32) */ -- cgit v1.2.3 From 748be364e5ee85cf92dfd0300468afc6bc36cbd2 Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Fri, 2 Dec 2011 01:16:56 +0100 Subject: Fixed range check on TryParse() for u32. On x86-64, "unsigned long" is 64 bits wide, so it is possible for a number to not trigger a range error on strtoul() but still not fit inside an u32. An extra check is added to ensure that 32-bit and 64-bit builds will accept the same numbers. --- Source/Core/Common/Src/StringUtil.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/StringUtil.cpp b/Source/Core/Common/Src/StringUtil.cpp index 18a3575086..94f01e66f8 100644 --- a/Source/Core/Common/Src/StringUtil.cpp +++ b/Source/Core/Common/Src/StringUtil.cpp @@ -125,7 +125,7 @@ std::string StripQuotes(const std::string& s) bool TryParse(const std::string &str, u32 *const output) { char *endptr = NULL; - u32 value = strtoul(str.c_str(), &endptr, 0); + unsigned long value = strtoul(str.c_str(), &endptr, 0); if (!endptr || *endptr) return false; @@ -133,7 +133,13 @@ bool TryParse(const std::string &str, u32 *const output) if (value == ULONG_MAX && errno == ERANGE) return false; - *output = value; + if (ULONG_MAX > UINT_MAX) { + // Leading bits must be either all 0 or all 1. + if ((~value | UINT_MAX) != ULONG_MAX && (value | UINT_MAX) != ULONG_MAX) + return false; + } + + *output = static_cast(value); return true; } -- cgit v1.2.3 From 7423c74deb5d1b092fc9386c11305d8983327288 Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Mon, 12 Dec 2011 00:43:23 +0100 Subject: Force the "ebx" argument to be mapped to a register (not necessarily EBX). Fixes crash on x86 under OS X. Thanks to kiesel for the fix and to shuffle2 for remembering the problem. --- Source/Core/Common/Src/CPUDetect.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/CPUDetect.cpp b/Source/Core/Common/Src/CPUDetect.cpp index 7c231b0a69..33efef7c01 100644 --- a/Source/Core/Common/Src/CPUDetect.cpp +++ b/Source/Core/Common/Src/CPUDetect.cpp @@ -48,7 +48,7 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx, "movl %%ebx,%1;" "mov %%rdi,%%rbx;" : "=a" (*eax), - "=g" (*ebx), + "=r" (*ebx), "=c" (*ecx), "=d" (*edx) : "a" (*eax) @@ -61,7 +61,7 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx, "movl %%ebx,%1;" "movl %%edi,%%ebx;" : "=a" (*eax), - "=g" (*ebx), + "=r" (*ebx), "=c" (*ecx), "=d" (*edx) : "a" (*eax) -- cgit v1.2.3 From ee5a29e6f2010eea7d9953a875f5ff7dc8149fda Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Mon, 12 Dec 2011 02:14:56 +0100 Subject: For CPUID, save EBX on the stack instead of in a register. This fixes GCC running out of registers when compiling for x86 in release mode. Thanks to kiesel. --- Source/Core/Common/Src/CPUDetect.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/CPUDetect.cpp b/Source/Core/Common/Src/CPUDetect.cpp index 33efef7c01..99e43f5c46 100644 --- a/Source/Core/Common/Src/CPUDetect.cpp +++ b/Source/Core/Common/Src/CPUDetect.cpp @@ -43,29 +43,27 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx, // Note: EBX is reserved on Mac OS X and in PIC on Linux, so it has to // restored at the end of the asm block. __asm__ ( - "mov %%rbx,%%rdi;" + "pushq %%rbx;" "cpuid;" "movl %%ebx,%1;" - "mov %%rdi,%%rbx;" + "popq %%rbx;" : "=a" (*eax), - "=r" (*ebx), + "=S" (*ebx), "=c" (*ecx), "=d" (*edx) : "a" (*eax) - : "rdi", "rbx" ); #else - __asm__( - "movl %%ebx,%%edi;" + __asm__ ( + "pushl %%ebx;" "cpuid;" - "movl %%ebx,%1;" - "movl %%edi,%%ebx;" + "movl %%ebx,%1;" + "popl %%ebx;" : "=a" (*eax), - "=r" (*ebx), + "=S" (*ebx), "=c" (*ecx), "=d" (*edx) : "a" (*eax) - : "edi", "ebx" ); #endif } -- cgit v1.2.3 From 27bda2c054f38cdd8b6a04fe939ea006535ae532 Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Tue, 13 Dec 2011 02:02:31 +0100 Subject: Fixed range check on TryParse() for u32, again. The code from 748be364e5ee incorrectly accepted -0x100000000 on x86_64. Also if ERANGE is returned by strtoul(), reject the parsed value regardless of what that value is. This fixes invalid values being returned when compiling with Visual C++. Thanks to "cotton" for testing this. --- Source/Core/Common/Src/StringUtil.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/StringUtil.cpp b/Source/Core/Common/Src/StringUtil.cpp index 94f01e66f8..cdd1016210 100644 --- a/Source/Core/Common/Src/StringUtil.cpp +++ b/Source/Core/Common/Src/StringUtil.cpp @@ -130,12 +130,13 @@ bool TryParse(const std::string &str, u32 *const output) if (!endptr || *endptr) return false; - if (value == ULONG_MAX && errno == ERANGE) + if (errno == ERANGE) return false; if (ULONG_MAX > UINT_MAX) { - // Leading bits must be either all 0 or all 1. - if ((~value | UINT_MAX) != ULONG_MAX && (value | UINT_MAX) != ULONG_MAX) + // Note: The typecasts avoid GCC warnings when long is 32 bits wide. + if (value >= static_cast(0x100000000ull) + && value <= static_cast(0xFFFFFFFF00000000ull)) return false; } -- cgit v1.2.3 From c68c8c388cc29cfd4e97be8fc7f5ea7534508672 Mon Sep 17 00:00:00 2001 From: nitsuja Date: Sat, 17 Dec 2011 16:49:24 -0800 Subject: made savestate loads less fragile by adding some markers and rolling back on a mismatch. This should make it so if you try to load an incompatible save, it simply doesn't load, instead of crashing dolphin. (I can't guarantee no crash but it's much less likely now) --- Source/Core/Common/Src/ChunkFile.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/ChunkFile.h b/Source/Core/Common/Src/ChunkFile.h index 03216deaf1..b0662d2517 100644 --- a/Source/Core/Common/Src/ChunkFile.h +++ b/Source/Core/Common/Src/ChunkFile.h @@ -170,6 +170,17 @@ public: // TODO PanicAlert("Do(linked list<>) does not yet work."); } + + void DoMarker(const char* prevName, u32 arbitraryNumber=0x42) + { + u32 cookie = arbitraryNumber; + Do(cookie); + if(mode == PointerWrap::MODE_READ && cookie != arbitraryNumber) + { + PanicAlertT("Error: After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). Aborting savestate load...", prevName, cookie, cookie, arbitraryNumber, arbitraryNumber); + mode = PointerWrap::MODE_MEASURE; + } + } }; -- cgit v1.2.3 From de4e3e7462c86c2eac4383d80dd917a81a9a6cfa Mon Sep 17 00:00:00 2001 From: LPFaint99 Date: Sun, 18 Dec 2011 22:01:46 -0800 Subject: add wstring name(s)/description to the cachefile, use when available in gamelist and properties window --- Source/Core/Common/Src/ChunkFile.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/ChunkFile.h b/Source/Core/Common/Src/ChunkFile.h index b0662d2517..4ed781dcbd 100644 --- a/Source/Core/Common/Src/ChunkFile.h +++ b/Source/Core/Common/Src/ChunkFile.h @@ -154,7 +154,21 @@ public: } (*ptr) += stringLen; } - + + void Do(std::wstring &x) + { + int stringLen = sizeof(wchar_t)*((int)x.length() + 1); + Do(stringLen); + + switch (mode) { + case MODE_READ: x = (wchar_t*)*ptr; break; + case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break; + case MODE_MEASURE: break; + case MODE_VERIFY: _dbg_assert_msg_(COMMON, x == (wchar_t*)*ptr, "Savestate verification failure: \"%s\" != \"%s\" (at %p).\n", x.c_str(), (wchar_t*)*ptr, ptr); break; + } + (*ptr) += stringLen; + } + template void DoArray(T *x, int count) { DoVoid((void *)x, sizeof(T) * count); -- cgit v1.2.3 From 1df7af35e994f651cd628a9cc5c11745381a1cb7 Mon Sep 17 00:00:00 2001 From: skidau Date: Thu, 29 Dec 2011 12:05:36 +1100 Subject: Reset errno to zero before testing it after the strtoul call. Fixes issue 5078. --- Source/Core/Common/Src/StringUtil.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/StringUtil.cpp b/Source/Core/Common/Src/StringUtil.cpp index cdd1016210..664987d350 100644 --- a/Source/Core/Common/Src/StringUtil.cpp +++ b/Source/Core/Common/Src/StringUtil.cpp @@ -125,6 +125,10 @@ std::string StripQuotes(const std::string& s) bool TryParse(const std::string &str, u32 *const output) { char *endptr = NULL; + + // Reset errno to a value other than ERANGE + errno = 0; + unsigned long value = strtoul(str.c_str(), &endptr, 0); if (!endptr || *endptr) -- cgit v1.2.3 From f0d7b8122f4c00ce188604f6e2522b73af91872b Mon Sep 17 00:00:00 2001 From: nitsuja Date: Fri, 30 Dec 2011 20:37:46 -0800 Subject: increased fault tolerance of shader cache files. more specifically: if the emulator stops unexpectedly, it is quite possible that one of the shader cache files will have some bytes near the end that never got their values filled in. this change adds an index number at the end of each entry as extra verification that the entry is valid, so that invalid entries can be ignored (and eventually overwritten) instead of causing crashes. --- Source/Core/Common/Src/LinearDiskCache.h | 39 ++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 7 deletions(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/LinearDiskCache.h b/Source/Core/Common/Src/LinearDiskCache.h index f213d2959e..ac10b5ef20 100644 --- a/Source/Core/Common/Src/LinearDiskCache.h +++ b/Source/Core/Common/Src/LinearDiskCache.h @@ -24,7 +24,7 @@ // Increment this every time you change shader generation code. enum { - LINEAR_DISKCACHE_VER = 6967 + LINEAR_DISKCACHE_VER = 6969 }; // On disk format: @@ -71,36 +71,58 @@ public: // close any currently opened file Close(); + m_num_entries = 0; // try opening for reading/writing - m_file.open(filename, ios_base::in | ios_base::out | ios_base::binary | ios_base::app); + m_file.open(filename, ios_base::in | ios_base::out | ios_base::binary); + + m_file.seekg(0, std::ios::end); + std::fstream::pos_type end_pos = m_file.tellg(); + m_file.seekg(0, std::ios::beg); + std::fstream::pos_type start_pos = m_file.tellg(); + std::streamoff file_size = end_pos - start_pos; if (m_file.is_open() && ValidateHeader()) { // good header, read some key/value pairs - u32 num_entries = 0; K key; V *value = NULL; u32 value_size; + u32 entry_number; + + std::fstream::pos_type last_pos = m_file.tellg(); while (Read(&value_size)) { + std::streamoff next_extent = (last_pos - start_pos) + sizeof(value_size) + value_size; + if (next_extent > file_size) + break; + delete[] value; value = new V[value_size]; // read key/value and pass to reader - if (Read(&key) && Read(value, value_size)) + if (Read(&key) && + Read(value, value_size) && + Read(&entry_number) && + entry_number == m_num_entries+1) + { reader.Read(key, value, value_size); + } else + { break; + } - ++num_entries; + m_num_entries++; + last_pos = m_file.tellg(); } + m_file.seekp(last_pos); m_file.clear(); delete[] value; - return num_entries; + return m_num_entries; } // failed to open file for reading or bad header @@ -127,10 +149,12 @@ public: // Appends a key-value pair to the store. void Append(const K &key, const V *value, u32 value_size) { - // TODO: Should do a check that we don't already have "key"? + // TODO: Should do a check that we don't already have "key"? (I think each caller does that already.) Write(&value_size); Write(&key); Write(value, value_size); + m_num_entries++; + Write(&m_num_entries); } private: @@ -174,6 +198,7 @@ private: } m_header; std::fstream m_file; + u32 m_num_entries; }; #endif // _LINEAR_DISKCACHE -- cgit v1.2.3 From 59e93bff78f54a0cff3f2c6558ed1a69b47a9534 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Sun, 1 Jan 2012 20:45:15 +0100 Subject: Fix a crash at startup with Dolphin on Linux compiled in debug mode Use the clobber list instead of the stack to save rbx when executing the cpuid instruction with inline assembly. This avoids breaking GCC assumptions about the stack pointer location. --- Source/Core/Common/Src/CPUDetect.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/CPUDetect.cpp b/Source/Core/Common/Src/CPUDetect.cpp index 99e43f5c46..93e9d25087 100644 --- a/Source/Core/Common/Src/CPUDetect.cpp +++ b/Source/Core/Common/Src/CPUDetect.cpp @@ -43,27 +43,25 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx, // Note: EBX is reserved on Mac OS X and in PIC on Linux, so it has to // restored at the end of the asm block. __asm__ ( - "pushq %%rbx;" "cpuid;" "movl %%ebx,%1;" - "popq %%rbx;" : "=a" (*eax), "=S" (*ebx), "=c" (*ecx), "=d" (*edx) : "a" (*eax) + : "rbx" ); #else __asm__ ( - "pushl %%ebx;" "cpuid;" "movl %%ebx,%1;" - "popl %%ebx;" : "=a" (*eax), "=S" (*ebx), "=c" (*ecx), "=d" (*edx) : "a" (*eax) + : "ebx" ); #endif } -- cgit v1.2.3 From 69b2d4ddc1cb552fb11814079d0c989007ba1efe Mon Sep 17 00:00:00 2001 From: skidau Date: Sat, 31 Dec 2011 15:18:48 +1100 Subject: Changed the Gecko code handling to the native code handler. This provides full compatibility with all Gecko codes. To use the native code handler, place the kenobiwii.bin file into the Sys directory. Dolphin will silently fall-back to the emulated code handler if the file is not there. Fixes issue 4561. --- Source/Core/Common/Src/CommonPaths.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/CommonPaths.h b/Source/Core/Common/Src/CommonPaths.h index 8d37482ce1..150453928e 100644 --- a/Source/Core/Common/Src/CommonPaths.h +++ b/Source/Core/Common/Src/CommonPaths.h @@ -126,6 +126,8 @@ #define WII_USA_SETTING "setting-usa.txt" #define WII_JAP_SETTING "setting-jpn.txt" +#define GECKO_CODE_HANDLER "kenobiwii.bin" + // Subdirs in Sys #define GC_SYS_DIR "GC" #define WII_SYS_DIR "Wii" -- cgit v1.2.3 From b9547a07f580410bf565a6de88b20f209ed14f95 Mon Sep 17 00:00:00 2001 From: skidau Date: Mon, 2 Jan 2012 15:14:30 +1100 Subject: Updated the Gecko code handler to the latest version from Gecko OS 1.9.3.1. Added a check to ensure that the number of codes fits in memory (maximum 231 codes). Store a copy of codehandler.bin in the Sys directory. --- Source/Core/Common/Src/CommonPaths.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/CommonPaths.h b/Source/Core/Common/Src/CommonPaths.h index 150453928e..d319fb541e 100644 --- a/Source/Core/Common/Src/CommonPaths.h +++ b/Source/Core/Common/Src/CommonPaths.h @@ -126,7 +126,7 @@ #define WII_USA_SETTING "setting-usa.txt" #define WII_JAP_SETTING "setting-jpn.txt" -#define GECKO_CODE_HANDLER "kenobiwii.bin" +#define GECKO_CODE_HANDLER "codehandler.bin" // Subdirs in Sys #define GC_SYS_DIR "GC" -- cgit v1.2.3 From 81a1efab8e61c7611f8f0ac3b4793d25c99d605a Mon Sep 17 00:00:00 2001 From: nitsuja Date: Mon, 2 Jan 2012 01:29:16 -0800 Subject: fixed an issue where the CPU sometimes single-steps an extra time after pausing --- Source/Core/Common/Src/Thread.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/Thread.h b/Source/Core/Common/Src/Thread.h index ba713ed64c..e711fcab5c 100644 --- a/Source/Core/Common/Src/Thread.h +++ b/Source/Core/Common/Src/Thread.h @@ -72,6 +72,13 @@ public: is_set = false; } + void Reset() + { + std::unique_lock lk(m_mutex); + // no other action required, since wait loops on the predicate and any lingering signal will get cleared on the first iteration + is_set = false; + } + private: class IsSet { -- cgit v1.2.3 From 39613a95a80db27d262ad8ed4b75858c78aeed83 Mon Sep 17 00:00:00 2001 From: nitsuja Date: Mon, 2 Jan 2012 02:20:22 -0800 Subject: initialize the uninitialized --- Source/Core/Common/Src/VideoBackendBase.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/VideoBackendBase.h b/Source/Core/Common/Src/VideoBackendBase.h index 667a3d3a32..28c8f23246 100644 --- a/Source/Core/Common/Src/VideoBackendBase.h +++ b/Source/Core/Common/Src/VideoBackendBase.h @@ -140,6 +140,7 @@ class VideoBackendHardware : public VideoBackend { void DoState(PointerWrap &p); void RunLoop(bool enable); + bool Initialize(void *&) { InitializeShared(); return true; } void EmuStateChange(EMUSTATE_CHANGE); @@ -165,6 +166,9 @@ class VideoBackendHardware : public VideoBackend readFn16 Video_PERead16(); writeFn16 Video_PEWrite16(); writeFn32 Video_PEWrite32(); + +protected: + void InitializeShared(); }; #endif -- cgit v1.2.3 From 5a15d58964e29149634a47edae9edb887fe020d8 Mon Sep 17 00:00:00 2001 From: calc84maniac Date: Thu, 5 Jan 2012 22:36:27 -0500 Subject: Added emitters for BT/BTR/BTS/BTC x86 instructions, optimized extended arithmetic PowerPC instructions --- Source/Core/Common/Src/x64Emitter.cpp | 33 +++++++++++++++++++++++++++++++++ Source/Core/Common/Src/x64Emitter.h | 7 +++++++ 2 files changed, 40 insertions(+) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/x64Emitter.cpp b/Source/Core/Common/Src/x64Emitter.cpp index 9acfac5864..7583ef0fc3 100644 --- a/Source/Core/Common/Src/x64Emitter.cpp +++ b/Source/Core/Common/Src/x64Emitter.cpp @@ -834,6 +834,39 @@ void XEmitter::SHL(int bits, OpArg dest, OpArg shift) {WriteShift(bits, dest, sh void XEmitter::SHR(int bits, OpArg dest, OpArg shift) {WriteShift(bits, dest, shift, 5);} void XEmitter::SAR(int bits, OpArg dest, OpArg shift) {WriteShift(bits, dest, shift, 7);} +// index can be either imm8 or register, don't use memory destination because it's slow +void XEmitter::WriteBitTest(int bits, OpArg &dest, OpArg &index, int ext) +{ + if (dest.IsImm()) + { + _assert_msg_(DYNA_REC, 0, "WriteBitTest - can't test imms"); + } + if ((index.IsImm() && index.GetImmBits() != 8)) + { + _assert_msg_(DYNA_REC, 0, "WriteBitTest - illegal argument"); + } + if (bits == 16) Write8(0x66); + if (index.IsImm()) + { + dest.WriteRex(this, bits, bits); + Write8(0x0F); Write8(0xBA); + dest.WriteRest(this, 1, (X64Reg)ext); + Write8((u8)index.offset); + } + else + { + X64Reg operand = index.GetSimpleReg(); + dest.WriteRex(this, bits, bits, operand); + Write8(0x0F); Write8(0x83 + 8*ext); + dest.WriteRest(this, 1, operand); + } +} + +void XEmitter::BT(int bits, OpArg dest, OpArg index) {WriteBitTest(bits, dest, index, 4);} +void XEmitter::BTS(int bits, OpArg dest, OpArg index) {WriteBitTest(bits, dest, index, 5);} +void XEmitter::BTR(int bits, OpArg dest, OpArg index) {WriteBitTest(bits, dest, index, 6);} +void XEmitter::BTC(int bits, OpArg dest, OpArg index) {WriteBitTest(bits, dest, index, 7);} + void OpArg::WriteSingleByteOp(XEmitter *emit, u8 op, X64Reg _operandReg, int bits) { if (bits == 16) diff --git a/Source/Core/Common/Src/x64Emitter.h b/Source/Core/Common/Src/x64Emitter.h index 9ffb890f54..6bd9291eea 100644 --- a/Source/Core/Common/Src/x64Emitter.h +++ b/Source/Core/Common/Src/x64Emitter.h @@ -249,6 +249,7 @@ private: void WriteMulDivType(int bits, OpArg src, int ext); void WriteBitSearchType(int bits, X64Reg dest, OpArg src, u8 byte2); void WriteShift(int bits, OpArg dest, OpArg &shift, int ext); + void WriteBitTest(int bits, OpArg &dest, OpArg &index, int ext); void WriteMXCSR(OpArg arg, int ext); void WriteSSEOp(int size, u8 sseOp, bool packed, X64Reg regOp, OpArg arg, int extrabytes = 0); void WriteNormalOp(XEmitter *emit, int bits, NormalOp op, const OpArg &a1, const OpArg &a2); @@ -374,6 +375,12 @@ public: void SHR(int bits, OpArg dest, OpArg shift); void SAR(int bits, OpArg dest, OpArg shift); + // Bit Test + void BT(int bits, OpArg dest, OpArg index); + void BTS(int bits, OpArg dest, OpArg index); + void BTR(int bits, OpArg dest, OpArg index); + void BTC(int bits, OpArg dest, OpArg index); + // Extend EAX into EDX in various ways void CWD(int bits = 16); inline void CDQ() {CWD(32);} -- cgit v1.2.3 From 9ab69febe546ed498f3a6831c2c8ff363a373352 Mon Sep 17 00:00:00 2001 From: nitsuja Date: Sat, 7 Jan 2012 20:46:41 -0800 Subject: fix for stack corruption caused by certain DSP LLE JIT ABI calls. if you were getting crashes or freezes as a result of using the "DSP LLE on Thread" option, this might fix that. --- Source/Core/Common/Src/ABI.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/ABI.cpp b/Source/Core/Common/Src/ABI.cpp index 08e021f083..63a8e76934 100644 --- a/Source/Core/Common/Src/ABI.cpp +++ b/Source/Core/Common/Src/ABI.cpp @@ -189,7 +189,7 @@ unsigned int XEmitter::ABI_GetAlignedFrameSize(unsigned int frameSize) { #ifdef __GNUC__ (frameSize + 15) & -16; #else - frameSize; + (frameSize + 3) & -4; #endif return alignedSize; } @@ -200,16 +200,15 @@ void XEmitter::ABI_AlignStack(unsigned int frameSize) { // Linux requires the stack to be 16-byte aligned before calls that put SSE // vectors on the stack, but since we do not keep track of which calls do that, // it is effectively every call as well. -// Windows binaries compiled with MSVC do not have such a restriction, but I +// Windows binaries compiled with MSVC do not have such a restriction*, but I // expect that GCC on Windows acts the same as GCC on Linux in this respect. // It would be nice if someone could verify this. -#ifdef __GNUC__ +// *However, the MSVC optimizing compiler assumes a 4-byte-aligned stack at times. unsigned int fillSize = ABI_GetAlignedFrameSize(frameSize) - (frameSize + 4); if (fillSize != 0) { SUB(32, R(ESP), Imm8(fillSize)); } -#endif } void XEmitter::ABI_RestoreStack(unsigned int frameSize) { -- cgit v1.2.3 From 31ff1907a4718c7323acc8b8a8c59795697f6643 Mon Sep 17 00:00:00 2001 From: nitsuja Date: Fri, 23 Dec 2011 11:55:17 -0600 Subject: added an option to log to the attached Windows debugger (so e.g. NOTICE_LOG messages can show up in Visual Studio's output window) --- Source/Core/Common/Src/LogManager.cpp | 13 +++++++++++++ Source/Core/Common/Src/LogManager.h | 12 ++++++++++++ 2 files changed, 25 insertions(+) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/LogManager.cpp b/Source/Core/Common/Src/LogManager.cpp index d95e76ac5b..a79c413cf8 100644 --- a/Source/Core/Common/Src/LogManager.cpp +++ b/Source/Core/Common/Src/LogManager.cpp @@ -85,12 +85,17 @@ LogManager::LogManager() m_fileLog = new FileLogListener(File::GetUserPath(F_MAINLOG_IDX).c_str()); m_consoleLog = new ConsoleListener(); + m_debuggerLog = new DebuggerLogListener(); for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) { m_Log[i]->SetEnable(true); m_Log[i]->AddListener(m_fileLog); m_Log[i]->AddListener(m_consoleLog); +#ifdef _MSC_VER + if (IsDebuggerPresent()) + m_Log[i]->AddListener(m_debuggerLog); +#endif } } @@ -100,6 +105,7 @@ LogManager::~LogManager() { m_logManager->RemoveListener((LogTypes::LOG_TYPE)i, m_fileLog); m_logManager->RemoveListener((LogTypes::LOG_TYPE)i, m_consoleLog); + m_logManager->RemoveListener((LogTypes::LOG_TYPE)i, m_debuggerLog); } for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) @@ -187,3 +193,10 @@ void FileLogListener::Log(LogTypes::LOG_LEVELS, const char *msg) std::lock_guard lk(m_log_lock); m_logfile << msg << std::flush; } + +void DebuggerLogListener::Log(LogTypes::LOG_LEVELS, const char *msg) +{ +#if _MSC_VER + ::OutputDebugStringA(msg); +#endif +} diff --git a/Source/Core/Common/Src/LogManager.h b/Source/Core/Common/Src/LogManager.h index 3f2b5cd168..1722c0b1bf 100644 --- a/Source/Core/Common/Src/LogManager.h +++ b/Source/Core/Common/Src/LogManager.h @@ -58,6 +58,12 @@ private: bool m_enable; }; +class DebuggerLogListener : public LogListener +{ +public: + void Log(LogTypes::LOG_LEVELS, const char *msg); +}; + class LogContainer { public: @@ -97,6 +103,7 @@ private: LogContainer* m_Log[LogTypes::NUMBER_OF_LOGS]; FileLogListener *m_fileLog; ConsoleListener *m_consoleLog; + DebuggerLogListener *m_debuggerLog; static LogManager *m_logManager; // Singleton. Ugh. LogManager(); @@ -153,6 +160,11 @@ public: return m_consoleLog; } + DebuggerLogListener *GetDebuggerListener() const + { + return m_debuggerLog; + } + static LogManager* GetInstance() { return m_logManager; -- cgit v1.2.3 From 79ca43226cfa5363bf6826d14c9518c7b26f6078 Mon Sep 17 00:00:00 2001 From: calc84maniac Date: Mon, 9 Jan 2012 00:10:13 -0500 Subject: Added SHRD/SHLD x86 emitters, further optimized srawx --- Source/Core/Common/Src/x64Emitter.cpp | 63 +++++++++++++++++++++++++++++++++++ Source/Core/Common/Src/x64Emitter.h | 4 +++ 2 files changed, 67 insertions(+) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/x64Emitter.cpp b/Source/Core/Common/Src/x64Emitter.cpp index 7583ef0fc3..00c58a0fbc 100644 --- a/Source/Core/Common/Src/x64Emitter.cpp +++ b/Source/Core/Common/Src/x64Emitter.cpp @@ -867,6 +867,69 @@ void XEmitter::BTS(int bits, OpArg dest, OpArg index) {WriteBitTest(bits, dest, void XEmitter::BTR(int bits, OpArg dest, OpArg index) {WriteBitTest(bits, dest, index, 6);} void XEmitter::BTC(int bits, OpArg dest, OpArg index) {WriteBitTest(bits, dest, index, 7);} +//shift can be either imm8 or cl +void XEmitter::SHRD(int bits, OpArg dest, OpArg src, OpArg shift) +{ + bool writeImm = false; + if (dest.IsImm()) + { + _assert_msg_(DYNA_REC, 0, "SHRD - can't use imms as destination"); + } + if (!src.IsSimpleReg()) + { + _assert_msg_(DYNA_REC, 0, "SHRD - must use simple register as source"); + } + if ((shift.IsSimpleReg() && shift.GetSimpleReg() != ECX) || (shift.IsImm() && shift.GetImmBits() != 8)) + { + _assert_msg_(DYNA_REC, 0, "SHRD - illegal shift"); + } + if (bits == 16) Write8(0x66); + X64Reg operand = src.GetSimpleReg(); + dest.WriteRex(this, bits, bits, operand); + if (shift.GetImmBits() == 8) + { + Write8(0x0F); Write8(0xAC); + dest.WriteRest(this, 1, operand); + Write8((u8)shift.offset); + } + else + { + Write8(0x0F); Write8(0xAD); + dest.WriteRest(this, 0, operand); + } +} + +void XEmitter::SHLD(int bits, OpArg dest, OpArg src, OpArg shift) +{ + bool writeImm = false; + if (dest.IsImm()) + { + _assert_msg_(DYNA_REC, 0, "SHLD - can't use imms as destination"); + } + if (!src.IsSimpleReg()) + { + _assert_msg_(DYNA_REC, 0, "SHLD - must use simple register as source"); + } + if ((shift.IsSimpleReg() && shift.GetSimpleReg() != ECX) || (shift.IsImm() && shift.GetImmBits() != 8)) + { + _assert_msg_(DYNA_REC, 0, "SHLD - illegal shift"); + } + if (bits == 16) Write8(0x66); + X64Reg operand = src.GetSimpleReg(); + dest.WriteRex(this, bits, bits, operand); + if (shift.GetImmBits() == 8) + { + Write8(0x0F); Write8(0xA4); + dest.WriteRest(this, 1, operand); + Write8((u8)shift.offset); + } + else + { + Write8(0x0F); Write8(0xA5); + dest.WriteRest(this, 0, operand); + } +} + void OpArg::WriteSingleByteOp(XEmitter *emit, u8 op, X64Reg _operandReg, int bits) { if (bits == 16) diff --git a/Source/Core/Common/Src/x64Emitter.h b/Source/Core/Common/Src/x64Emitter.h index 6bd9291eea..3b699c81a0 100644 --- a/Source/Core/Common/Src/x64Emitter.h +++ b/Source/Core/Common/Src/x64Emitter.h @@ -381,6 +381,10 @@ public: void BTR(int bits, OpArg dest, OpArg index); void BTC(int bits, OpArg dest, OpArg index); + // Double-Precision Shift + void SHRD(int bits, OpArg dest, OpArg src, OpArg shift); + void SHLD(int bits, OpArg dest, OpArg src, OpArg shift); + // Extend EAX into EDX in various ways void CWD(int bits = 16); inline void CDQ() {CWD(32);} -- cgit v1.2.3 From a0d6d682434852068fca1f6411dd130ebca366bb Mon Sep 17 00:00:00 2001 From: LPFaint99 Date: Sun, 21 Aug 2011 21:10:58 -0700 Subject: sysconf SetArayData use the minimum of the buffersize or the dataLength --- Source/Core/Common/Src/SysConf.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/SysConf.h b/Source/Core/Common/Src/SysConf.h index 119cc3c45a..fb9c775828 100644 --- a/Source/Core/Common/Src/SysConf.h +++ b/Source/Core/Common/Src/SysConf.h @@ -66,10 +66,9 @@ struct SSysConfEntry } bool SetArrayData(u8* buffer, u16 bufferSize) { - - if (buffer && bufferSize <= dataLength) + if (buffer) { - memcpy(data, buffer, bufferSize); + memcpy(data, buffer, min(bufferSize, dataLength)); return true; } return false; -- cgit v1.2.3 From 25eae39b7c6af2bfdbec1c64310b56affa7b923e Mon Sep 17 00:00:00 2001 From: skidau Date: Mon, 6 Feb 2012 20:51:24 +1100 Subject: Rearranged the SSE detection. Patch by lordlyhobo. Fixes issue 5172. --- Source/Core/Common/Src/Common.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/Common.h b/Source/Core/Common/Src/Common.h index f08a4d1bfe..db889f7ddf 100644 --- a/Source/Core/Common/Src/Common.h +++ b/Source/Core/Common/Src/Common.h @@ -139,14 +139,18 @@ private: // wxWidgets does not have a true dummy macro for this. #define _trans(a) a -#if defined __APPLE__ && defined __i386__ -#define _M_SSE 0x300 -#elif defined __APPLE__ && defined __x86_64__ -#define _M_SSE 0x301 -#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) -#define _M_SSE 0x301 +#if defined __GNUC__ +# if defined __SSE4_2__ +# define _M_SSE 0x402 +# elif defined __SSE4_1__ +# define _M_SSE 0x401 +# elif defined __SSSE3__ +# define _M_SSE 0x301 +# elif defined __SSE3__ +# define _M_SSE 0x300 +# endif #elif (_MSC_VER >= 1500) || __INTEL_COMPILER // Visual Studio 2008 -#define _M_SSE 0x402 +# define _M_SSE 0x402 #endif // Host communication. -- cgit v1.2.3 From e58692653afda21f7593d340025c9d4328689244 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Fri, 17 Feb 2012 17:09:17 +0100 Subject: PixelShaderGen: Use correct texel to pixel mapping when sampling textures (D3D9 only) Fixes issue 2068. Fixes issue 5158. --- Source/Core/Common/Src/LinearDiskCache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/LinearDiskCache.h b/Source/Core/Common/Src/LinearDiskCache.h index ac10b5ef20..edc851c9ac 100644 --- a/Source/Core/Common/Src/LinearDiskCache.h +++ b/Source/Core/Common/Src/LinearDiskCache.h @@ -24,7 +24,7 @@ // Increment this every time you change shader generation code. enum { - LINEAR_DISKCACHE_VER = 6969 + LINEAR_DISKCACHE_VER = 6970 }; // On disk format: -- cgit v1.2.3 From 9adc119e3c2f845c0172b012badbbc86addad4a5 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Mon, 20 Feb 2012 17:55:18 +0100 Subject: PixelShaderGen: For custom textures and scaled EFB copies, use correct texel to pixel mapping when sampling textures (D3D9 only) This is basically the same as revision e58692653afd, just for scaled textures and with a LOT more work... --- Source/Core/Common/Src/LinearDiskCache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/LinearDiskCache.h b/Source/Core/Common/Src/LinearDiskCache.h index edc851c9ac..e4cb0cbd17 100644 --- a/Source/Core/Common/Src/LinearDiskCache.h +++ b/Source/Core/Common/Src/LinearDiskCache.h @@ -24,7 +24,7 @@ // Increment this every time you change shader generation code. enum { - LINEAR_DISKCACHE_VER = 6970 + LINEAR_DISKCACHE_VER = 6971 }; // On disk format: -- cgit v1.2.3 From 3a9fed0ba285b3c2bb80de408ac1a9da9ca774b6 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Tue, 21 Feb 2012 12:51:41 +0100 Subject: PixelShaderGen: Fix a bug introduced in revision 9adc119e3c2f. D3D11: Fix shader constant mapping. --- Source/Core/Common/Src/LinearDiskCache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/LinearDiskCache.h b/Source/Core/Common/Src/LinearDiskCache.h index e4cb0cbd17..f6e0d95f8c 100644 --- a/Source/Core/Common/Src/LinearDiskCache.h +++ b/Source/Core/Common/Src/LinearDiskCache.h @@ -24,7 +24,7 @@ // Increment this every time you change shader generation code. enum { - LINEAR_DISKCACHE_VER = 6971 + LINEAR_DISKCACHE_VER = 6972 }; // On disk format: -- cgit v1.2.3 From f15aeb26b37d88c451887709ead523e5aeb49390 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Fri, 24 Feb 2012 19:20:17 -0600 Subject: Use an auto typed variable in IniFile.cpp --- Source/Core/Common/Src/IniFile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/IniFile.cpp b/Source/Core/Common/Src/IniFile.cpp index c81c060f1d..f51e8850d3 100644 --- a/Source/Core/Common/Src/IniFile.cpp +++ b/Source/Core/Common/Src/IniFile.cpp @@ -459,7 +459,7 @@ bool IniFile::Save(const char* filename) return false; } - for (std::vector
::const_iterator iter = sections.begin(); iter != sections.end(); ++iter) + for (auto iter = sections.begin(); iter != sections.end(); ++iter) { const Section& section = *iter; -- cgit v1.2.3 From 8a8dc77ef19446f97d210f0602aaa218144adf0e Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Fri, 24 Feb 2012 14:19:24 -0600 Subject: enable c++11 compilation in cmakelists --- Source/Core/Common/Src/StdThread.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/StdThread.h b/Source/Core/Common/Src/StdThread.h index 6e9e903561..b64dbf2c4e 100644 --- a/Source/Core/Common/Src/StdThread.h +++ b/Source/Core/Common/Src/StdThread.h @@ -7,7 +7,9 @@ #if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ // GCC 4.4 provides +#ifndef _GLIBCXX_USE_SCHED_YIELD #define _GLIBCXX_USE_SCHED_YIELD +#endif #include #else -- cgit v1.2.3 From b8bef29bcc5a8cd18625efb7e6ce37f0f263c393 Mon Sep 17 00:00:00 2001 From: skidau Date: Sat, 25 Feb 2012 20:36:49 +1100 Subject: Fixed a divide by zero error in the hash functions --- Source/Core/Common/Src/Hash.cpp | 48 +++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/Hash.cpp b/Source/Core/Common/Src/Hash.cpp index 62ea25519e..46747ce157 100644 --- a/Source/Core/Common/Src/Hash.cpp +++ b/Source/Core/Common/Src/Hash.cpp @@ -167,7 +167,13 @@ u64 GetMurmurHash3(const u8 *src, int len, u32 samples) const u8 * data = (const u8*)src; const int nblocks = len / 16; u32 Step = (len / 8); - if(samples == 0) samples = Step; + if(samples == 0) + { + if (Step == 0) + samples = 1; + else + samples = Step; + } Step = Step / samples; if(Step < 1) Step = 1; @@ -245,7 +251,13 @@ u64 GetCRC32(const u8 *src, int len, u32 samples) u32 Step = (len / 8); const u64 *data = (const u64 *)src; const u64 *end = data + Step; - if(samples == 0) samples = Step; + if(samples == 0) + { + if (Step == 0) + samples = 1; + else + samples = Step; + } Step = Step / samples; if(Step < 1) Step = 1; while(data < end) @@ -275,7 +287,13 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples) u32 Step = (len / 8); const u64 *data = (const u64 *)src; const u64 *end = data + Step; - if(samples == 0) samples = Step; + if(samples == 0) + { + if (Step == 0) + samples = 1; + else + samples = Step; + } Step = Step / samples; if(Step < 1) Step = 1; while(data < end) @@ -318,7 +336,13 @@ u64 GetCRC32(const u8 *src, int len, u32 samples) u32 Step = (len/4); const u32 *data = (const u32 *)src; const u32 *end = data + Step; - if(samples == 0) samples = Step; + if(samples == 0) + { + if (Step == 0) + samples = 1; + else + samples = Step; + } Step = Step / samples; if(Step < 1) Step = 1; while(data < end) @@ -390,7 +414,13 @@ u64 GetMurmurHash3(const u8* src, int len, u32 samples) u32 out[2]; const int nblocks = len / 8; u32 Step = (len / 4); - if(samples == 0) samples = Step; + if(samples == 0) + { + if (Step == 0) + samples = 1; + else + samples = Step; + } Step = Step / samples; if(Step < 1) Step = 1; @@ -464,7 +494,13 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples) u32 Step = (len / 8); const u64 *data = (const u64 *)src; const u64 *end = data + Step; - if(samples == 0) samples = Step; + if(samples == 0) + { + if (Step == 0) + samples = 1; + else + samples = Step; + } Step = Step / samples; if(Step < 1) Step = 1; while(data < end) -- cgit v1.2.3 From c3293b1a1cea3cdd9858b00c2a34d783347e72c3 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Sat, 25 Feb 2012 10:49:04 +0100 Subject: Improvement to revision b8bef29bcc5a .. :P --- Source/Core/Common/Src/Hash.cpp | 48 ++++++----------------------------------- 1 file changed, 6 insertions(+), 42 deletions(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/Hash.cpp b/Source/Core/Common/Src/Hash.cpp index 46747ce157..8e8d6f85bd 100644 --- a/Source/Core/Common/Src/Hash.cpp +++ b/Source/Core/Common/Src/Hash.cpp @@ -167,13 +167,7 @@ u64 GetMurmurHash3(const u8 *src, int len, u32 samples) const u8 * data = (const u8*)src; const int nblocks = len / 16; u32 Step = (len / 8); - if(samples == 0) - { - if (Step == 0) - samples = 1; - else - samples = Step; - } + if(samples == 0) samples = max(Step, 1u); Step = Step / samples; if(Step < 1) Step = 1; @@ -251,13 +245,7 @@ u64 GetCRC32(const u8 *src, int len, u32 samples) u32 Step = (len / 8); const u64 *data = (const u64 *)src; const u64 *end = data + Step; - if(samples == 0) - { - if (Step == 0) - samples = 1; - else - samples = Step; - } + if(samples == 0) samples = max(Step, 1u); Step = Step / samples; if(Step < 1) Step = 1; while(data < end) @@ -287,13 +275,7 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples) u32 Step = (len / 8); const u64 *data = (const u64 *)src; const u64 *end = data + Step; - if(samples == 0) - { - if (Step == 0) - samples = 1; - else - samples = Step; - } + if(samples == 0) samples = max(Step, 1u); Step = Step / samples; if(Step < 1) Step = 1; while(data < end) @@ -336,13 +318,7 @@ u64 GetCRC32(const u8 *src, int len, u32 samples) u32 Step = (len/4); const u32 *data = (const u32 *)src; const u32 *end = data + Step; - if(samples == 0) - { - if (Step == 0) - samples = 1; - else - samples = Step; - } + if(samples == 0) samples = max(Step, 1u); Step = Step / samples; if(Step < 1) Step = 1; while(data < end) @@ -414,13 +390,7 @@ u64 GetMurmurHash3(const u8* src, int len, u32 samples) u32 out[2]; const int nblocks = len / 8; u32 Step = (len / 4); - if(samples == 0) - { - if (Step == 0) - samples = 1; - else - samples = Step; - } + if(samples == 0) samples = max(Step, 1u); Step = Step / samples; if(Step < 1) Step = 1; @@ -494,13 +464,7 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples) u32 Step = (len / 8); const u64 *data = (const u64 *)src; const u64 *end = data + Step; - if(samples == 0) - { - if (Step == 0) - samples = 1; - else - samples = Step; - } + if(samples == 0) samples = max(Step, 1u); Step = Step / samples; if(Step < 1) Step = 1; while(data < end) -- cgit v1.2.3 From 38823b63716b46ec00337f20127de43661deac8b Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Tue, 28 Feb 2012 00:27:16 -0600 Subject: Add comment here so people know what's up. --- Source/Core/Common/Src/IniFile.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/IniFile.cpp b/Source/Core/Common/Src/IniFile.cpp index f51e8850d3..acad498106 100644 --- a/Source/Core/Common/Src/IniFile.cpp +++ b/Source/Core/Common/Src/IniFile.cpp @@ -459,6 +459,10 @@ bool IniFile::Save(const char* filename) return false; } + // Currently testing if dolphin community can handle the requirements of C++11 compilation + // If you get a compiler error on this line, your compiler is probably old. + // Update to g++ 4.4 or a recent version of clang (XCode 4.2 on OS X). + // If you don't want to update, complain in a google code issue, the dolphin forums or #dolphin-emu. for (auto iter = sections.begin(); iter != sections.end(); ++iter) { const Section& section = *iter; -- cgit v1.2.3 From f5d4fe0bfe13937fa3736aa6b78974ceb6e190ad Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sat, 3 Mar 2012 20:07:20 +0100 Subject: Fix some minor bugs pointed out by PVS Studio (thanks!) --- Source/Core/Common/Src/SysConf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/SysConf.cpp b/Source/Core/Common/Src/SysConf.cpp index ed8a4953e5..97170e5ff1 100644 --- a/Source/Core/Common/Src/SysConf.cpp +++ b/Source/Core/Common/Src/SysConf.cpp @@ -387,7 +387,7 @@ bool SysConf::SaveToFile(const char *filename) } else if (i->type == Type_SmallArray) { - const u8 len = i->dataLength; + const u8 len = (u8)(i->dataLength); f.WriteArray(&len, 1); } -- cgit v1.2.3 From b0f75f17ae19484735675fea348f7e95740f597f Mon Sep 17 00:00:00 2001 From: marcosvitali Date: Mon, 5 Mar 2012 02:40:10 -0300 Subject: This release still fixed the hangs produced by fifo overflow without sacrifice performance. For example you can test Tutorial moves at the beginning of The last history now is fluid 30/60. Shuffle2: I've delete the hacky line, I think is not necessary anymore. Additional some clean in CommandProcessor. Please test The Last Story and others games affected in the previous commits and give me a feedback. --- Source/Core/Common/Src/VideoBackendBase.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/VideoBackendBase.h b/Source/Core/Common/Src/VideoBackendBase.h index 28c8f23246..96f639832b 100644 --- a/Source/Core/Common/Src/VideoBackendBase.h +++ b/Source/Core/Common/Src/VideoBackendBase.h @@ -119,6 +119,7 @@ public: virtual void Video_GatherPipeBursted() = 0; virtual bool Video_IsPossibleWaitingSetDrawDone() = 0; + virtual bool Video_IsHiWatermarkActive() = 0; virtual void Video_AbortFrame() = 0; virtual readFn16 Video_CPRead16() = 0; @@ -159,6 +160,7 @@ class VideoBackendHardware : public VideoBackend void Video_GatherPipeBursted(); bool Video_IsPossibleWaitingSetDrawDone(); + bool Video_IsHiWatermarkActive(); void Video_AbortFrame(); readFn16 Video_CPRead16(); -- cgit v1.2.3 From 8ed6ea3b076a3d1aec2a170d0c71dc1a12122371 Mon Sep 17 00:00:00 2001 From: skidau Date: Thu, 15 Mar 2012 21:48:19 +1100 Subject: Sped up the Dolphin debugger in JIT mode by splitting a block only while stepping or when it contains a breakpoint. The block is invalidated when a breakpoint is set or cleared. Fixed a bug in the JitCache where the JIT icache was not being invalidated when a block containing the instruction was destroyed. --- Source/Core/Common/Src/BreakPoints.cpp | 23 +++++++++++++++++++++-- Source/Core/Common/Src/BreakPoints.h | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/BreakPoints.cpp b/Source/Core/Common/Src/BreakPoints.cpp index 45a0b52daf..9164312f82 100644 --- a/Source/Core/Common/Src/BreakPoints.cpp +++ b/Source/Core/Common/Src/BreakPoints.cpp @@ -19,6 +19,7 @@ #include "DebugInterface.h" #include "BreakPoints.h" #include +#include "..\..\Core\Src\PowerPC\JitCommon\JitBase.h" bool BreakPoints::IsAddressBreakPoint(u32 _iAddress) { @@ -70,7 +71,11 @@ void BreakPoints::AddFromStrings(const TBreakPointsStr& bps) void BreakPoints::Add(const TBreakPoint& bp) { if (!IsAddressBreakPoint(bp.iAddress)) + { m_BreakPoints.push_back(bp); + if (jit) + jit->GetBlockCache()->InvalidateICache(bp.iAddress, 4); + } } void BreakPoints::Add(u32 em_address, bool temp) @@ -83,21 +88,35 @@ void BreakPoints::Add(u32 em_address, bool temp) pt.iAddress = em_address; m_BreakPoints.push_back(pt); + + if (jit) + jit->GetBlockCache()->InvalidateICache(em_address, 4); } } -void BreakPoints::Remove(u32 _iAddress) +void BreakPoints::Remove(u32 em_address) { for (TBreakPoints::iterator i = m_BreakPoints.begin(); i != m_BreakPoints.end(); ++i) { - if (i->iAddress == _iAddress) + if (i->iAddress == em_address) { m_BreakPoints.erase(i); + if (jit) + jit->GetBlockCache()->InvalidateICache(em_address, 4); return; } } } +void BreakPoints::Clear() +{ + for (TBreakPoints::iterator i = m_BreakPoints.begin(); i != m_BreakPoints.end(); ++i) + { + if (jit) + jit->GetBlockCache()->InvalidateICache(i->iAddress, 4); + m_BreakPoints.erase(i); + } +} MemChecks::TMemChecksStr MemChecks::GetStrings() const { diff --git a/Source/Core/Common/Src/BreakPoints.h b/Source/Core/Common/Src/BreakPoints.h index a97452cde6..c742f812a7 100644 --- a/Source/Core/Common/Src/BreakPoints.h +++ b/Source/Core/Common/Src/BreakPoints.h @@ -78,7 +78,7 @@ public: // Remove Breakpoint void Remove(u32 _iAddress); - void Clear() { m_BreakPoints.clear(); }; + void Clear(); void DeleteByAddress(u32 _Address); -- cgit v1.2.3 From cfbcaa2cc6d2c990b907747298ad012aa1c6c2fd Mon Sep 17 00:00:00 2001 From: skidau Date: Sun, 18 Mar 2012 23:37:38 +1100 Subject: Linux build fix --- Source/Core/Common/Src/BreakPoints.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/Common') diff --git a/Source/Core/Common/Src/BreakPoints.cpp b/Source/Core/Common/Src/BreakPoints.cpp index 9164312f82..1700276d85 100644 --- a/Source/Core/Common/Src/BreakPoints.cpp +++ b/Source/Core/Common/Src/BreakPoints.cpp @@ -18,8 +18,8 @@ #include "Common.h" #include "DebugInterface.h" #include "BreakPoints.h" +#include "../../Core/Src/PowerPC/JitCommon/JitBase.h" #include -#include "..\..\Core\Src\PowerPC\JitCommon\JitBase.h" bool BreakPoints::IsAddressBreakPoint(u32 _iAddress) { -- cgit v1.2.3