Example #1
0
// rt op rs
void eeRecompileCode3(R5900FNPTR constcode, R5900FNPTR_INFO multicode)
{
	pxFail( "Unfinished code reached." );

	// for now, don't support xmm
	_deleteEEreg(_Rs_, 0);
	_deleteEEreg(_Rt_, 1);

	if( GPR_IS_CONST2(_Rs_, _Rt_) ) {
		constcode();
		return;
	}

	if( GPR_IS_CONST1(_Rs_) ) {
		//multicode(PROCESS_EE_CONSTT);
		return;
	}

	if( GPR_IS_CONST1(_Rt_) ) {
		//multicode(PROCESS_EE_CONSTT);
		return;
	}

	multicode(0);
}
Example #2
0
void recMFSA()
{
	int mmreg;
	if (!_Rd_) return;

	mmreg = _checkXMMreg(XMMTYPE_GPRREG, _Rd_, MODE_WRITE);
	if( mmreg >= 0 ) {
		xMOVL.PS(xRegisterSSE(mmreg), ptr[&cpuRegs.sa]);
	}
	else if( (mmreg = _checkMMXreg(MMX_GPR+_Rd_, MODE_WRITE)) >= 0 ) {
		xMOVDZX(xRegisterMMX(mmreg), ptr[&cpuRegs.sa]);
		SetMMXstate();
	}
	else {
		xMOV(eax, ptr[&cpuRegs.sa]);
		_deleteEEreg(_Rd_, 0);
		xMOV(ptr[&cpuRegs.GPR.r[_Rd_].UL[0]], eax);
		xMOV(ptr32[&cpuRegs.GPR.r[_Rd_].UL[1]], 0);
	}
}
Example #3
0
void recMFSA( void )
{
	int mmreg;
	if (!_Rd_) return;

	mmreg = _checkXMMreg(XMMTYPE_GPRREG, _Rd_, MODE_WRITE);
	if( mmreg >= 0 ) {
		SSE_MOVLPS_M64_to_XMM(mmreg, (uptr)&cpuRegs.sa);
	}
	else if( (mmreg = _checkMMXreg(MMX_GPR+_Rd_, MODE_WRITE)) >= 0 ) {
		MOVDMtoMMX(mmreg, (uptr)&cpuRegs.sa);
		SetMMXstate();
	}
	else {
		MOV32MtoR(EAX, (u32)&cpuRegs.sa);
		_deleteEEreg(_Rd_, 0);
		MOV32RtoM((uptr)&cpuRegs.GPR.r[_Rd_].UL[0], EAX);
		MOV32ItoM((uptr)&cpuRegs.GPR.r[_Rd_].UL[1], 0);
	}
}
Example #4
0
void recJAL()
{
	u32 newpc = (_Target_ << 2) + ( pc & 0xf0000000 );
	_deleteEEreg(31, 0);
	if(EE_CONST_PROP)
	{
		GPR_SET_CONST(31);
		g_cpuConstRegs[31].UL[0] = pc + 4;
		g_cpuConstRegs[31].UL[1] = 0;
	}
	else
	{
		xMOV(ptr32[&cpuRegs.GPR.r[31].UL[0]], pc + 4);
		xMOV(ptr32[&cpuRegs.GPR.r[31].UL[1]], 0);
	}

	recompileNextInstruction(1);
	if (EmuConfig.Gamefixes.GoemonTlbHack)
		SetBranchImm(vtlb_V2P(newpc));
	else
		SetBranchImm(newpc);
}
Example #5
0
void recMFC0()
{
	if( _Rd_ == 9 )
	{
		// This case needs to be handled even if the write-back is ignored (_Rt_ == 0 )
        xMOV(ecx, ptr[&cpuRegs.cycle]);
        xMOV(eax, ecx);
		xSUB(eax, ptr[&s_iLastCOP0Cycle]);
		u8* skipInc = JNZ8( 0 );
		xINC(eax);
		x86SetJ8( skipInc );
        xADD(ptr[&cpuRegs.CP0.n.Count], eax);
		xMOV(ptr[&s_iLastCOP0Cycle], ecx);
        xMOV(eax, ptr[&cpuRegs.CP0.r[ _Rd_ ] ]);

		if( !_Rt_ ) return;

		_deleteEEreg(_Rt_, 0);
		xMOV(ptr[&cpuRegs.GPR.r[_Rt_].UL[0]], eax);

		xCDQ();
		xMOV(ptr[&cpuRegs.GPR.r[_Rt_].UL[1]], edx);
		return;
	}

	if ( !_Rt_ ) return;

	if( _Rd_ == 25 )
	{
		switch(_Imm_ & 0x3F)
		{
			case 0:
				xMOV(eax, ptr[&cpuRegs.PERF.n.pccr]);
			break;

			case 1:
				iFlushCall(FLUSH_INTERPRETER);
				xFastCall(COP0_UpdatePCCR );
				xMOV(eax, ptr[&cpuRegs.PERF.n.pcr0]);
				break;
			case 3:
				iFlushCall(FLUSH_INTERPRETER);
				xFastCall(COP0_UpdatePCCR );
				xMOV(eax, ptr[&cpuRegs.PERF.n.pcr1]);
			break;
		}
		_deleteEEreg(_Rt_, 0);
		xMOV(ptr[&cpuRegs.GPR.r[_Rt_].UL[0]], eax);

		xCDQ();
		xMOV(ptr[&cpuRegs.GPR.r[_Rt_].UL[1]], edx);

		return;
	}
	else if(_Rd_ == 24){
		COP0_LOG("MFC0 Breakpoint debug Registers code = %x\n", cpuRegs.code & 0x3FF);
        return;
	}
	_eeOnWriteReg(_Rt_, 1);
	_deleteEEreg(_Rt_, 0);
	xMOV(eax, ptr[&cpuRegs.CP0.r[ _Rd_ ]]);
	xCDQ();
	xMOV(ptr[&cpuRegs.GPR.r[_Rt_].UL[0]], eax);
	xMOV(ptr[&cpuRegs.GPR.r[_Rt_].UL[1]], edx);
}
Example #6
0
void recJALR()
{
	int newpc = pc + 4;
	_allocX86reg(esi, X86TYPE_PCWRITEBACK, 0, MODE_WRITE);
	_eeMoveGPRtoR(esi, _Rs_);

	if (EmuConfig.Gamefixes.GoemonTlbHack) {
		xMOV(ecx, esi);
		vtlb_DynV2P();
		xMOV(esi, eax);
	}
	// uncomment when there are NO instructions that need to call interpreter
//	int mmreg;
//	if( GPR_IS_CONST1(_Rs_) )
//		xMOV(ptr32[&cpuRegs.pc], g_cpuConstRegs[_Rs_].UL[0] );
//	else {
//		int mmreg;
//
//		if( (mmreg = _checkXMMreg(XMMTYPE_GPRREG, _Rs_, MODE_READ)) >= 0 ) {
//			xMOVSS(ptr[&cpuRegs.pc], xRegisterSSE(mmreg));
//		}
//		else if( (mmreg = _checkMMXreg(MMX_GPR+_Rs_, MODE_READ)) >= 0 ) {
//			xMOVD(ptr[&cpuRegs.pc], xRegisterMMX(mmreg));
//			SetMMXstate();
//		}
//		else {
//			xMOV(eax, ptr[(void*)((int)&cpuRegs.GPR.r[ _Rs_ ].UL[ 0 ] )]);
//			xMOV(ptr[&cpuRegs.pc], eax);
//		}
//	}

	
	if ( _Rd_ )
	{
		_deleteEEreg(_Rd_, 0);
		if(EE_CONST_PROP)
		{
			GPR_SET_CONST(_Rd_);
			g_cpuConstRegs[_Rd_].UL[0] = newpc;
			g_cpuConstRegs[_Rd_].UL[1] = 0;
		}
		else
		{
			xMOV(ptr32[&cpuRegs.GPR.r[_Rd_].UL[0]], newpc);
			xMOV(ptr32[&cpuRegs.GPR.r[_Rd_].UL[1]], 0);
		}
	}

	_clearNeededMMXregs();
	_clearNeededXMMregs();
	recompileNextInstruction(1);

	if( x86regs[esi.GetId()].inuse ) {
		pxAssert( x86regs[esi.GetId()].type == X86TYPE_PCWRITEBACK );
		xMOV(ptr[&cpuRegs.pc], esi);
		x86regs[esi.GetId()].inuse = 0;
	}
	else {
		xMOV(eax, ptr[&g_recWriteback]);
		xMOV(ptr[&cpuRegs.pc], eax);
	}

	SetBranchReg(0xffffffff);
}