diff --git a/pcsx2/DebugTools/Makefile.am b/pcsx2/DebugTools/Makefile.am index d5dea9cd57..84b2acf084 100644 --- a/pcsx2/DebugTools/Makefile.am +++ b/pcsx2/DebugTools/Makefile.am @@ -1,4 +1,4 @@ -INCLUDES = -I@srcdir@/../ -I@srcdir@/../../common/ +INCLUDES = -I@srcdir@/../ -I@srcdir@/../common/ noinst_LIBRARIES = libDebugTools.a libDebugTools_a_SOURCES = \ diff --git a/pcsx2/IPU/Makefile.am b/pcsx2/IPU/Makefile.am index dbbf54470e..87ee9d061f 100644 --- a/pcsx2/IPU/Makefile.am +++ b/pcsx2/IPU/Makefile.am @@ -1,4 +1,4 @@ -INCLUDES = -I@srcdir@/../ -I@srcdir@/../x86 -I@srcdir@/../../common/ +INCLUDES = -I@srcdir@/../ -I@srcdir@/../x86 -I@srcdir@/../common/ noinst_LIBRARIES = libIPU.a libIPU_a_SOURCES = IPU.cpp yuv2rgb.cpp coroutine.cpp \ diff --git a/pcsx2/IPU/mpeg2lib/Makefile.am b/pcsx2/IPU/mpeg2lib/Makefile.am index 341be48142..dbde829629 100644 --- a/pcsx2/IPU/mpeg2lib/Makefile.am +++ b/pcsx2/IPU/mpeg2lib/Makefile.am @@ -1,4 +1,4 @@ -INCLUDES = -I@srcdir@/../ -I@srcdir@/../../ -I@srcdir@/../../../common/ +INCLUDES = -I@srcdir@/../ -I@srcdir@/../../ -I@srcdir@/../../common/ noinst_LIBRARIES = libmpeg2IPU.a libmpeg2IPU_a_SOURCES = Idct.cpp Mpeg.cpp Mpeg.h Vlc.h \ No newline at end of file diff --git a/pcsx2/Linux/LnxConsole.cpp b/pcsx2/Linux/LnxConsole.cpp index de1ab84fbb..d221b061a4 100644 --- a/pcsx2/Linux/LnxConsole.cpp +++ b/pcsx2/Linux/LnxConsole.cpp @@ -20,9 +20,12 @@ #define COLOR_RESET "\033[0m" - // Linux Note : The Linux Console is pretty simple. It just dumps to the stdio! // (no console open/close/title stuff tho, so those functions are dummies) + +// Fixme - A lot of extra \ns are being added in here somewhere. I think it's +// partially in SetColor/ClearColor, as colored lines have more extra \ns then the other +// lines. namespace Console { static const char* tbl_color_codes[] = diff --git a/pcsx2/Linux/Makefile.am b/pcsx2/Linux/Makefile.am index d32363c6d7..f10e553ff9 100644 --- a/pcsx2/Linux/Makefile.am +++ b/pcsx2/Linux/Makefile.am @@ -1,5 +1,5 @@ AUTOMAKE_OPTIONS = foreign -INCLUDES = $(shell pkg-config --cflags gtk+-2.0) -I@srcdir@/../ -I@srcdir@/../../common/ +INCLUDES = $(shell pkg-config --cflags gtk+-2.0) -I@srcdir@/../ -I@srcdir@/../common/ bin_PROGRAMS = pcsx2 diff --git a/pcsx2/Linux/memzero.h b/pcsx2/Linux/memzero.h index f3f66557ca..c46759dbd9 100644 --- a/pcsx2/Linux/memzero.h +++ b/pcsx2/Linux/memzero.h @@ -67,4 +67,116 @@ static __forceinline void memset16_obj( T& obj ) memset32_obj( obj ); } + +// An optimized memset for 8 bit destination data. +template< u8 data, size_t bytes > +static __forceinline void memset_8( void *dest ) +{ + if( bytes == 0 ) return; + + if( (bytes & 0x3) != 0 ) + { + // unaligned data length. No point in doing an optimized inline version (too complicated!) + // So fall back on the compiler implementation: + + memset( dest, data, bytes ); + return; + } + + // This function only works on 32-bit alignments of data copied. + jASSUME( (bytes & 0x3) == 0 ); + + enum + { + remdat = bytes>>2, + data32 = data + (data<<8) + (data<<16) + (data<<24) + }; + + // 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__ + ( + ".intel_syntax\n" + "cld\n" +// "mov %edi, %0\n" +// "mov %eax, %1\n" + "stosd\n" + "stosd\n" + "stosd\n" + ".att_syntax\n" + : + : "D"(dest), "a"(data32) +// D - edi, a -- eax, c ecx + : + ); + return; + + case 4: + __asm__ + ( + ".intel_syntax\n" + "cld\n" +// "mov %edi, %0\n" +// "mov %eax, %1\n" + "stosd\n" + "stosd\n" + "stosd\n" + "stosd\n" + ".att_syntax\n" + : + : "D"(dest), "a"(data32) + : + + ); + return; + + case 5: + __asm__ + ( + ".intel_syntax\n" + "cld\n" +// "mov %edi, %0\n" +// "mov %eax, %1\n" + "stosd\n" + "stosd\n" + "stosd\n" + "stosd\n" + "stosd\n" + ".att_syntax\n" + : + : "D"(dest), "a"(data32) + : + + ); + return; + + default: + __asm__ + ( + ".intel_syntax\n" + "cld\n" +// "mov ecx, %0\n" +// "mov edi, %1\n" +// "mov eax, %2\n" + "rep stosd\n" + ".att_syntax\n" + : + : "c"(remdat), "D"(dest), "a"(data32) + : + ); + return; + } +} + #endif diff --git a/pcsx2/Memory.cpp b/pcsx2/Memory.cpp index 433ce19b86..5e27e6fe2d 100644 --- a/pcsx2/Memory.cpp +++ b/pcsx2/Memory.cpp @@ -859,7 +859,7 @@ int SysPageFaultExceptionFilter(EXCEPTION_POINTERS* eps) #else #include "errno.h" -__forceinline void __fastcall InstallLinuxExceptionHandler() +void InstallLinuxExceptionHandler() { struct sigaction sa; @@ -869,13 +869,13 @@ __forceinline void __fastcall InstallLinuxExceptionHandler() sigaction(SIGSEGV, &sa, NULL); } -__forceinline void __fastcall ReleaseLinuxExceptionHandler() +void ReleaseLinuxExceptionHandler() { // Code this later. } // Linux implementation of SIGSEGV handler. Bind it using sigaction(). // This is my shot in the dark. Probably needs some work. Good luck! (air) -__forceinline void __fastcall SysPageFaultExceptionFilter( int signal, siginfo_t *info, void * ) +void SysPageFaultExceptionFilter( int signal, siginfo_t *info, void * ) { int err; u32 pagesize = getpagesize(); @@ -884,6 +884,8 @@ __forceinline void __fastcall SysPageFaultExceptionFilter( int signal, siginfo_t // get bad virtual address u32 offset = (u8*)info->si_addr - psM; uptr pageoffset = ( offset / pagesize ) * pagesize; + + DevCon::Status( "Protected memory cleanup. Offset 0x%x", params offset ); if (offset>=Ps2MemSize::Base) { diff --git a/pcsx2/RDebug/Makefile.am b/pcsx2/RDebug/Makefile.am index 4fa1c8fd91..57ab1d35e4 100644 --- a/pcsx2/RDebug/Makefile.am +++ b/pcsx2/RDebug/Makefile.am @@ -1,4 +1,4 @@ -INCLUDES = -I@srcdir@/../ -I@srcdir@/../../common/ +INCLUDES = -I@srcdir@/../ -I@srcdir@/../common/ noinst_LIBRARIES = libRDebug.a libRDebug_a_SOURCES = \ diff --git a/pcsx2/SourceLog.cpp b/pcsx2/SourceLog.cpp index 949e9ed92a..7beb7f176f 100644 --- a/pcsx2/SourceLog.cpp +++ b/pcsx2/SourceLog.cpp @@ -34,9 +34,9 @@ using namespace R5900; FILE *emuLog; +u32 varLog; #ifdef PCSX2_DEVBUILD -u32 varLog; // these used by the depreciated _old_Log only u16 logProtocol; diff --git a/pcsx2/x86/Makefile.am b/pcsx2/x86/Makefile.am index 63e6516f83..34e34cb5c9 100644 --- a/pcsx2/x86/Makefile.am +++ b/pcsx2/x86/Makefile.am @@ -1,4 +1,4 @@ -INCLUDES = -I@srcdir@/../ -I@srcdir@/../../common/ -I@srcdir@/../IPU/ +INCLUDES = -I@srcdir@/../ -I@srcdir@/../common/ -I@srcdir@/../IPU/ noinst_LIBRARIES = libx86recomp.a # have to add the sources instead of making a library since the linking is complicated diff --git a/pcsx2/x86/ix86-32/iR5900-32.cpp b/pcsx2/x86/ix86-32/iR5900-32.cpp index 7e4ba37c9c..055feed4c7 100644 --- a/pcsx2/x86/ix86-32/iR5900-32.cpp +++ b/pcsx2/x86/ix86-32/iR5900-32.cpp @@ -113,10 +113,10 @@ static u32 dumplog = 0; #ifdef PCSX2_DEVBUILD // and not sure what these might have once been used for... (air) -static const char *txt0 = "EAX = %x : ECX = %x : EDX = %x\n"; -static const char *txt0RC = "EAX = %x : EBX = %x : ECX = %x : EDX = %x : ESI = %x : EDI = %x\n"; -static const char *txt1 = "REG[%d] = %x_%x\n"; -static const char *txt2 = "M32 = %x\n"; +//static const char *txt0 = "EAX = %x : ECX = %x : EDX = %x\n"; +//static const char *txt0RC = "EAX = %x : EBX = %x : ECX = %x : EDX = %x : ESI = %x : EDI = %x\n"; +//static const char *txt1 = "REG[%d] = %x_%x\n"; +//static const char *txt2 = "M32 = %x\n"; #endif static void iBranchTest(u32 newpc, bool noDispatch=false); diff --git a/pcsx2/x86/ix86/Makefile.am b/pcsx2/x86/ix86/Makefile.am index e702a45a14..d6564bff29 100644 --- a/pcsx2/x86/ix86/Makefile.am +++ b/pcsx2/x86/ix86/Makefile.am @@ -1,4 +1,4 @@ -INCLUDES = -I@srcdir@/.. -I@srcdir@/../../ -I@srcdir@/../../../common/ +INCLUDES = -I@srcdir@/.. -I@srcdir@/../../ -I@srcdir@/../../common/ noinst_LIBRARIES = libix86.a libix86_a_SOURCES = ix86_tools.cpp ix86_3dnow.cpp ix86.cpp ix86_cpudetect.cpp ix86_fpu.cpp ix86.h ix86_sse.cpp ix86_mmx.cpp diff --git a/pcsx2/x86/ix86/ix86_sse.cpp b/pcsx2/x86/ix86/ix86_sse.cpp index acbf42b3af..9a0e9c012f 100644 --- a/pcsx2/x86/ix86/ix86_sse.cpp +++ b/pcsx2/x86/ix86/ix86_sse.cpp @@ -1082,12 +1082,10 @@ __forceinline void SSE4_DPPS_XMM_to_XMM(x86SSERegType to, x86SSERegType from, u8 __forceinline void SSE4_DPPS_M128_to_XMM(x86SSERegType to, uptr from, u8 imm8) { - const int overb = 0; // TODO: x64? - write8(0x66); write24(0x403A0F); ModRM(0, to, DISP32); - write32(MEMADDR(from, 4 + overb)); + write32(MEMADDR(from, 4)); write8(imm8); } @@ -1128,13 +1126,11 @@ __forceinline void SSE4_BLENDVPS_XMM_to_XMM(x86SSERegType to, x86SSERegType from __forceinline void SSE4_BLENDVPS_M128_to_XMM(x86SSERegType to, uptr from) { - const int overb = 0; // TODO: x64? - write8(0x66); RexR(0, to); write24(0x14380F); ModRM(0, to, DISP32); - write32(MEMADDR(from, 4 + overb)); + write32(MEMADDR(from, 4)); } __forceinline void SSE4_PMOVSXDQ_XMM_to_XMM(x86SSERegType to, x86SSERegType from)