Fix Linux. Move most of the externs for functions in .S files in Linux to one header, and reenable using memcmp_mmx in Linux.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@638 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2009-03-01 04:28:17 +00:00
parent e87d55f153
commit 88f95dd22e
11 changed files with 93 additions and 76 deletions

View File

@ -25,13 +25,6 @@ typedef void *coroutine_t;
coroutine_t so_create(void (*func)(void *), void *data, void *stack, int size);
void so_delete(coroutine_t coro);
#ifdef __LINUX__
extern "C" {
#endif
void so_call(coroutine_t coro);
void so_resume(void);
void so_exit(void);
#ifdef __LINUX__
}
#endif
#endif
#include "NakedAsm.h"
#endif

View File

@ -22,7 +22,7 @@
#include <time.h>
#include <sys/time.h>
#include "cdvd.h"
#include "CDVD.h"
void InitCPUTicks()
{

View File

@ -18,6 +18,6 @@ CDVD.h CDVDiso.h CDVDisodrv.h CDVDlib.h COP0.h Cache.h CdRom.h Common.h Counters
Elfheader.h Exceptions.h GS.h Hw.h IopBios.h IopBios2.h IopCounters.h IopDma.h IopHw.h IopMem.h IopSio2.h Memcpyfast.h \
Memory.h MemoryCard.h Misc.h Patch.h Paths.h Plugins.h PrecompiledHeader.h PsxCommon.h R3000A.h R5900.h R5900OpcodeTables.h \
SPR.h SamplProf.h SaveState.h Sif.h Sifcmd.h Sio.h SafeArray.h Stats.h StringUtils.h System.h Threading.h \
VU.h VUflags.h VUmicro.h VUops.h Vif.h VifDma.h cheatscpp.h vtlb.h
VU.h VUflags.h VUmicro.h VUops.h Vif.h VifDma.h cheatscpp.h vtlb.h NakedAsm.h
SUBDIRS = x86 . DebugTools IPU RDebug tinyxml Linux

View File

@ -52,8 +52,9 @@ void _memset16_unaligned( void* dest, u16 data, size_t size );
#endif
#ifndef __LINUX__
extern u8 memcmp_mmx(const void* src1, const void* src2, int cmpsize);
extern void memxor_mmx(void* dst, const void* src1, int cmpsize);
#endif
#endif

View File

@ -211,8 +211,8 @@ void SetCPUState(u32 sseMXCSR, u32 sseVUMXCSR);
// when using mmx/xmm regs, use; 0 is load
// freezes no matter the state
extern void FreezeXMMRegs_(int save);
extern void FreezeMMXRegs_(int save);
extern "C" void FreezeXMMRegs_(int save);
extern "C" void FreezeMMXRegs_(int save);
extern bool g_EEFreezeRegs;
extern u8 g_globalMMXSaved;
extern u8 g_globalXMMSaved;

66
pcsx2/NakedAsm.h Normal file
View File

@ -0,0 +1,66 @@
/* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2002-2009 Pcsx2 Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
// Externs for various routines that are defined in assembly files on Linux.
#ifndef NAKED_ASM_H
#define NAKED_ASM_H
#include "coroutine.h"
// Common to Windows and Linux
extern "C"
{
// acoroutine.S
void so_call(coroutine_t coro);
void so_resume(void);
void so_exit(void);
// I can't find where the Linux recRecompile is defined. Is it used anymore?
// If so, namespacing might break it. :/ (air)
void recRecompile( u32 startpc );
// aR3000A.S
void psxRecRecompile(u32 startpc);
}
// Linux specific
#ifdef __LINUX__
extern "C"
{
// aVUzerorec.S
void* SuperVUGetProgram(u32 startpc, int vuindex);
void SuperVUCleanupProgram(u32 startpc, int vuindex);
void svudispfn();
// aR3000A.S
void psxDispatcher();
void psxDispatcherClear();
void psxDispatcherReg();
// aR5900-32.S
void Dispatcher();
void DispatcherClear();
void DispatcherReg();
// fast_routines.S
u8 memcmp_mmx(const void* src1, const void* src2, int cmpsize);
void memxor_mmx(void* dst, const void* src1, int cmpsize);
}
#endif
#endif

View File

@ -864,6 +864,10 @@
RelativePath="..\..\Misc.h"
>
</File>
<File
RelativePath="..\..\NakedAsm.h"
>
</File>
<File
RelativePath="..\..\Patch.cpp"
>

View File

@ -37,6 +37,7 @@
#include "iCore.h"
#include "SamplProf.h"
#include "NakedAsm.h"
extern u32 g_psxNextBranchCycle;
extern void psxBREAK();
@ -45,15 +46,6 @@ extern void zeroEx();
u32 g_psxMaxRecMem = 0;
u32 s_psxrecblocks[] = {0};
//Using assembly code from an external file.
#ifdef __LINUX__
extern "C" {
#endif
void psxRecRecompile(u32 startpc);
#ifdef __LINUX__
}
#endif
uptr *psxRecLUT;
#define PSX_NUMBLOCKS (1<<12)
@ -814,19 +806,6 @@ __declspec(naked) void psxDispatcherReg()
jmp eax
}
}
#else // _MSC_VER
// Linux uses an assembly version of these routines.
#ifdef __LINUX__
extern "C" {
#endif
void psxDispatcher();
void psxDispatcherClear();
void psxDispatcherReg();
#ifdef __LINUX__
}
#endif
#endif // _MSC_VER
static void recExecute()

View File

@ -40,6 +40,7 @@
#include "iVUzerorec.h"
#include "SamplProf.h"
#include "NakedAsm.h"
using namespace std;
@ -297,15 +298,6 @@ static u32 s_vu = 0;
static u32 s_UnconditionalDelay = 0; // 1 if there are two sequential branches and the last is unconditional
static u32 g_nLastBlockExecuted = 0;
// Global functions
#ifdef __LINUX__
extern "C" {
#endif
void* SuperVUGetProgram(u32 startpc, int vuindex);
void SuperVUCleanupProgram(u32 startpc, int vuindex);
#ifdef __LINUX__
}
#endif
static VuFunctionHeader* SuperVURecompileProgram(u32 startpc, int vuindex);
static VuBaseBlock* SuperVUBuildBlocks(VuBaseBlock* parent, u32 startpc, const VUPIPELINES& pipes);
static void SuperVUInitLiveness(VuBaseBlock* pblock);
@ -525,9 +517,7 @@ void SuperVUDumpBlock(list<VuBaseBlock*>& blocks, int vuindex)
u32 i;
Path::CreateDirectory( "dumps" );
ssprintf( filename, "svu%cdump%.4X.txt", s_vu?'0':'1', s_pFnHeader->startpc );
filename = Path::Combine( "dumps", filename );
ssprintf( filename, "dumps\\svu%cdump%.4X.txt", s_vu?'0':'1', s_pFnHeader->startpc );
//SysPrintf( "dump1 %x => %s\n", s_pFnHeader->startpc, filename );
@ -718,11 +708,12 @@ bool VuFunctionHeader::IsSame(void* pmem)
//if( checksum[0] != it->checksum[0] || checksum[1] != it->checksum[1] )
// return false;
// memcmp_mmx doesn't work on x86-64 machines
#if defined(_MSC_VER)
// and neither does pcsx2.
//#if defined(_MSC_VER)
if( memcmp_mmx((u8*)pmem+it->start, it->pmem, it->size) )
#else
if( memcmp((u8*)pmem+it->start, it->pmem, it->size) )
#endif
//#else
// if( memcmp((u8*)pmem+it->start, it->pmem, it->size) )
//#endif
return false;
}
#endif
@ -2512,13 +2503,6 @@ __declspec(naked) static void svudispfn()
mov s_saveebp, ebp
}
#else
#ifdef __LINUX__
extern "C" {
#endif
void svudispfn();
#ifdef __LINUX__
}
#endif
void svudispfntemp()
{

View File

@ -44,22 +44,14 @@
#include "SamplProf.h"
#include "Paths.h"
#include "NakedAsm.h"
using namespace R5900;
// used to disable register freezing during cpuBranchTests (registers
// are safe then since they've been completely flushed)
bool g_EEFreezeRegs = false;
// I can't find where the Linux recRecompile is defined. Is it used anymore?
// If so, namespacing might break it. :/ (air)
#ifdef __LINUX__
extern "C" {
#endif
void recRecompile( u32 startpc );
#ifdef __LINUX__
}
#endif
u32 maxrecmem = 0;
uptr *recLUT = NULL;
@ -811,12 +803,7 @@ static void recExecuteBlock()
}
#else // _MSC_VER
// Linux uses an assembly version of these routines.
extern "C" {
extern void Dispatcher();
extern void DispatcherClear();
extern void DispatcherReg();
}
__forceinline void recExecute()
{
// Optimization note : Compared pushad against manually pushing the regs one-by-one.

View File

@ -68,6 +68,8 @@ void SetCPUState(u32 sseMXCSR, u32 sseVUMXCSR)
/////////////////////////////////////////////////////////////////////
//
extern "C"
{
__forceinline void FreezeMMXRegs_(int save)
{
assert( g_EEFreezeRegs );
@ -224,3 +226,4 @@ __forceinline void FreezeXMMRegs_(int save)
#endif // _MSC_VER
}
}
}