2009-09-08 12:08:10 +00:00
|
|
|
/* PCSX2 - PS2 Emulator for PCs
|
2010-05-03 14:08:02 +00:00
|
|
|
* Copyright (C) 2002-2010 PCSX2 Dev Team
|
2010-04-25 00:31:27 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU Lesser General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
2009-02-09 21:15:56 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with PCSX2.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
2009-02-09 21:15:56 +00:00
|
|
|
*/
|
|
|
|
|
2009-09-08 12:08:10 +00:00
|
|
|
|
2009-02-09 21:15:56 +00:00
|
|
|
#include "PrecompiledHeader.h"
|
|
|
|
#include "Common.h"
|
2009-11-14 12:02:56 +00:00
|
|
|
|
2009-02-09 21:15:56 +00:00
|
|
|
#include "R5900OpcodeTables.h"
|
2010-06-28 18:03:54 +00:00
|
|
|
#include "R5900Exceptions.h"
|
2009-10-23 20:24:59 +00:00
|
|
|
#include "System/SysThreads.h"
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2010-04-22 00:48:06 +00:00
|
|
|
#include "Elfheader.h"
|
2010-04-19 23:46:12 +00:00
|
|
|
|
2009-02-09 21:15:56 +00:00
|
|
|
#include <float.h>
|
|
|
|
|
|
|
|
using namespace R5900; // for OPCODE and OpcodeImpl
|
|
|
|
|
|
|
|
extern int vu0branch, vu1branch;
|
|
|
|
|
|
|
|
static int branch2 = 0;
|
|
|
|
static u32 cpuBlockCycles = 0; // 3 bit fixed point version of cycle count
|
|
|
|
static std::string disOut;
|
|
|
|
|
2009-10-23 20:24:59 +00:00
|
|
|
static void intEventTest();
|
|
|
|
|
2009-02-09 21:15:56 +00:00
|
|
|
// These macros are used to assemble the repassembler functions
|
|
|
|
|
|
|
|
static void debugI()
|
|
|
|
{
|
2009-03-01 21:49:17 +00:00
|
|
|
if( !IsDevBuild ) return;
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
if( cpuRegs.GPR.n.r0.UD[0] || cpuRegs.GPR.n.r0.UD[1] ) Console.Error("R0 is not zero!!!!");
|
2009-02-09 21:15:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//long int runs=0;
|
|
|
|
|
|
|
|
static void execI()
|
|
|
|
{
|
2009-03-01 21:49:17 +00:00
|
|
|
cpuRegs.code = memRead32( cpuRegs.pc );
|
|
|
|
if( IsDebugBuild )
|
|
|
|
debugI();
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
const OPCODE& opcode = GetCurrentInstruction();
|
|
|
|
//use this to find out what opcodes your game uses. very slow! (rama)
|
|
|
|
//runs++;
|
|
|
|
//if (runs > 1599999999){ //leave some time to startup the testgame
|
|
|
|
// if (opcode.Name[0] == 'L') { //find all opcodes beginning with "L"
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
// Console.WriteLn ("Load %s", opcode.Name);
|
2009-02-09 21:15:56 +00:00
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
2009-02-27 06:40:05 +00:00
|
|
|
// Another method of instruction dumping:
|
|
|
|
/*if( cpuRegs.cycle > 0x4f24d714 )
|
|
|
|
{
|
2009-03-27 06:34:51 +00:00
|
|
|
//CPU_LOG( "%s", disR5900Current.getCString());
|
2009-02-27 06:40:05 +00:00
|
|
|
disOut.clear();
|
|
|
|
opcode.disasm( disOut );
|
|
|
|
disOut += '\n';
|
|
|
|
CPU_LOG( disOut.c_str() );
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
2009-02-09 21:15:56 +00:00
|
|
|
cpuBlockCycles += opcode.cycles;
|
|
|
|
cpuRegs.pc += 4;
|
|
|
|
|
|
|
|
opcode.interpret();
|
|
|
|
}
|
|
|
|
|
|
|
|
static __forceinline void _doBranch_shared(u32 tar)
|
|
|
|
{
|
|
|
|
branch2 = cpuRegs.branch = 1;
|
|
|
|
execI();
|
|
|
|
|
|
|
|
// branch being 0 means an exception was thrown, since only the exception
|
|
|
|
// handler should ever clear it.
|
|
|
|
|
|
|
|
if( cpuRegs.branch != 0 )
|
|
|
|
{
|
|
|
|
cpuRegs.pc = tar;
|
|
|
|
cpuRegs.branch = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __fastcall doBranch( u32 target )
|
|
|
|
{
|
|
|
|
_doBranch_shared( target );
|
|
|
|
cpuRegs.cycle += cpuBlockCycles >> 3;
|
|
|
|
cpuBlockCycles &= (1<<3)-1;
|
2009-08-25 15:38:48 +00:00
|
|
|
intEventTest();
|
2009-02-09 21:15:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void __fastcall intDoBranch(u32 target)
|
|
|
|
{
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
//Console.WriteLn("Interpreter Branch ");
|
2009-02-09 21:15:56 +00:00
|
|
|
_doBranch_shared( target );
|
|
|
|
|
|
|
|
if( Cpu == &intCpu )
|
|
|
|
{
|
|
|
|
cpuRegs.cycle += cpuBlockCycles >> 3;
|
|
|
|
cpuBlockCycles &= (1<<3)-1;
|
2009-08-25 15:38:48 +00:00
|
|
|
intEventTest();
|
2009-02-09 21:15:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-25 00:31:27 +00:00
|
|
|
void intSetBranch()
|
2009-04-24 02:28:14 +00:00
|
|
|
{
|
2009-02-09 21:15:56 +00:00
|
|
|
branch2 = /*cpuRegs.branch =*/ 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
// R5900 Branching Instructions!
|
|
|
|
// These are the interpreter versions of the branch instructions. Unlike other
|
|
|
|
// types of interpreter instructions which can be called safely from the recompilers,
|
|
|
|
// these instructions are not "recSafe" because they may not invoke the
|
|
|
|
// necessary branch test logic that the recs need to maintain sync with the
|
|
|
|
// cpuRegs.pc and delaySlot instruction and such.
|
|
|
|
|
|
|
|
namespace R5900 {
|
|
|
|
namespace Interpreter {
|
|
|
|
namespace OpcodeImpl {
|
|
|
|
|
|
|
|
/*********************************************************
|
|
|
|
* Jump to target *
|
|
|
|
* Format: OP target *
|
|
|
|
*********************************************************/
|
2009-05-01 01:13:37 +00:00
|
|
|
// fixme: looking at the other branching code, shouldn't those _SetLinks in BGEZAL and such only be set
|
|
|
|
// if the condition is true? --arcum42
|
2010-04-25 00:31:27 +00:00
|
|
|
|
|
|
|
void J()
|
2009-04-24 02:28:14 +00:00
|
|
|
{
|
2009-02-09 21:15:56 +00:00
|
|
|
doBranch(_JumpTarget_);
|
|
|
|
}
|
|
|
|
|
2010-04-25 00:31:27 +00:00
|
|
|
void JAL()
|
2009-04-24 02:28:14 +00:00
|
|
|
{
|
2010-04-25 00:31:27 +00:00
|
|
|
_SetLink(31);
|
2009-04-24 02:28:14 +00:00
|
|
|
doBranch(_JumpTarget_);
|
2009-02-09 21:15:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************
|
|
|
|
* Register branch logic *
|
|
|
|
* Format: OP rs, rt, offset *
|
|
|
|
*********************************************************/
|
|
|
|
|
2009-04-24 02:28:14 +00:00
|
|
|
void BEQ() // Branch if Rs == Rt
|
2010-04-25 00:31:27 +00:00
|
|
|
{
|
|
|
|
if (cpuRegs.GPR.r[_Rs_].SD[0] == cpuRegs.GPR.r[_Rt_].SD[0])
|
|
|
|
doBranch(_BranchTarget_);
|
|
|
|
else
|
2009-04-24 02:28:14 +00:00
|
|
|
intEventTest();
|
2010-04-25 00:31:27 +00:00
|
|
|
}
|
2009-04-24 02:28:14 +00:00
|
|
|
|
|
|
|
void BNE() // Branch if Rs != Rt
|
2010-04-25 00:31:27 +00:00
|
|
|
{
|
|
|
|
if (cpuRegs.GPR.r[_Rs_].SD[0] != cpuRegs.GPR.r[_Rt_].SD[0])
|
|
|
|
doBranch(_BranchTarget_);
|
|
|
|
else
|
2009-04-24 02:28:14 +00:00
|
|
|
intEventTest();
|
2010-04-25 00:31:27 +00:00
|
|
|
}
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
/*********************************************************
|
|
|
|
* Register branch logic *
|
|
|
|
* Format: OP rs, offset *
|
|
|
|
*********************************************************/
|
2009-04-24 02:28:14 +00:00
|
|
|
|
|
|
|
void BGEZ() // Branch if Rs >= 0
|
2010-04-25 00:31:27 +00:00
|
|
|
{
|
|
|
|
if(cpuRegs.GPR.r[_Rs_].SD[0] >= 0)
|
|
|
|
{
|
|
|
|
doBranch(_BranchTarget_);
|
2009-04-24 02:28:14 +00:00
|
|
|
}
|
2010-04-25 00:31:27 +00:00
|
|
|
}
|
2009-04-24 02:28:14 +00:00
|
|
|
|
|
|
|
void BGEZAL() // Branch if Rs >= 0 and link
|
2010-04-25 00:31:27 +00:00
|
|
|
{
|
|
|
|
|
2009-04-24 02:28:14 +00:00
|
|
|
if (cpuRegs.GPR.r[_Rs_].SD[0] >= 0)
|
2010-04-25 00:31:27 +00:00
|
|
|
{
|
|
|
|
_SetLink(31);
|
|
|
|
doBranch(_BranchTarget_);
|
2009-02-09 21:15:56 +00:00
|
|
|
}
|
2010-04-25 00:31:27 +00:00
|
|
|
}
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2009-04-24 02:28:14 +00:00
|
|
|
void BGTZ() // Branch if Rs > 0
|
2010-04-25 00:31:27 +00:00
|
|
|
{
|
|
|
|
if (cpuRegs.GPR.r[_Rs_].SD[0] > 0)
|
|
|
|
{
|
|
|
|
doBranch(_BranchTarget_);
|
2009-02-09 21:15:56 +00:00
|
|
|
}
|
2010-04-25 00:31:27 +00:00
|
|
|
}
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2009-04-24 02:28:14 +00:00
|
|
|
void BLEZ() // Branch if Rs <= 0
|
2010-04-25 00:31:27 +00:00
|
|
|
{
|
|
|
|
if (cpuRegs.GPR.r[_Rs_].SD[0] <= 0)
|
|
|
|
{
|
|
|
|
doBranch(_BranchTarget_);
|
2009-04-24 02:28:14 +00:00
|
|
|
}
|
2010-04-25 00:31:27 +00:00
|
|
|
}
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2009-04-24 02:28:14 +00:00
|
|
|
void BLTZ() // Branch if Rs < 0
|
2010-04-25 00:31:27 +00:00
|
|
|
{
|
|
|
|
if (cpuRegs.GPR.r[_Rs_].SD[0] < 0)
|
|
|
|
{
|
|
|
|
doBranch(_BranchTarget_);
|
2009-04-24 02:28:14 +00:00
|
|
|
}
|
2010-04-25 00:31:27 +00:00
|
|
|
}
|
2009-04-24 02:28:14 +00:00
|
|
|
|
|
|
|
void BLTZAL() // Branch if Rs < 0 and link
|
2010-04-25 00:31:27 +00:00
|
|
|
{
|
|
|
|
if (cpuRegs.GPR.r[_Rs_].SD[0] < 0)
|
|
|
|
{
|
|
|
|
_SetLink(31);
|
|
|
|
doBranch(_BranchTarget_);
|
2009-04-24 02:28:14 +00:00
|
|
|
}
|
2010-04-25 00:31:27 +00:00
|
|
|
}
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
/*********************************************************
|
|
|
|
* Register branch logic Likely *
|
|
|
|
* Format: OP rs, offset *
|
|
|
|
*********************************************************/
|
|
|
|
|
|
|
|
|
2009-04-24 02:28:14 +00:00
|
|
|
void BEQL() // Branch if Rs == Rt
|
2010-04-25 00:31:27 +00:00
|
|
|
{
|
|
|
|
if(cpuRegs.GPR.r[_Rs_].SD[0] == cpuRegs.GPR.r[_Rt_].SD[0])
|
|
|
|
{
|
|
|
|
doBranch(_BranchTarget_);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cpuRegs.pc +=4;
|
|
|
|
intEventTest();
|
|
|
|
}
|
2009-04-24 02:28:14 +00:00
|
|
|
}
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2009-04-24 02:28:14 +00:00
|
|
|
void BNEL() // Branch if Rs != Rt
|
2010-04-25 00:31:27 +00:00
|
|
|
{
|
|
|
|
if(cpuRegs.GPR.r[_Rs_].SD[0] != cpuRegs.GPR.r[_Rt_].SD[0])
|
|
|
|
{
|
|
|
|
doBranch(_BranchTarget_);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cpuRegs.pc +=4;
|
|
|
|
intEventTest();
|
|
|
|
}
|
2009-04-24 02:28:14 +00:00
|
|
|
}
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2009-04-24 02:28:14 +00:00
|
|
|
void BLEZL() // Branch if Rs <= 0
|
2010-04-25 00:31:27 +00:00
|
|
|
{
|
|
|
|
if(cpuRegs.GPR.r[_Rs_].SD[0] <= 0)
|
|
|
|
{
|
|
|
|
doBranch(_BranchTarget_);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cpuRegs.pc +=4;
|
2009-04-24 02:28:14 +00:00
|
|
|
intEventTest();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BGTZL() // Branch if Rs > 0
|
2010-04-25 00:31:27 +00:00
|
|
|
{
|
|
|
|
if(cpuRegs.GPR.r[_Rs_].SD[0] > 0)
|
|
|
|
{
|
|
|
|
doBranch(_BranchTarget_);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cpuRegs.pc +=4;
|
2009-04-24 02:28:14 +00:00
|
|
|
intEventTest();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BLTZL() // Branch if Rs < 0
|
2010-04-25 00:31:27 +00:00
|
|
|
{
|
|
|
|
if(cpuRegs.GPR.r[_Rs_].SD[0] < 0)
|
|
|
|
{
|
|
|
|
doBranch(_BranchTarget_);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cpuRegs.pc +=4;
|
2009-04-24 02:28:14 +00:00
|
|
|
intEventTest();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BGEZL() // Branch if Rs >= 0
|
2010-04-25 00:31:27 +00:00
|
|
|
{
|
|
|
|
if(cpuRegs.GPR.r[_Rs_].SD[0] >= 0)
|
|
|
|
{
|
|
|
|
doBranch(_BranchTarget_);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cpuRegs.pc +=4;
|
2009-04-24 02:28:14 +00:00
|
|
|
intEventTest();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BLTZALL() // Branch if Rs < 0 and link
|
2010-04-25 00:31:27 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
if(cpuRegs.GPR.r[_Rs_].SD[0] < 0)
|
|
|
|
{
|
|
|
|
_SetLink(31);
|
|
|
|
doBranch(_BranchTarget_);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cpuRegs.pc +=4;
|
|
|
|
intEventTest();
|
2009-04-24 02:28:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BGEZALL() // Branch if Rs >= 0 and link
|
2010-04-25 00:31:27 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
if(cpuRegs.GPR.r[_Rs_].SD[0] >= 0)
|
|
|
|
{
|
|
|
|
_SetLink(31);
|
|
|
|
doBranch(_BranchTarget_);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cpuRegs.pc +=4;
|
|
|
|
intEventTest();
|
2009-04-24 02:28:14 +00:00
|
|
|
}
|
|
|
|
}
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
/*********************************************************
|
|
|
|
* Register jump *
|
|
|
|
* Format: OP rs, rd *
|
|
|
|
*********************************************************/
|
2010-04-25 00:31:27 +00:00
|
|
|
void JR()
|
|
|
|
{
|
|
|
|
doBranch(cpuRegs.GPR.r[_Rs_].UL[0]);
|
2009-02-09 21:15:56 +00:00
|
|
|
}
|
|
|
|
|
2009-04-24 02:28:14 +00:00
|
|
|
void JALR()
|
2010-04-25 00:31:27 +00:00
|
|
|
{
|
2009-02-09 21:15:56 +00:00
|
|
|
u32 temp = cpuRegs.GPR.r[_Rs_].UL[0];
|
2010-04-25 00:31:27 +00:00
|
|
|
|
|
|
|
if (_Rd_) _SetLink(_Rd_);
|
|
|
|
|
2009-02-09 21:15:56 +00:00
|
|
|
doBranch(temp);
|
|
|
|
}
|
|
|
|
|
|
|
|
} } } // end namespace R5900::Interpreter::OpcodeImpl
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////
|
|
|
|
|
2009-10-23 20:24:59 +00:00
|
|
|
static void intAlloc()
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
|
|
|
// fixme : detect cpu for use the optimize asm code
|
|
|
|
}
|
|
|
|
|
2009-10-23 20:24:59 +00:00
|
|
|
static void intReset()
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
|
|
|
cpuRegs.branch = 0;
|
|
|
|
branch2 = 0;
|
|
|
|
}
|
|
|
|
|
2009-10-23 20:24:59 +00:00
|
|
|
static void intEventTest()
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
|
|
|
// Perform counters, ints, and IOP updates:
|
2009-08-25 15:38:48 +00:00
|
|
|
_cpuBranchTest_Shared();
|
2009-02-09 21:15:56 +00:00
|
|
|
}
|
|
|
|
|
2009-10-23 20:24:59 +00:00
|
|
|
static void intExecute()
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
2009-12-14 12:18:55 +00:00
|
|
|
try {
|
2010-04-19 23:46:12 +00:00
|
|
|
if (g_SkipBiosHack) {
|
|
|
|
do
|
|
|
|
execI();
|
|
|
|
while (cpuRegs.pc != EELOAD_START);
|
|
|
|
eeloadReplaceOSDSYS();
|
|
|
|
}
|
|
|
|
if (ElfEntry != -1) {
|
|
|
|
do
|
|
|
|
execI();
|
|
|
|
while (cpuRegs.pc != ElfEntry);
|
|
|
|
eeGameStarting();
|
|
|
|
} else {
|
|
|
|
while (true)
|
|
|
|
execI();
|
2009-12-17 14:04:09 +00:00
|
|
|
}
|
|
|
|
} catch( Exception::ExitCpuExecute& ) { }
|
2009-12-14 14:36:13 +00:00
|
|
|
}
|
|
|
|
|
2009-10-23 20:24:59 +00:00
|
|
|
static void intCheckExecutionState()
|
|
|
|
{
|
2009-12-14 12:18:55 +00:00
|
|
|
if( GetCoreThread().HasPendingStateChangeRequest() )
|
2009-12-14 12:37:27 +00:00
|
|
|
throw Exception::ExitCpuExecute();
|
2009-10-23 20:24:59 +00:00
|
|
|
}
|
|
|
|
|
2009-02-09 21:15:56 +00:00
|
|
|
static void intStep()
|
|
|
|
{
|
|
|
|
execI();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void intClear(u32 Addr, u32 Size)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void intShutdown() {
|
|
|
|
}
|
|
|
|
|
2010-06-28 18:03:54 +00:00
|
|
|
static void intThrowException( const BaseR5900Exception& ex )
|
|
|
|
{
|
|
|
|
// No tricks needed; C++ stack unwnding shoud suffice for MSW and GCC alike.
|
|
|
|
ex.Rethrow();
|
|
|
|
}
|
|
|
|
|
2010-07-09 16:51:48 +00:00
|
|
|
static void intThrowException( const BaseException& ex )
|
|
|
|
{
|
|
|
|
// No tricks needed; C++ stack unwnding shoud suffice for MSW and GCC alike.
|
|
|
|
ex.Rethrow();
|
|
|
|
}
|
|
|
|
|
2009-12-06 15:31:11 +00:00
|
|
|
R5900cpu intCpu =
|
|
|
|
{
|
2009-02-09 21:15:56 +00:00
|
|
|
intAlloc,
|
2009-12-06 15:31:11 +00:00
|
|
|
intShutdown,
|
|
|
|
|
2009-02-09 21:15:56 +00:00
|
|
|
intReset,
|
|
|
|
intStep,
|
|
|
|
intExecute,
|
2009-12-06 15:31:11 +00:00
|
|
|
|
2009-10-23 20:24:59 +00:00
|
|
|
intCheckExecutionState,
|
2010-06-28 18:03:54 +00:00
|
|
|
intThrowException,
|
2010-07-09 16:51:48 +00:00
|
|
|
intThrowException,
|
2009-02-09 21:15:56 +00:00
|
|
|
intClear,
|
|
|
|
};
|