Exemple #1
0
// Only run this once per VU! ;)
void microVU::init(uint vuIndex) {

	if(!x86caps.hasMultimediaExtensions)		mVUthrowHardwareDeficiency( L"MMX", vuIndex );
	if(!x86caps.hasStreamingSIMDExtensions)		mVUthrowHardwareDeficiency( L"SSE", vuIndex );
	if(!x86caps.hasStreamingSIMD2Extensions)	mVUthrowHardwareDeficiency( L"SSE2", vuIndex );

	memzero(prog);

	index			= vuIndex;
	cop2			= 0;
	vuMemSize		= (index ? 0x4000 : 0x1000);
	microMemSize	= (index ? 0x4000 : 0x1000);
	progSize		= (index ? 0x4000 : 0x1000) / 4;
	progMemMask		= progSize-1;
	dispCache		= NULL;
	cache			= NULL;
	cacheSize		= mVUcacheSize;
	regAlloc		= new microRegAlloc(index);

	for (u32 i = 0; i < (progSize / 2); i++) {
		prog.prog[i] = new deque<microProgram*>();
	}

	dispCache = SysMmapEx(0, mVUdispCacheSize, 0, (index ? "Micro VU1 Dispatcher" : "Micro VU0 Dispatcher"));
	if (!dispCache) throw Exception::OutOfMemory( index ? L"Micro VU1 Dispatcher" : L"Micro VU0 Dispatcher" );
	memset(dispCache, 0xcc, mVUdispCacheSize);

	// Allocates rec-cache and calls mVUreset()
	mVUresizeCache(this, cacheSize + mVUcacheSafeZone);
	//if (vuIndex) gen_memcpy_vibes();
}
Exemple #2
0
// Only run this once per VU! ;)
void mVUinit(microVU& mVU, uint vuIndex) {

	if(!x86caps.hasStreamingSIMD2Extensions) mVUthrowHardwareDeficiency( L"SSE2", vuIndex );

	memzero(mVU.prog);

	mVU.index			=  vuIndex;
	mVU.cop2			=  0;
	mVU.vuMemSize		= (mVU.index ? 0x4000 : 0x1000);
	mVU.microMemSize	= (mVU.index ? 0x4000 : 0x1000);
	mVU.progSize		= (mVU.index ? 0x4000 : 0x1000) / 4;
	mVU.progMemMask		=  mVU.progSize-1;
	mVU.cacheSize		=  vuIndex ? mVU1cacheReserve : mVU0cacheReserve;
	mVU.cache			= NULL;
	mVU.dispCache		= NULL;
	mVU.startFunct		= NULL;
	mVU.exitFunct		= NULL;

	mVUreserveCache(mVU);

	mVU.dispCache = SysMmapEx(0, mVUdispCacheSize, 0,(mVU.index ?  "Micro VU1 Dispatcher" :  "Micro VU0 Dispatcher"));
	if (!mVU.dispCache) throw Exception::OutOfMemory (mVU.index ? L"Micro VU1 Dispatcher" : L"Micro VU0 Dispatcher");
	memset(mVU.dispCache, 0xcc, mVUdispCacheSize);

	mVU.regAlloc = new microRegAlloc(mVU.index);
}
Exemple #3
0
static void mVUresizeCache(mV, u32 size) {

	if (size >= (u32)mVUcacheMaxSize) {
		if (mVU->cacheSize==mVUcacheMaxSize) {
			// We can't grow the rec any larger, so just reset it and start over.
			//(if we don't reset, the rec will eventually crash)
			Console.WriteLn(Color_Magenta, "microVU%d: Cannot grow cache, size limit reached! [%dmb].  Resetting rec.", mVU->index, mVU->cacheSize/_1mb);
			mVU->reset();
			return;
		}
		size = mVUcacheMaxSize;
	}

	if (mVU->cache) Console.WriteLn(Color_Green, "microVU%d: Attempting to resize Cache [%dmb]", mVU->index, size/_1mb);

	u8* cache = SysMmapEx(0, size, 0, (mVU->index ? "Micro VU1 RecCache" : "Micro VU0 RecCache"));
	if(!cache && !mVU->cache) throw Exception::OutOfMemory( wxsFormat( L"Micro VU%d recompiled code cache", mVU->index) );
	if(!cache) { Console.Error("microVU%d Error - Cache Resize Failed...", mVU->index); mVU->reset(); return; }
	if (mVU->cache) {
		HostSys::Munmap(mVU->cache, mVU->cacheSize);
		ProfilerTerminateSource(isVU1?"mVU1 Rec":"mVU0 Rec");
	}

	mVU->cache	   = cache;
	mVU->cacheSize = size;
	ProfilerRegisterSource(isVU1?"mVU1 Rec":"mVU0 Rec", mVU->cache, mVU->cacheSize);
	mVU->reset();
}