Clean up Jakes commit in r634, and get rid of some dead code in the assembly files.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@635 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2009-03-01 01:03:16 +00:00
parent ebb5339418
commit 0acef23784
19 changed files with 27 additions and 306 deletions

View File

@ -6,13 +6,13 @@
# Uncomment if building by itself, rather then with all the plugins
#Normal
export PCSX2OPTIONS="--enable-sse3 --enable-sse4 --prefix `pwd`"
#export PCSX2OPTIONS="--enable-sse3 --enable-sse4 --prefix `pwd`"
#Optimized, but a devbuild
#export PCSX2OPTIONS="--enable-sse3 --enable-sse4 --enable-devbuild --prefix `pwd`"
#Debug / Devbuild version
#export PCSX2OPTIONS="--enable-debug --enable-devbuild --enable-sse3 --prefix `pwd`"
export PCSX2OPTIONS="--enable-debug --enable-devbuild --enable-sse3 --prefix `pwd`"
#ZeroGS Normal mode
export ZEROGSOPTIONS="--enable-sse2"

View File

@ -2045,7 +2045,7 @@ void cdvdWrite16(u8 rt) // SCOMMAND
break;
case 0x8E: // sceMgReadData
SetResultSize( min(16, cdvd.mg_size) );
SetResultSize( std::min(16, cdvd.mg_size) );
memcpy_fast(cdvd.Result, cdvd.mg_buffer, cdvd.ResultC);
cdvd.mg_size -= cdvd.ResultC;
memcpy_fast(cdvd.mg_buffer, cdvd.mg_buffer+cdvd.ResultC, cdvd.mg_size);

View File

@ -2,111 +2,6 @@
.extern g_pCurrentRoutine
#ifdef __x86_64__
#define FUNC_OFFSET 0
#define STACK_OFFSET 8
#define RBX_OFFSET 16
#define RBP_OFFSET 24
#define R12_OFFSET 32
#define R13_OFFSET 40
#define R14_OFFSET 48
#define R15_OFFSET 56
#define DATA_OFFSET 64
#define RESTORE_OFFSET 72
.globl so_call
so_call:
test dword ptr [%rdi+RESTORE_OFFSET], 1
jnz so_call_RestoreRegs
mov [%rdi+RBP_OFFSET], %rbp
mov [%rdi+RBX_OFFSET], %rbx
mov [%rdi+R12_OFFSET], %r12
mov [%rdi+R13_OFFSET], %r13
mov [%rdi+R14_OFFSET], %r14
mov [%rdi+R15_OFFSET], %r15
mov dword ptr [%rdi+RESTORE_OFFSET], 1
jmp so_call_CallFn
so_call_RestoreRegs:
// have to load and save at the same time
mov %rax, [%rdi+RBP_OFFSET]
mov %rcx, [%rdi+RBX_OFFSET]
mov %rdx, [%rdi+R12_OFFSET]
mov [%rdi+RBP_OFFSET], %rbp
mov [%rdi+RBX_OFFSET], %rbx
mov [%rdi+R12_OFFSET], %r12
mov %rbp, %rax
mov %rbx, %rcx
mov %r12, %rdx
mov %rax, [%rdi+R13_OFFSET]
mov %rcx, [%rdi+R14_OFFSET]
mov %rdx, [%rdi+R15_OFFSET]
mov [%rdi+R13_OFFSET], %r13
mov [%rdi+R14_OFFSET], %r14
mov [%rdi+R15_OFFSET], %r15
mov %r13, %rax
mov %r14, %rcx
mov %r15, %rdx
so_call_CallFn:
mov [g_pCurrentRoutine], %rdi
// swap the stack
mov %rax, [%rdi+STACK_OFFSET]
mov [%rdi+STACK_OFFSET], %rsp
mov %rsp, %rax
mov %rax, [%rdi+FUNC_OFFSET]
mov %rdi, [%rdi+DATA_OFFSET]
jmp %rax
.globl so_resume
so_resume:
mov %rdi, [g_pCurrentRoutine]
mov %rax, [%rdi+RBP_OFFSET]
mov %rcx, [%rdi+RBX_OFFSET]
mov %rdx, [%rdi+R12_OFFSET]
mov [%rdi+RBP_OFFSET], %rbp
mov [%rdi+RBX_OFFSET], %rbx
mov [%rdi+R12_OFFSET], %r12
mov %rbp, %rax
mov %rbx, %rcx
mov %r12, %rdx
mov %rax, [%rdi+R13_OFFSET]
mov %rcx, [%rdi+R14_OFFSET]
mov %rdx, [%rdi+R15_OFFSET]
mov [%rdi+R13_OFFSET], %r13
mov [%rdi+R14_OFFSET], %r14
mov [%rdi+R15_OFFSET], %r15
mov %r13, %rax
mov %r14, %rcx
mov %r15, %rdx
// put the return address in pcalladdr
mov %rsi, [%rsp]
mov [%rdi], %rsi
add %rsp, 8 // remove the return address
// swap stack pointers
mov %rax, [%rdi+STACK_OFFSET]
mov [%rdi+STACK_OFFSET], %rsp
mov %rsp, %rax
ret
.globl so_exit
so_exit:
mov %rdi, [g_pCurrentRoutine]
mov %rsp, [%rdi+STACK_OFFSET]
mov %rbp, [%rdi+RBP_OFFSET]
mov %rbx, [%rdi+RBX_OFFSET]
mov %r12, [%rdi+R12_OFFSET]
mov %r13, [%rdi+R13_OFFSET]
mov %r14, [%rdi+R14_OFFSET]
mov %r15, [%rdi+R15_OFFSET]
ret
#else
.globl so_call
so_call:
mov %eax, dword ptr [%esp+4]
@ -178,4 +73,3 @@ so_exit:
mov %ebp, [%eax+20]
ret
#endif

View File

@ -931,6 +931,6 @@ void SysMemProtect( void* baseaddr, size_t size, PageProtectionMode mode, bool a
case Protect_ReadWrite: lnxmode = PROT_READ | PROT_WRITE; break;
}
if( allowExecution ) lnxmode |= PROT_EXECUTE;
if( allowExecution ) lnxmode |= PROT_EXEC;
mprotect( baseaddr, size, lnxmode );
}

View File

@ -37,7 +37,7 @@ void OnConf_Memcards(GtkMenuItem *menuitem, gpointer user_data)
set_checked(MemDlg, "check_enable_mcd2", Config.Mcd[1].Enabled);
set_checked(MemDlg, "check_eject_mcds", Config.McdEnableEject);
getcwd(file, ARRAYSIZE(file)); /* store current dir */
getcwd(file, ArraySize(file)); /* store current dir */
sprintf(card, "%s/%s", file, MEMCARDS_DIR );
chdir(card); /* change dirs so that plugins can find their config file*/

View File

@ -126,7 +126,7 @@ void loadBiosRom( const char *ext, u8 *dest, long maxSize )
// if we made it this far, we have a successful file found:
FILE *fp = fopen(Bios1.c_str(), "rb");
fread(dest, 1, min( maxSize, filesize ), fp);
fread(dest, 1, std::min( maxSize, filesize ), fp);
fclose(fp);
}
@ -807,7 +807,7 @@ void memReset()
}
fp = fopen(Bios.c_str(), "rb");
fread(PS2MEM_ROM, 1, min( (long)Ps2MemSize::Rom, filesize ), fp);
fread(PS2MEM_ROM, 1, std::min( (long)Ps2MemSize::Rom, filesize ), fp);
fclose(fp);
BiosVersion = GetBiosVersion();

View File

@ -17,31 +17,6 @@
// SuperVUExecuteProgram(u32 startpc, int vuindex)
.globl SuperVUExecuteProgram
SuperVUExecuteProgram:
#ifdef __x86_64__
mov %rax, [%rsp]
mov dword ptr [s_TotalVUCycles], 0
add %rsp, 8
mov [s_callstack], %rax
call SuperVUGetProgram
push %rbp
push %rbx
push %r12
push %r13
push %r14
push %r15
// function arguments
push %rdi
push %rsi
#ifdef _DEBUG
mov s_vu1esp, %rsp
#endif
ldmxcsr g_sseVUMXCSR
mov dword ptr [s_writeQ], 0xffffffff
mov dword ptr [s_writeP], 0xffffffff
jmp %rax
#else
mov %eax, [%esp]
mov dword ptr s_TotalVUCycles, 0
add %esp, 4
@ -59,30 +34,11 @@ SuperVUExecuteProgram:
mov dword ptr s_writeQ, 0xffffffff
mov dword ptr s_writeP, 0xffffffff
jmp %eax
#endif // __x86_64__
.globl SuperVUEndProgram
SuperVUEndProgram:
// restore cpu state
ldmxcsr g_sseMXCSR
#ifdef __x86_64__
#ifdef _DEBUG
sub s_vu1esp, %rsp
#endif
// function arguments for SuperVUCleanupProgram
pop %rsi
pop %rdi
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbx
pop %rbp
#else
// restore cpu state
ldmxcsr g_sseMXCSR
mov %ebp, s_vu1ebp
mov %esi, s_vu1esi
mov %edi, s_vuedi
@ -90,7 +46,6 @@ SuperVUEndProgram:
#ifdef _DEBUG
sub s_vu1esp, %esp
#endif
#endif
call SuperVUCleanupProgram
@ -99,42 +54,6 @@ SuperVUEndProgram:
.globl svudispfn
svudispfn:
#ifdef __x86_64__
mov [g_curdebugvu], %rax
push %rax
push %rcx
push %rdx
push %rbp
push %rsi
push %rdi
push %rbx
push %r8
push %r9
push %r10
push %r11
push %r12
push %r13
push %r14
push %r15
call svudispfntemp
pop %r15
pop %r14
pop %r13
pop %r12
pop %r11
pop %r10
pop %r9
pop %r8
pop %rbx
pop %rdi
pop %rsi
pop %rbp
pop %rdx
pop %rcx
pop %rax
#else
mov [g_curdebugvu], %eax
mov s_saveecx, %ecx
mov s_saveedx, %edx
@ -151,5 +70,4 @@ svudispfn:
mov %esi, s_saveesi
mov %edi, s_saveedi
mov %ebp, s_saveebp
#endif
ret

View File

@ -22,16 +22,6 @@
.extern _vifMaskRegs
.extern _vifRow
#ifdef __x86_64__
#define VIF_ESP %rsp
#define VIF_SRC %rsi
#define VIF_INC %rcx
#define VIF_DST %rdi
#define VIF_SIZE %edx
#define VIF_TMPADDR %rax
#define VIF_SAVEEBX %r8
#define VIF_SAVEEBXd %r8d
#else
#define VIF_ESP %esp
#define VIF_SRC %esi
#define VIF_INC %ecx
@ -40,7 +30,6 @@
#define VIF_TMPADDR %eax
#define VIF_SAVEEBX %ebx
#define VIF_SAVEEBXd %ebx
#endif
#define XMM_R0 %xmm0
#define XMM_R1 %xmm1
@ -1336,15 +1325,6 @@
#define SAVE_NO_REG
#ifdef __x86_64__
#define INIT_ARGS()
#define POP_REGS()
#define INC_STACK(reg) add %rsp, 8;
#else
// 32 bit versions have the args on the stack
#define INIT_ARGS() \
push %edi; \
@ -1362,8 +1342,6 @@
#define INC_STACK(reg) add %esp, 4;
#endif
// qsize - bytes of compressed size of 1 decompressed xmmword
// int UNPACK_SkippingWrite_##name##_##sign##_##MaskType##_##ModeType(u32* dest, u32* data, int dmasize)

View File

@ -27,19 +27,12 @@
// ~10 times faster than standard memcmp
// (zerofrog)
// u8 memcmp_mmx(const void* src1, const void* src2, int cmpsize)
#ifdef __x86_64__
#define MEMCMP_SRC1 %rdi
#define MEMCMP_SRC2 %rsi
#define MEMCMP_SIZE %edx
#else
#define MEMCMP_SRC1 %edx
#define MEMCMP_SRC2 %esi
#define MEMCMP_SIZE %ecx
#endif
.globl memcmp_mmx
memcmp_mmx:
#ifndef __x86_64__
// make sure mmx regs are stored
// FreezeMMXRegs(1);
cmp dword ptr [g_EEFreezeRegs], 0
@ -53,7 +46,6 @@ memcmp_mmx_begin:
mov MEMCMP_SRC1, dword ptr [%esp+8]
mov MEMCMP_SRC2, dword ptr [%esp+12]
mov MEMCMP_SIZE, dword ptr [%esp+16]
#endif
cmp MEMCMP_SIZE, 32
jl memcmp_Done4
@ -222,19 +214,12 @@ memcmp_End:
ret
// memxor_mmx
#ifdef __x86_64__
#define MEMXOR_SRC1 %rdi
#define MEMXOR_SRC2 %rsi
#define MEMXOR_SIZE %edx
#else
#define MEMXOR_SRC1 %edx
#define MEMXOR_SRC2 %esi
#define MEMXOR_SIZE %ecx
#endif
.globl memxor_mmx
memxor_mmx:
#ifndef __x86_64__
// make sure mmx regs are stored
// FreezeMMXRegs(1);
cmp dword ptr [g_EEFreezeRegs], 0
@ -248,7 +233,6 @@ memxor_mmx_begin:
mov MEMXOR_SRC1, dword ptr [%esp+8]
mov MEMXOR_SRC2, dword ptr [%esp+12]
mov MEMXOR_SIZE, dword ptr [%esp+16]
#endif
cmp MEMXOR_SIZE, 64
jl memxor_Setup4
@ -343,7 +327,5 @@ memxor_Setup1:
movq [MEMXOR_SRC1], %mm0
memxor_End:
emms
#ifndef __x86_64__
pop %esi
#endif
ret

View File

@ -23,6 +23,7 @@
#include "PrecompiledHeader.h"
#include "iR3000A.h"
#include <time.h>
#ifndef _WIN32
@ -34,7 +35,6 @@
#include "ix86/ix86.h"
#include "iCore.h"
#include "iR3000A.h"
#include "SamplProf.h"
@ -1459,7 +1459,7 @@ StartRecomp:
AddBaseBlockEx(s_pCurBlockEx, 1);
if( !(psxpc&0x10000000) )
g_psxMaxRecMem = max( (psxpc&~0xa0000000), g_psxMaxRecMem );
g_psxMaxRecMem = std::max( (psxpc&~0xa0000000), g_psxMaxRecMem );
if( psxbranch == 2 ) {
_psxFlushCall(FLUSH_EVERYTHING);

View File

@ -4,9 +4,6 @@
.extern cpuRegs
.extern recRecompile
//.extern recLUT
.extern lbase
.extern s_pCurBlock_ltime
#define BLOCKTYPE_STARTPC 4 // startpc offset
#define BLOCKTYPE_DELAYSLOT 1 // if bit set, delay slot
@ -170,41 +167,3 @@ DispatcherReg_CallFn:
//and %eax, 0x0fffffff
shl %eax, 4
jmp %eax
.globl _StartPerfCounter
_StartPerfCounter:
push %eax
push %ebx
push %ecx
rdtsc
mov dword ptr [lbase], %eax
mov dword ptr [lbase + 4], %edx
pop %ecx
pop %ebx
pop %eax
ret
.globl _StopPerfCounter
_StopPerfCounter:
push %eax
push %ebx
push %ecx
rdtsc
sub %eax, dword ptr [lbase]
sbb %edx, dword ptr [lbase + 4]
mov %ecx, s_pCurBlock_ltime
add %eax, dword ptr [%ecx]
adc %edx, dword ptr [%ecx + 4]
mov dword ptr [%ecx], %eax
mov dword ptr [%ecx + 4], %edx
pop %ecx
pop %ebx
pop %eax
ret

View File

@ -171,16 +171,6 @@ extern u32 *j32Ptr[32];
#define RexRB(w, reg, base) if( w||(reg) >= 8 || (base)>=8 ) assert(0);
#define RexRXB(w, reg, index, base) if( w||(reg) >= 8 || (index) >= 8 || (base) >= 8 ) assert(0);
// perf counters
#ifdef PCSX2_DEVBUILD
extern void StartPerfCounter();
extern void StopPerfCounter();
#else
#define StartPerfCounter()
#define StopPerfCounter()
#endif
extern __forceinline void write8( u8 val );
extern __forceinline void write16( u16 val );
extern __forceinline void write32( u32 val );

View File

@ -69,7 +69,7 @@ void ExecCfg(char *arg)
void CDVDconfigure()
{
char *file;
getcwd(file, ARRAYSIZE(file));
getcwd(file, ArraySize(file));
chdir("plugins");
ExecCfg("configure");
chdir(file);
@ -78,7 +78,7 @@ void CDVDconfigure()
void CDVDabout()
{
char *file;
getcwd(file, ARRAYSIZE(file));
getcwd(file, ArraySize(file));
chdir("plugins");
ExecCfg("about");
chdir(file);
@ -87,7 +87,7 @@ void CDVDabout()
void CfgOpenFile()
{
char *file;
getcwd(file, ARRAYSIZE(file));
getcwd(file, ArraySize(file));
chdir("plugins");
ExecCfg("open");
chdir(file);

View File

@ -81,7 +81,7 @@ void SysMessage(char *fmt, ...)
void FWconfigure()
{
char *file;
getcwd(file, ARRAYSIZE(file));
getcwd(file, ArraySize(file));
chdir("plugins");
ExecCfg("configure");
chdir(file);
@ -90,7 +90,7 @@ void FWconfigure()
void FWabout()
{
char *file;
getcwd(file, ARRAYSIZE(file));
getcwd(file, ArraySize(file));
chdir("plugins");
ExecCfg("about");
chdir(file);

View File

@ -128,7 +128,7 @@ s32 CALLBACK SPU2init() {
voices[i+24].memoffset = 0x400;
// init each channel
for(u32 i = 0; i < ARRAYSIZE(voices); ++i) {
for(u32 i = 0; i < ArraySize(voices); ++i) {
voices[i].pLoop = voices[i].pStart = voices[i].pCurr = (u8*)spu2mem;

View File

@ -120,7 +120,7 @@ void __forceinline KICK_VERTEX3()
{
/* tri fans need special processing */
if (gs.nTriFanVert == gs.primIndex)
gs.primIndex = (gs.primIndex+1)%ARRAYSIZE(gs.gsvertex);
gs.primIndex = (gs.primIndex+1)%ArraySize(gs.gsvertex);
}
}
}
@ -132,7 +132,7 @@ void __fastcall GIFPackedRegHandlerXYZF2(u32* data)
gs.vertexregs.z = (data[2] >> 4) & 0xffffff;
gs.vertexregs.f = (data[3] >> 4) & 0xff;
gs.gsvertex[gs.primIndex] = gs.vertexregs;
gs.primIndex = (gs.primIndex+1)%ARRAYSIZE(gs.gsvertex);
gs.primIndex = (gs.primIndex+1)%ArraySize(gs.gsvertex);
if( data[3] & 0x8000 ) {
KICK_VERTEX3();
@ -148,7 +148,7 @@ void __fastcall GIFPackedRegHandlerXYZ2(u32* data)
gs.vertexregs.y = (data[1] >> 0) & 0xffff;
gs.vertexregs.z = data[2];
gs.gsvertex[gs.primIndex] = gs.vertexregs;
gs.primIndex = (gs.primIndex+1)%ARRAYSIZE(gs.gsvertex);
gs.primIndex = (gs.primIndex+1)%ArraySize(gs.gsvertex);
if( data[3] & 0x8000 ) {
KICK_VERTEX3();

View File

@ -23,8 +23,8 @@ using namespace std;
char* srcfilename = "ps2hw.fx";
char* dstfilename = "ps2hw.dat";
#ifndef ARRAYSIZE
#define ARRAYSIZE(x) (sizeof(x) / sizeof((x)[0]))
#ifndef ArraySize
#define ArraySize(x) (sizeof(x) / sizeof((x)[0]))
#endif
struct SHADERINFO
@ -168,7 +168,7 @@ int main(int argc, char** argv)
strdir[i] = 0;
for(i = 0; i < ARRAYSIZE(vsshaders); ++i) {
for(i = 0; i < ArraySize(vsshaders); ++i) {
for(int writedepth = 0; writedepth < 2; ++writedepth ) {
if( writedepth ) vmacros.push_back("-DWRITE_DEPTH");
@ -181,7 +181,7 @@ int main(int argc, char** argv)
const int psshaders[2] = { SH_REGULARPS, SH_REGULARFOGPS };
const char* ppsshaders[2] = { "RegularPS", "RegularFogPS" };
for(i = 0; i < ARRAYSIZE(psshaders); ++i) {
for(i = 0; i < ArraySize(psshaders); ++i) {
for(int writedepth = 0; writedepth < 2; ++writedepth ) {
if( writedepth ) vmacros.push_back("-DWRITE_DEPTH");
LoadShader(psshaders[i]|(writedepth?SH_WRITEDEPTH:0), ppsshaders[i], cgfProf, vmacros, 0);

View File

@ -26,8 +26,8 @@
#define __LINUX__
#endif
#ifndef ARRAYSIZE
#define ARRAYSIZE(x) (sizeof(x)/sizeof((x)[0]))
#ifndef ArraySize
#define ArraySize(x) (sizeof(x)/sizeof((x)[0]))
#endif
#ifdef __LINUX__

View File

@ -415,7 +415,7 @@ void UpdateConf(int pad)
int i;
GtkWidget *Btn;
for (i=0; i<ARRAYSIZE(s_pGuiKeyMap); i++) {
for (i=0; i<ArraySize(s_pGuiKeyMap); i++) {
if( s_pGuiKeyMap[i] == NULL )
continue;