Exemplo n.º 1
0
static void recRecompile()
{
	// Look up the block...
	// (Mask the IOP address accordingly to account for the many various segments and
	//  mirrors).

	u32 masked_pc = iopRegs.pc & IopMemory::AddressMask;
	if( masked_pc < 0x800000 )
		masked_pc &= Ps2MemSize::IopRam-1;
	
	xBlocksMap::Blockmap_iterator blowme( g_PersState.xBlockMap.Map.find( masked_pc ) );

	memzero_obj( g_BlockState );
	//g_BlockState.pc = iopRegs.pc;

	if( blowme == g_PersState.xBlockMap.Map.end() )
	{
		//Console::WriteLn( "IOP First-pass block at PC: 0x%08x  (total blocks=%d)", params masked_pc, g_PersState.xBlockMap.Blocks.GetLength() );
		recIR_FirstPassInterpreter();

		jASSUME( iopRegs.evtCycleCountdown <= iopRegs.evtCycleDuration );
		if( iopRegs.evtCycleCountdown <= 0 )
			iopRegs.ExecutePendingEvents();

		//if( !IsIopRamPage( masked_pc ) )	// disable block checking for non-ram (rom, rom1, etc)
		//	m_blockspace.ramlen = 0;
		
		g_PersState.xBlockMap.Map[masked_pc] = g_PersState.xBlockMap.Blocks.GetLength();
		g_PersState.xBlockMap.Blocks.New().Assign( m_blockspace );
	}
	else
	{
		recBlockItem& mess( g_PersState.xBlockMap.Blocks[blowme->second] );

		if( !mess.InstOptInfo.IsDisposed() )
		{
			//Console::WriteLn( "IOP Second-pass block at PC: 0x%08x  (total blocks=%d)", params masked_pc, g_PersState.xBlockMap.Blocks.GetLength() );

			m_tempIR.GenerateIR( mess );
			mess.InstOptInfo.Dispose();

			m_x86blockstate.AssignBlock( m_tempIR );
			m_x86blockstate.RegisterMapper();

			g_BlockState.xBlockPtr = m_xBlock_CurPtr;
			m_x86blockstate.EmitSomeExecutableGoodness();
			m_xBlock_CurPtr = xGetPtr();
			
			uptr temp = m_tbl_TranslatePC[masked_pc>>XlatePC_PageBitShift];
			uptr* dispatch_ptr = (uptr*)(temp + (masked_pc & XlatePC_PageMask));
			*dispatch_ptr = (uptr)g_BlockState.xBlockPtr;
		}
	}
Exemplo n.º 2
0
void SaveState::vuMicroFreeze()
{
	jASSUME( VU0.Mem != NULL );
	jASSUME( VU1.Mem != NULL );

	Freeze(VU0.ACC);
	Freeze(VU0.code);
	FreezeMem(VU0.Mem,   4*1024);
	FreezeMem(VU0.Micro, 4*1024);

	Freeze(VU0.VF);
	if( GetVersion() >= 0x0012 )
		Freeze(VU0.VI);
	else
	{
		// Old versions stored the VIregs as 32 bit values...
		memzero_obj( VU0.VI );
		for(int i=0; i<32; i++ )
			Freeze( VU0.VI[i].UL );
	}

	Freeze(VU1.ACC);
	Freeze(VU1.code);
	FreezeMem(VU1.Mem,   16*1024);
	FreezeMem(VU1.Micro, 16*1024);

	Freeze(VU1.VF);
	if( GetVersion() >= 0x0012 )
		Freeze(VU1.VI);
	else
	{
		// Old versions stored the VIregs as 32 bit values...
		memzero_obj( VU1.VI );
		for(int i=0; i<32; i++ )
			Freeze( VU1.VI[i].UL );
	}

}
Exemplo n.º 3
0
void psxRcntInit() {
	int i;

	memzero_obj( psxCounters );

	for (i=0; i<3; i++) {
		psxCounters[i].rate = 1;
		psxCounters[i].mode|= 0x0400;
		psxCounters[i].target = IOPCNT_FUTURE_TARGET;
	}
	for (i=3; i<6; i++) {
		psxCounters[i].rate = 1;
		psxCounters[i].mode|= 0x0400;
		psxCounters[i].target = IOPCNT_FUTURE_TARGET;
	}

	psxCounters[0].interrupt = 0x10;
	psxCounters[1].interrupt = 0x20;
	psxCounters[2].interrupt = 0x40;

	psxCounters[3].interrupt = 0x04000;
	psxCounters[4].interrupt = 0x08000;
	psxCounters[5].interrupt = 0x10000;

	if (SPU2async != NULL)
	{
		psxCounters[6].rate = 768*12;
		psxCounters[6].CycleT = psxCounters[6].rate;
		psxCounters[6].mode = 0x8;
	}

	if (USBasync != NULL)
	{
		psxCounters[7].rate = PSXCLK/1000;
		psxCounters[7].CycleT = psxCounters[7].rate;
		psxCounters[7].mode = 0x8;
	}

	for (i=0; i<8; i++)
		psxCounters[i].sCycleT = psxRegs.cycle;

	// Tell the IOP to branch ASAP, so that timers can get
	// configured properly.
	psxNextCounter = 1;
	psxNextsCounter = psxRegs.cycle;
}
Exemplo n.º 4
0
void vuMicroMemReset()
{
	jASSUME( VU0.Mem != NULL );
	jASSUME( VU1.Mem != NULL );

	memMapVUmicro();

	// === VU0 Initialization ===
	memzero_obj(VU0.ACC);
	memzero_obj(VU0.VF);
	memzero_obj(VU0.VI);
    VU0.VF[0].f.x = 0.0f;
	VU0.VF[0].f.y = 0.0f;
	VU0.VF[0].f.z = 0.0f;
	VU0.VF[0].f.w = 1.0f;
	VU0.VI[0].UL = 0;
	memzero_ptr<4*1024>(VU0.Mem);
	memzero_ptr<4*1024>(VU0.Micro);

	/* this is kinda tricky, maxmem is set to 0x4400 here,
	   tho it's not 100% accurate, since the mem goes from
	   0x0000 - 0x1000 (Mem) and 0x4000 - 0x4400 (VU1 Regs),
	   i guess it shouldn't be a problem,
	   at least hope so :) (linuz)
	*/
	VU0.maxmem = 0x4800-4; //We are allocating 0x800 for vu1 reg's
	VU0.maxmicro = 0x1000-4;
	VU0.vuExec = vu0Exec;
	VU0.vifRegs = vif0Regs;

	// === VU1 Initialization ===
	memzero_obj(VU1.ACC);
	memzero_obj(VU1.VF);
	memzero_obj(VU1.VI);
	VU1.VF[0].f.x = 0.0f;
	VU1.VF[0].f.y = 0.0f;
	VU1.VF[0].f.z = 0.0f;
	VU1.VF[0].f.w = 1.0f;
	VU1.VI[0].UL = 0;
	memzero_ptr<16*1024>(VU1.Mem);
	memzero_ptr<16*1024>(VU1.Micro);

	VU1.maxmem   = 0x4000-4;//16*1024-4;
	VU1.maxmicro = 0x4000-4;
//	VU1.VF       = (VECTOR*)(VU0.Mem + 0x4000);
//	VU1.VI       = (REG_VI*)(VU0.Mem + 0x4200);
	VU1.vuExec   = vu1Exec;
	VU1.vifRegs  = vif1Regs;
}
Exemplo n.º 5
0
void cdrReset() {
	memzero_obj(cdr);
	cdr.CurTrack=1;
	cdr.File=1; cdr.Channel=1;
	cdReadTime = (PSXCLK / 1757) * BIAS; 
}