Created a BSCPropagate class and cleaned out the #define mess in ir5900tables.c. Fixed TLB build compilation errors. Cleaned up some of the headers and #includes use.

git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@438 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
Jake.Stine 2008-12-16 05:03:07 +00:00 committed by Gregory Hainaut
parent e0fc41331e
commit 96fb132655
25 changed files with 591 additions and 396 deletions

View File

@ -53,7 +53,7 @@ int getFreeCache(u32 mem, int mode, int * way) {
if(pCache[i].tag[number] & 0x60) // Valid Dirty
{
t = (char *)(taddr[number]); // fixme - this should probably be cast to (u8*)
t = (u8*)(taddr[number]);
out = (u8*)(t + (mem & 0xFC0));
((u64*)out)[0] = ((u64*)pCache[i].data[number][0].b8._8)[0];
((u64*)out)[1] = ((u64*)pCache[i].data[number][0].b8._8)[1];

View File

@ -23,6 +23,10 @@
#define __LINUX__
#endif
#ifdef _WIN32
#include <windows.h>
#endif
#include <zlib.h> // fixme: is zlib.h stuff used by that many modules that it should be here in common?
#include <string.h>
@ -32,11 +36,7 @@
#define DONT_USE_GETTEXT
#endif
#if defined(_WIN32)
#include <windows.h> // fixme: windows.h should be included to windows gui modules only.
#define pthread_mutex__unlock pthread_mutex_unlock
#if defined(_MSC_VER)
#define strnicmp _strnicmp
#define stricmp _stricmp

View File

@ -23,7 +23,6 @@
#include <stdio.h>
#include <zlib.h>
#include "PS2Edefs.h"
#include "Misc.h"
extern FILE *emuLog;

View File

@ -19,7 +19,6 @@
#include <stdio.h>
#include <string.h>
#include "PS2Etypes.h"
#include "Debug.h"
#include "R5900.h"
#include "DisASM.h"

View File

@ -29,6 +29,7 @@
#endif
#ifdef _WIN32
#include <windows.h>
AppData gApp;
#endif

View File

@ -18,18 +18,22 @@
// rewritten by zerofrog to add multithreading/gs caching to GS and VU1
#include "PS2Etypes.h"
#if defined(_WIN32)
#include <windows.h>
#endif
#include <assert.h>
#include <vector>
#include <list>
#include <cstring>
#include <cstdlib>
#if defined(_WIN32)
#include <windows.h>
#endif
#include "Common.h"
#include "zlib.h"
#include "VU.h"
#include "GS.h"
#include "iR5900.h"
using namespace std;
#ifdef DEBUG
@ -201,16 +205,6 @@ static void mutex_unlock( mutex_t& mutex )
#endif
#include "Common.h"
#include "zlib.h"
#include "VU.h"
//#include "ix86/ix86.h"
#include "iR5900.h"
#include "GS.h"
static wait_event_t g_hGsEvent; // set when path3 is ready to be processed
static wait_event_t g_hGSDone; // used to regulate thread startup and gsInit
static thread_t g_hVuGsThread;

View File

@ -24,6 +24,8 @@
#include <stdlib.h>
#include <string.h>
#include "zlib.h"
struct GSRegSIGBLID
{
u32 SIGID;

View File

@ -1216,13 +1216,13 @@ int hwMFIFOWrite(u32 addr, u8 *data, u32 size) {
int s2 = size - s1;
/* it does, so first copy 's1' bytes from 'data' to 'addr' */
dst = PSM(addr);
dst = (u8*)PSM(addr);
if (dst == NULL) return -1;
Cpu->Clear(addr, s1/4);
memcpy_fast(dst, data, s1);
/* and second copy 's2' bytes from '&data[s1]' to 'maddr' */
dst = PSM(psHu32(DMAC_RBOR));
dst = (u8*)PSM(psHu32(DMAC_RBOR));
if (dst == NULL) return -1;
Cpu->Clear(psHu32(DMAC_RBOR), s2/4);
memcpy_fast(dst, &data[s1], s2);
@ -1230,7 +1230,7 @@ int hwMFIFOWrite(u32 addr, u8 *data, u32 size) {
//u32 * tempptr, * tempptr2;
/* it doesn't, so just copy 'size' bytes from 'data' to 'addr' */
dst = PSM(addr);
dst = (u8*)PSM(addr);
if (dst == NULL) return -1;
Cpu->Clear(addr, size/4);
memcpy_fast(dst, data, size);

View File

@ -23,12 +23,12 @@
#include <sys/stat.h>
#include <ctype.h>
#include "Plugins.h"
#include "Common.h"
#include "PsxCommon.h"
#include "CDVDisodrv.h"
#include "VUmicro.h"
#ifdef _WIN32
#include <windows.h>
#include "RDebug/deci2.h"
#endif

View File

@ -23,12 +23,14 @@
#include <malloc.h>
#include <assert.h>
#include "PS2Etypes.h"
#ifndef _WIN32
#include <unistd.h>
#else
#include <windows.h>
#endif
#include "PS2Etypes.h"
// compile-time assert
#ifndef C_ASSERT
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]

View File

@ -53,7 +53,7 @@
#ifdef __LINUX__
#define CALLBACK
#else
#include <windows.h>
#define CALLBACK __stdcall
#endif
@ -197,7 +197,7 @@ typedef struct _GSdriverInfo {
void *common;
} GSdriverInfo;
#ifdef _WIN32
#ifdef _WINDOWS_
typedef struct _winInfo { // unsupported values must be set to zero
HWND hWnd;
HMENU hMenu;
@ -538,7 +538,7 @@ typedef int (CALLBACK* _GSsetupRecording)(int, void*);
typedef void (CALLBACK* _GSreset)();
typedef void (CALLBACK* _GSwriteCSR)(u32 value);
typedef void (CALLBACK* _GSgetDriverInfo)(GSdriverInfo *info);
#ifdef _WIN32
#ifdef _WINDOWS_
typedef s32 (CALLBACK* _GSsetWindowInfo)(winInfo *info);
#endif
typedef void (CALLBACK* _GSmakeSnapshot)(const char *path);
@ -724,7 +724,7 @@ extern _GSsetupRecording GSsetupRecording;
extern _GSreset GSreset;
extern _GSwriteCSR GSwriteCSR;
extern _GSgetDriverInfo GSgetDriverInfo;
#ifdef _WIN32
#ifdef _WINDOWS_
extern _GSsetWindowInfo GSsetWindowInfo;
#endif
extern _GSfreeze GSfreeze;

View File

@ -26,10 +26,6 @@
#define __LINUX__
#endif
#ifdef _WIN32
#include <windows.h>
#endif
#ifndef ARRAYSIZE
#define ARRAYSIZE(x) (sizeof(x)/sizeof((x)[0]))
#endif

View File

@ -18,6 +18,12 @@
#ifndef __PATCH_H__
#define __PATCH_H__
#ifdef _WIN32
#include<windows.h>
#endif
#include "PS2Etypes.h"
//
// Defines
//
@ -72,8 +78,7 @@ struct IniPatch
u64 data;
};
#ifdef _WIN32
#include<windows.h>
#ifdef _WINDOWS_
struct AppData
{
HWND hWnd; // Main window handle

View File

@ -18,12 +18,12 @@
#ifndef __PSXCOMMON_H__
#define __PSXCOMMON_H__
#include "PS2Etypes.h"
#ifdef _WIN32
#include <windows.h>
#endif
#include "PS2Etypes.h"
#include <assert.h>
#include "System.h"

View File

@ -73,12 +73,6 @@ MEMCPY_AMD.CPP
// Inline assembly syntax for use with Visual C++
#include "PS2Etypes.h"
#ifdef _WIN32
#include <windows.h>
#endif
#include "Misc.h"
#if defined(_MSC_VER) && !defined(__x86_64__)

View File

@ -23,12 +23,12 @@
#include <assert.h>
#include <malloc.h>
#include "PS2Etypes.h"
#if defined(_WIN32)
#include <windows.h>
#endif
#include "PS2Etypes.h"
#include "System.h"
#include "R5900.h"
#include "Vif.h"
@ -1278,24 +1278,24 @@ u32 _recIsRegUsed(EEINST* pinst, int size, u8 xmmtype, u8 reg)
return 0;
}
void _recFillRegister(EEINST* pinst, int type, int reg, int write)
void _recFillRegister(EEINST& pinst, int type, int reg, int write)
{
u32 i = 0;
if (write ) {
for(i = 0; i < ARRAYSIZE(pinst->writeType); ++i) {
if( pinst->writeType[i] == XMMTYPE_TEMP ) {
pinst->writeType[i] = type;
pinst->writeReg[i] = reg;
for(i = 0; i < ARRAYSIZE(pinst.writeType); ++i) {
if( pinst.writeType[i] == XMMTYPE_TEMP ) {
pinst.writeType[i] = type;
pinst.writeReg[i] = reg;
return;
}
}
assert(0);
}
else {
for(i = 0; i < ARRAYSIZE(pinst->readType); ++i) {
if( pinst->readType[i] == XMMTYPE_TEMP ) {
pinst->readType[i] = type;
pinst->readReg[i] = reg;
for(i = 0; i < ARRAYSIZE(pinst.readType); ++i) {
if( pinst.readType[i] == XMMTYPE_TEMP ) {
pinst.readType[i] = type;
pinst.readReg[i] = reg;
return;
}
}

View File

@ -332,7 +332,7 @@ void _recClearInst(EEINST* pinst);
u32 _recIsRegWritten(EEINST* pinst, int size, u8 xmmtype, u8 reg);
// returns the number of insts + 1 until used (0 if not used)
u32 _recIsRegUsed(EEINST* pinst, int size, u8 xmmtype, u8 reg);
void _recFillRegister(EEINST* pinst, int type, int reg, int write);
void _recFillRegister(EEINST& pinst, int type, int reg, int write);
#define EEINST_ISLIVE64(reg) (g_pCurInstInfo->regs[reg] & (EEINST_LIVE0|EEINST_LIVE1))
#define EEINST_ISLIVEXMM(reg) (g_pCurInstInfo->regs[reg] & (EEINST_LIVE0|EEINST_LIVE1|EEINST_LIVE2))

View File

@ -19,34 +19,22 @@
// stop compiling if NORECBUILD build (only for Visual Studio)
#if !(defined(_MSC_VER) && defined(PCSX2_NORECBUILD))
#include "PS2Etypes.h"
#if defined(_WIN32)
#include <windows.h>
#endif
#include <assert.h>
#include <vector>
#include <list>
using namespace std;
#include "zlib.h"
#include "Elfheader.h"
#include "Misc.h"
#include "System.h"
#include "R5900.h"
#include "Vif.h"
#include "Common.h"
#include "VU.h"
#include "VifDma.h"
#include "Memory.h"
#include "Hw.h"
#include "ix86/ix86.h"
#include "iR5900.h"
#include "Counters.h"
#include "GS.h"
#include "DebugTools/Debug.h"

View File

@ -22,7 +22,7 @@
// stop compiling if NORECBUILD build (only for Visual Studio)
#if !(defined(_MSC_VER) && defined(PCSX2_NORECBUILD))
#ifdef _WIN32
#ifdef _MSC_VER
#pragma warning(disable:4244)
#pragma warning(disable:4761)
#endif
@ -33,8 +33,6 @@
#include <assert.h>
#include <malloc.h>
#include "PS2Etypes.h"
#if defined(_WIN32)
#include <windows.h>
#else
@ -42,21 +40,12 @@
#include <sys/types.h>
#endif
#include "System.h"
#include "zlib.h"
#include "Memory.h"
#include "Misc.h"
#include "Vif.h"
#include "PsxCommon.h"
#include "VU.h"
#include "R3000A.h"
#include "PsxMem.h"
#include "ix86/ix86.h"
#include "iCore.h"
#include "iR3000A.h"
#include "PsxCounters.h"
u32 g_psxMaxRecMem = 0;
extern char *disRNameGPR[];

View File

@ -25,23 +25,10 @@
#include <assert.h>
#include <malloc.h>
#include "PS2Etypes.h"
#if defined(_WIN32)
#include <windows.h>
#endif
#include "System.h"
#include "Memory.h"
#include "Misc.h"
#include "Vif.h"
#include "PsxCommon.h"
#include "VU.h"
#include "R3000A.h"
#include "PsxMem.h"
#include "ix86/ix86.h"
#include "iCore.h"
#include "iR3000A.h"
@ -1855,7 +1842,7 @@ void (*rpsxBSC_co[64] )() = {
pinst->regs[reg] |= EEINST_LASTUSE; \
prev->regs[reg] |= EEINST_LIVE0|EEINST_USED; \
pinst->regs[reg] |= EEINST_USED; \
_recFillRegister(pinst, XMMTYPE_GPRREG, reg, 0); \
_recFillRegister(*pinst, XMMTYPE_GPRREG, reg, 0); \
} \
#define rpsxpropSetWrite(reg) { \
@ -1864,7 +1851,7 @@ void (*rpsxBSC_co[64] )() = {
pinst->regs[reg] |= EEINST_LASTUSE; \
pinst->regs[reg] |= EEINST_USED; \
prev->regs[reg] |= EEINST_USED; \
_recFillRegister(pinst, XMMTYPE_GPRREG, reg, 1); \
_recFillRegister(*pinst, XMMTYPE_GPRREG, reg, 1); \
}
void rpsxpropBSC(EEINST* prev, EEINST* pinst);

View File

@ -249,4 +249,54 @@ void rec##fn(void) \
int eeRecompileCodeXMM(int xmminfo);
void eeFPURecompileCode(R5900FNPTR_INFO xmmcode, R5900FNPTR fpucode, int xmminfo);
// For propagation of BSC stuff.
// Code implementations in ir5900tables.c
class BSCPropagate
{
protected:
EEINST& prev;
EEINST& pinst;
public:
BSCPropagate( EEINST& previous, EEINST& pinstance );
void rprop();
protected:
void rpropSPECIAL();
void rpropREGIMM();
void rpropCP0();
void rpropCP1();
void rpropCP2();
void rpropMMI();
void rpropMMI0();
void rpropMMI1();
void rpropMMI2();
void rpropMMI3();
void rpropSetRead( int reg, int mask );
void rpropSetFPURead( int reg, int mask );
void rpropSetWrite( int reg, int mask );
void rpropSetFPUWrite( int reg, int mask );
template< int mask >
void rpropSetRead( int reg );
template< int live >
void rpropSetWrite0( int reg, int mask );
void rpropSetFast( int write1, int read1, int read2, int mask );
template< int low, int hi >
void rpropSetLOHI( int write1, int read1, int read2, int mask );
template< int mask >
void rpropSetFPURead( int reg );
template< int live >
void rpropSetFPUWrite0( int reg, int mask );
};
#endif // __IR5900_H__

File diff suppressed because it is too large Load Diff

View File

@ -20,12 +20,11 @@
#include <assert.h>
#include <malloc.h>
#include "PS2Etypes.h"
#if defined(_WIN32)
#include <windows.h>
#endif
#include "PS2Etypes.h"
#include "System.h"
#include "R5900.h"
#include "Vif.h"

View File

@ -87,7 +87,6 @@ static u32 s_nNextBlock = 0; // next free block in recBlocks
extern void (*recBSC[64])();
extern void (*recBSC_co[64])();
void rpropBSC(EEINST* prev, EEINST* pinst);
// save states for branches
static u16 s_savex86FpuState, s_saveiCWstate;
@ -3013,7 +3012,9 @@ StartRecomp:
for(i = s_nEndBlock; i > startpc; i -= 4 ) {
cpuRegs.code = *(int *)PSM(i-4);
pcur[-1] = pcur[0];
rpropBSC(pcur-1, pcur);
BSCPropagate bsc( pcur[-1], pcur[0] );
bsc.rprop();
pcur--;
}
}

View File

@ -24,13 +24,16 @@ using namespace std;
#include "tinyxml/tinyxml.h"
#include "PS2Etypes.h"
#include "Patch.h"
#ifdef _MSC_VER
#pragma warning(disable:4996) //ignore the stricmp deprecated warning
#endif
#ifdef _WIN32
#include <windows.h>
#endif
extern void SysPrintf(const char *fmt, ...);
#if !defined(_WIN32) && !defined(__MINGW32__)