Exemplo n.º 1
0
// Resets Rec Data
void mVUreset(microVU& mVU, bool resetReserve) {

	// Restore reserve to uncommitted state
	if (resetReserve) mVU.cache_reserve->Reset();

	HostSys::MemProtect(mVU.dispCache, mVUdispCacheSize, PageAccess_ReadWrite());
	memset(mVU.dispCache, 0xcc, mVUdispCacheSize);

	x86SetPtr(mVU.dispCache);
	mVUdispatcherAB(mVU);
	mVUdispatcherCD(mVU);
	mVUemitSearch();

	// Clear All Program Data
	//memset(&mVU.prog, 0, sizeof(mVU.prog));
	memset(&mVU.prog.lpState, 0, sizeof(mVU.prog.lpState));
	mVU.profiler.Reset(mVU.index);

	// Program Variables
	mVU.prog.cleared	=  1;
	mVU.prog.isSame		= -1;
	mVU.prog.cur		= NULL;
	mVU.prog.total		=  0;
	mVU.prog.curFrame	=  0;

	// Setup Dynarec Cache Limits for Each Program
	u8* z = mVU.cache;
	mVU.prog.x86start	= z;
	mVU.prog.x86ptr		= z;
	mVU.prog.x86end		= z + ((mVU.cacheSize - mVUcacheSafeZone) * _1mb);
	//memset(mVU.prog.x86start, 0xcc, mVU.cacheSize*_1mb);

	for(u32 i = 0; i < (mVU.progSize / 2); i++) {
		if(!mVU.prog.prog[i]) {
			mVU.prog.prog[i] = new std::deque<microProgram*>();
			continue;
		}
		std::deque<microProgram*>::iterator it(mVU.prog.prog[i]->begin());
		for ( ; it != mVU.prog.prog[i]->end(); ++it) {
			mVUdeleteProg(mVU, it[0]);
		}
		mVU.prog.prog[i]->clear();
		mVU.prog.quick[i].block = NULL;
		mVU.prog.quick[i].prog  = NULL;
	}

	HostSys::MemProtect(mVU.dispCache, mVUdispCacheSize, PageAccess_ExecOnly());

	if (mVU.index) Perf::any.map((uptr)&mVU.dispCache, mVUdispCacheSize, "mVU1 Dispatcher");
	else           Perf::any.map((uptr)&mVU.dispCache, mVUdispCacheSize, "mVU0 Dispatcher");
}
Exemplo n.º 2
0
// Resets Rec Data
void microVU::reset() {

	x86SetPtr(dispCache);
	mVUdispatcherA(this);
	mVUdispatcherB(this);
	mVUemitSearch();

	// Clear All Program Data
	//memset(&prog, 0, sizeof(prog));
	memset(&prog.lpState, 0, sizeof(prog.lpState));

	if (IsDevBuild) { // Release builds shouldn't need this
		memset(cache, 0xcc, cacheSize);
	}

	// Program Variables
	prog.cleared	=  1;
	prog.isSame		= -1;
	prog.cur		= NULL;
	prog.total		=  0;
	prog.curFrame	=  0;

	// Setup Dynarec Cache Limits for Each Program
	u8* z = cache;
	prog.x86start	= z;
	prog.x86ptr		= z;
	prog.x86end		= (u8*)((uptr)z + (uptr)(cacheSize - mVUcacheSafeZone)); // "Safe Zone"

	for (u32 i = 0; i < (progSize / 2); i++) {
		deque<microProgram*>::iterator it(prog.prog[i]->begin());
		for ( ; it != prog.prog[i]->end(); ++it) {
			if (index)	mVUdeleteProg<1>(it[0]);
			else		mVUdeleteProg<0>(it[0]);
		}
		prog.prog[i]->clear();
		prog.quick[i].block = NULL;
		prog.quick[i].prog  = NULL;
	}
}