diff --git a/build.sh b/build.sh index 966770bf59..ce29ad96bf 100644 --- a/build.sh +++ b/build.sh @@ -11,13 +11,15 @@ #Optimized, but a devbuild export PCSX2OPTIONS="--enable-sse3 --enable-sse4 --enable-devbuild --prefix `pwd`" - -#Optimized, but a devbuild - with memcpy_fast_ enabled. -#export PCSX2OPTIONS="--enable-sse3 --enable-sse4 --enable-devbuild --enable-memcpyfast --prefix `pwd`" - #Debug / Devbuild version #export PCSX2OPTIONS="--enable-debug --enable-devbuild --enable-sse3 --prefix `pwd`" +#Optimized, but a devbuild - with memcpy_fast_ enabled. - BROKEN! +#export PCSX2OPTIONS="--enable-sse3 --enable-sse4 --enable-devbuild --enable-memcpyfast --prefix `pwd`" + +#Optimized, but a devbuild - with microVU enabled. - NOT FULLY IMPLEMENTED!! +#export PCSX2OPTIONS="--enable-sse3 --enable-sse4 --enable-devbuild --enable-microVU --prefix `pwd`" + #ZeroGS Normal mode export ZEROGSOPTIONS="--enable-sse2" diff --git a/pcsx2/configure.ac b/pcsx2/configure.ac index acd3813e59..a3432f9842 100644 --- a/pcsx2/configure.ac +++ b/pcsx2/configure.ac @@ -72,6 +72,15 @@ then fi AC_MSG_RESULT($memcpyfast) +AC_MSG_CHECKING(turn on microVU) +AC_ARG_ENABLE(microVU, AC_HELP_STRING([--enable-microVU], [Turns on the currently incomplete microVU files - Not a good idea]), + microVU=$enableval,microVU=no) +if test "x$microVU" == xyes +then + AC_DEFINE(PCSX2_MICROVU,1,[PCSX2_MICROVU]) +fi +AC_MSG_RESULT($microVU) + dnl Check for dev build AC_MSG_CHECKING(for development build) AC_ARG_ENABLE(devbuild, AC_HELP_STRING([--enable-devbuild], [Special Build for developers that simplifies testing and adds extra checks]), @@ -148,3 +157,4 @@ echo " nls support? $nls" echo " local plugin inis? $localinis" echo " custom cflags? $customcflags" echo " memcpy_fast? $memcpyfast" +echo " microVU? $microVU" diff --git a/pcsx2/x86/Makefile.am b/pcsx2/x86/Makefile.am index e1f426a2e5..b2142705c2 100644 --- a/pcsx2/x86/Makefile.am +++ b/pcsx2/x86/Makefile.am @@ -18,6 +18,12 @@ libx86recomp_a_SOURCES += \ BaseblockEx.h iCOP0.h iCore.h iFPU.h iMMI.h iR3000A.h iR5900.h iR5900Arit.h iR5900AritImm.h iR5900Branch.h iR5900Jump.h \ iR5900LoadStore.h iR5900Move.h iR5900MultDiv.h iR5900Shift.h iVUmicro.h iVUops.h iVUzerorec.h +#ifdef PCSX2_MICROVU +libx86recomp_a_SOURCES += \ +microVU.cpp microVU_Alloc.cpp microVU_Compile.cpp microVU_Lower.cpp microVU_Misc.cpp microVU_Upper.cpp aMicroVU.S \ +microVU.h microVU_Alloc.h microVU_Misc.h microVU_Tables.h +#endif + libx86recomp_a_DEPENDENCIES = ix86/libix86.a SUBDIRS = ix86 \ No newline at end of file diff --git a/pcsx2/x86/aMicroVU.S b/pcsx2/x86/aMicroVU.S new file mode 100644 index 0000000000..5eddac9c16 --- /dev/null +++ b/pcsx2/x86/aMicroVU.S @@ -0,0 +1,62 @@ +// microVU.cpp assembly routines +// arcum42(@gmail.com) +.intel_syntax + +.extern mVUexecuteVU0 +.extern mVUexecuteVU1 +.extern g_sseVUMXCSR +.extern g_sseMXCSR + +//------------------------------------------------------------------ +// Dispatcher Functions +//------------------------------------------------------------------ + +// Runs VU0 for number of cycles +// __fastcall = The first two DWORD or smaller arguments are passed in ECX and EDX registers; all other arguments are passed right to left. +//void __fastcall startVU0(u32 startPC, u32 cycles) +.globl startVU0 +startVU0: + call mVUexecuteVU0 + + // backup cpu state + push %ebx + push %ebp + push %esi + push %edi + + ldmxcsr g_sseVUMXCSR + // Should set xmmZ? + jmp %eax + +// Runs VU1 for number of cycles +// void __fastcall startVU1(u32 startPC, u32 cycles) +.globl startVU1 +startVU01: + call mVUexecuteVU1 + + // backup cpu state + push %ebx + push %ebp + push %esi + push %edi + + ldmxcsr g_sseVUMXCSR + + jmp %eax + +// Exit point +// void __fastcall endVU0(u32 startPC, u32 cycles) +.globl endVU0 +endVU0: + //call mVUcleanUpVU0 + + /*restore cpu state*/ + pop %edi; + pop %esi; + pop %ebp; + pop %ebx; + + ldmxcsr g_sseMXCSR + + ret + \ No newline at end of file diff --git a/pcsx2/x86/aVUzerorec.S b/pcsx2/x86/aVUzerorec.S index 5ab8f8b8dc..2ad8974bd1 100644 --- a/pcsx2/x86/aVUzerorec.S +++ b/pcsx2/x86/aVUzerorec.S @@ -1,4 +1,4 @@ -// iR3000A.c assembly routines +// iVUzerorec.cpp assembly routines // zerofrog(@gmail.com) .intel_syntax diff --git a/pcsx2/x86/microVU.cpp b/pcsx2/x86/microVU.cpp index c4fdcd3268..245347f48c 100644 --- a/pcsx2/x86/microVU.cpp +++ b/pcsx2/x86/microVU.cpp @@ -208,6 +208,7 @@ __forceinline void mVUinvalidateBlock(microVU* mVU, u32 addr, u32 size) { // Dispatcher Functions //------------------------------------------------------------------ +#ifdef _MSC_VER // Runs VU0 for number of cycles __declspec(naked) void __fastcall startVU0(u32 startPC, u32 cycles) { __asm { @@ -261,6 +262,14 @@ __declspec(naked) void __fastcall endVU0(u32 startPC, u32 cycles) { ret } } +#else +extern "C" +{ +extern void __fastcall startVU0(u32 startPC, u32 cycles); +extern void __fastcall startVU1(u32 startPC, u32 cycles); +extern void __fastcall endVU0(u32 startPC, u32 cycles); +} +#endif //------------------------------------------------------------------ // Wrapper Functions - Called by other parts of the Emu //------------------------------------------------------------------ diff --git a/pcsx2/x86/microVU.h b/pcsx2/x86/microVU.h index e70a6d0048..1659ddf357 100644 --- a/pcsx2/x86/microVU.h +++ b/pcsx2/x86/microVU.h @@ -131,3 +131,8 @@ __forceinline void mVUclearProg(microVU* mVU, int progIndex); __forceinline int mVUfindLeastUsedProg(microVU* mVU); __forceinline int mVUsearchProg(microVU* mVU); __forceinline void mVUcacheProg(microVU* mVU, int progIndex); + +#ifdef __LINUX__ +microVUt(void) mVUreset(); +microVUt(void) mVUclose(); +#endif \ No newline at end of file diff --git a/pcsx2/x86/microVU_Alloc.cpp b/pcsx2/x86/microVU_Alloc.cpp index 1d256e1bb2..4bcbe7bf74 100644 --- a/pcsx2/x86/microVU_Alloc.cpp +++ b/pcsx2/x86/microVU_Alloc.cpp @@ -44,9 +44,9 @@ microVUt(void) mVUallocFMAC1a(u32 code, int& Fd, int& Fs, int& Ft, const int mak microVU* mVU = mVUx; if (_Fs_ == 0) { Fs = xmmZ; } else { Fs = xmmFs; } if (_Ft_ == 0) { Ft = xmmZ; } else { Ft = xmmFt; } - if (makeFdFd) {Fd = xmmFd} - else if (makeFdFs) {Fd = Fs} - else if (makeFdFt) {Fd = Ft} + if (makeFdFd) {Fd = xmmFd;} + else if (makeFdFs) {Fd = Fs;} + else if (makeFdFt) {Fd = Ft;} if (_Fs_) SSE_MOVAPS_M128_to_XMM(Fs, (uptr)&mVU->regs->VF[_Fs_].UL[0]); if (_Ft_ == _Ft_) SSE_MOVAPS_M128_to_XMM(Ft, (uptr)&mVU->regs->VF[_Ft_].UL[0]); diff --git a/pcsx2/x86/microVU_Misc.h b/pcsx2/x86/microVU_Misc.h index 111c654a48..1c80dc03b0 100644 --- a/pcsx2/x86/microVU_Misc.h +++ b/pcsx2/x86/microVU_Misc.h @@ -18,6 +18,10 @@ #pragma once +#ifdef __LINUX__ +#include "ix86/ix86.h" +#endif + //------------------------------------------------------------------ // Helper Macros //------------------------------------------------------------------