Minor cleanups to my mVU commit.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1377 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-06-17 14:34:01 +00:00
parent caa7a5dffd
commit 3ddcf45325
5 changed files with 30 additions and 30 deletions

View File

@ -40,8 +40,8 @@ microVUf(void) mVUinit(VURegs* vuRegsPtr) {
microVU* mVU = mVUx;
mVU->regs = vuRegsPtr;
mVU->index = vuIndex;
mVU->microSize = (vuIndex ? 0x4000 : 0x1000);
mVU->progSize = (vuIndex ? 0x4000 : 0x1000) / 4;
mVU->microMemSize = (vuIndex ? 0x4000 : 0x1000);
mVU->progMemSize = (vuIndex ? 0x4000 : 0x1000) / 4;
mVU->cache = NULL;
mVU->cacheSize = mVUcacheSize;
memset(&mVU->prog, 0, sizeof(mVU->prog));
@ -62,7 +62,7 @@ microVUx(void) mVUreset() {
// Delete Block Managers
for (int i = 0; i <= mVU->prog.max; i++) {
for (u32 j = 0; j < (mVU->progSize / 2); j++) {
for (u32 j = 0; j < (mVU->progMemSize / 2); j++) {
microBlockManager::Delete( mVU->prog.prog[i].block[j] );
}
}
@ -108,7 +108,7 @@ microVUf(void) mVUclose() {
// Delete Block Managers
for (int i = 0; i <= mVU->prog.max; i++) {
for (u32 j = 0; j < (mVU->progSize / 2); j++) {
for (u32 j = 0; j < (mVU->progMemSize / 2); j++) {
if (mVU->prog.prog[i].block[j]) {
microBlockManager::Delete( mVU->prog.prog[i].block[j] );
}
@ -137,7 +137,7 @@ microVUf(void) mVUclearProg(int progIndex) {
mVU->prog.prog[progIndex].range[0] = -1;
mVU->prog.prog[progIndex].range[1] = -1;
mVU->prog.prog[progIndex].x86ptr = mVU->prog.prog[progIndex].x86start;
for (u32 i = 0; i < (mVU->progSize / 2); i++) {
for (u32 i = 0; i < (mVU->progMemSize / 2); i++) {
if (mVU->prog.prog[progIndex].block[i])
mVU->prog.prog[progIndex].block[i]->reset();
}
@ -146,7 +146,7 @@ microVUf(void) mVUclearProg(int progIndex) {
// Caches Micro Program
microVUf(void) mVUcacheProg(int progIndex) {
microVU* mVU = mVUx;
memcpy_fast(mVU->prog.prog[progIndex].data, mVU->regs->Micro, mVU->microSize);
memcpy_fast(mVU->prog.prog[progIndex].data, mVU->regs->Micro, mVU->microMemSize);
mVUdumpProg(progIndex);
}
@ -214,7 +214,7 @@ microVUf(int) mVUcmpProg(int progIndex, bool progUsed, bool needOverflowCheck, b
microVU* mVU = mVUx;
if (progUsed) {
if (cmpWholeProg && (!memcmp_mmx((u8*)mVUprogI.data, mVU->regs->Micro, mVU->microSize)) ||
if (cmpWholeProg && (!memcmp_mmx((u8*)mVUprogI.data, mVU->regs->Micro, mVU->microMemSize)) ||
(!cmpWholeProg && (!memcmp_mmx((u8*)mVUprogI.data + mVUprogI.range[0], (u8*)mVU->regs->Micro + mVUprogI.range[0], ((mVUprogI.range[1] + 8) - mVUprogI.range[0]))))) {
mVU->prog.cur = progIndex;
mVU->prog.cleared = 0;
@ -275,7 +275,7 @@ static void* __fastcall mVUcompile( microVU* mVU, u32 startPC, uptr pState )
microBlock* pBlock = NULL;
u8* thisPtr = x86Ptr;
const u32 microSizeDiv8 = (mVU->microSize-1) / 8;
const u32 microSizeDiv8 = (mVU->microMemSize-1) / 8;
// First Pass
iPC = startPC / 4;
@ -433,8 +433,8 @@ microVUt(void*) mVUblockFetch( microVU* mVU, u32 startPC, uptr pState )
{
using namespace x86Emitter;
if (startPC > mVU->microSize-1) { Console::Error("microVU%d: invalid startPC", params mVU->index); }
startPC &= ~7;
if (startPC > mVU->microMemSize-8) { Console::Error("microVU%d: invalid startPC", params mVU->index); }
startPC &= mVU->microMemSize-8;
if (mVUblocks[startPC/8] == NULL) {
mVUblocks[startPC/8] = microBlockManager::AlignedNew();

View File

@ -64,7 +64,7 @@ public:
}
return thisBlock;
}
microBlock* search(microRegInfo* pState) {
__releaseinline microBlock* search(microRegInfo* pState) {
if (listSize < 0) return NULL;
if (pState->needExactMatch) { // Needs Detailed Search (Exact Match of Pipeline State)
for (int i = 0; i <= listSize; i++) {
@ -116,10 +116,10 @@ struct microVU {
PCSX2_ALIGNED16(u32 xmmPQb[4]); // Backup for xmmPQ
PCSX2_ALIGNED16(u32 xmmVFb[4]); // Backup for VF regs
u32 index; // VU Index (VU0 or VU1)
u32 microSize; // VU Micro Memory Size
u32 progSize; // VU Micro Program Size (microSize/4)
u32 cacheSize; // VU Cache Size
u32 index; // VU Index (VU0 or VU1)
u32 microMemSize; // VU Micro Memory Size (in bytes)
u32 progMemSize; // VU Micro Program Size (microSize/4, because each instruction of a program is 4 bytes)
u32 cacheSize; // VU Cache Size
microProgManager<0x4000/4> prog; // Micro Program Data

View File

@ -22,20 +22,20 @@
// Helper Macros
//------------------------------------------------------------------
#define branchCase(JMPcc) \
#define branchCase(JMPcc) \
mVUsetupBranch(mVU, xStatus, xMac, xClip, xCycles); \
xCMP( ptr16[&mVU->branch], 0); \
xCMP( ptr16[&mVU->branch], 0); \
if (mVUup.eBit) { /* Conditional Branch With E-Bit Set */ \
mVUendProgram(mVU, 2, xStatus, xMac, xClip); \
xForwardJump8 eJMP( JMPcc ); \
xForwardJump8 eJMP( JMPcc ); \
incPC(1); /* Set PC to First instruction of Non-Taken Side */ \
xMOV( ptr32[&mVU->regs->VI[REG_TPC].UL], xPC); \
xJMP( mVU->exitFunct ); \
eJMP.SetTarget(); \
xMOV( ptr32[&mVU->regs->VI[REG_TPC].UL], xPC); \
xJMP( mVU->exitFunct ); \
eJMP.SetTarget(); \
incPC(-4); /* Go Back to Branch Opcode to get branchAddr */ \
iPC = branchAddr/4; \
xMOV( ptr32[&mVU->regs->VI[REG_TPC].UL], xPC); \
xJMP( mVU->exitFunct ); \
xMOV( ptr32[&mVU->regs->VI[REG_TPC].UL], xPC); \
xJMP( mVU->exitFunct ); \
return thisPtr; \
} \
else { /* Normal Conditional Branch */ \
@ -43,7 +43,7 @@
if (!mVUblocks[iPC/2]) { mVUblocks[iPC/2] = microBlockManager::AlignedNew(); } \
bBlock = mVUblocks[iPC/2]->search((microRegInfo*)&mVUregs); \
incPC2(-1); \
if (bBlock) { xJcc( xInvertCond( JMPcc ), bBlock->x86ptrStart ); } \
if (bBlock) { xJcc( xInvertCond( JMPcc ), bBlock->x86ptrStart ); } \
else { ajmp = xJcc32( JMPcc ); } \
} \
break
@ -102,7 +102,7 @@
microVUt(void) mVUcheckIsSame(mV) {
if (mVU->prog.isSame == -1) {
mVU->prog.isSame = !memcmp_mmx(mVU->prog.prog[mVU->prog.cur].data, mVU->regs->Micro, mVU->microSize);
mVU->prog.isSame = !memcmp_mmx(mVU->prog.prog[mVU->prog.cur].data, mVU->regs->Micro, mVU->microMemSize);
}
if (mVU->prog.isSame == 0) {
if (!isVU1) mVUcacheProg<0>(mVU->prog.cur);

View File

@ -62,7 +62,7 @@ microVUx(void) __mVUdumpProgram(int progIndex) {
mVUlog("*********************\n\n<br><br>", progIndex);
mVUlog("</font>");
for (u32 i = 0; i < mVU->progSize; i+=2) {
for (u32 i = 0; i < mVU->progMemSize; i+=2) {
if (delay) { delay--; mVUlog("</font>"); if (!delay) mVUlog("<hr/>"); }
if (mVUbranch) { delay = 1; mVUbranch = 0; }

View File

@ -163,7 +163,7 @@ declareAllVariables
// Define mVUquickSearch
#ifndef __LINUX__
extern u8 mVUsearchXMM[0x1000];
PCSX2_ALIGNED16_EXTERN( u8 mVUsearchXMM[0x1000] );
typedef u32 (__fastcall *mVUCall)(void*, void*);
#define mVUquickSearch(dest, src, size) ((((mVUCall)((void*)mVUsearchXMM))(dest, src)) == 0xf)
#define mVUemitSearch() { mVUcustomSearch(); }
@ -201,10 +201,10 @@ typedef u32 (__fastcall *mVUCall)(void*, void*);
#define xPC ((iPC / 2) * 8)
#define curI ((u32*)mVU->regs->Micro)[iPC] //mVUcurProg.data[iPC]
#define setCode() { mVU->code = curI; }
#define incPC(x) { iPC = ((iPC + x) & (mVU->progSize-1)); setCode(); }
#define incPC2(x) { iPC = ((iPC + x) & (mVU->progSize-1)); }
#define incPC(x) { iPC = ((iPC + x) & (mVU->progMemSize-1)); setCode(); }
#define incPC2(x) { iPC = ((iPC + x) & (mVU->progMemSize-1)); }
#define bSaveAddr (((xPC + (2 * 8)) & ((isVU1) ? 0x3ff8:0xff8)) / 8)
#define branchAddr ((xPC + 8 + (_Imm11_ * 8)) & (mVU->microSize-8))
#define branchAddr ((xPC + 8 + (_Imm11_ * 8)) & (mVU->microMemSize-8))
#define shufflePQ (((mVU->p) ? 0xb0 : 0xe0) | ((mVU->q) ? 0x01 : 0x04))
#define Rmem (uptr)&mVU->regs->VI[REG_R].UL
#define Roffset (uptr)&mVU->regs->VI[9].UL