This commit is contained in:
ramapcsx2 2014-07-16 12:32:51 +02:00
commit d6b042f9fe
25 changed files with 153 additions and 72 deletions

View File

@ -92,7 +92,10 @@ if(_ARCH_64 AND 64BIT_BUILD)
endif()
set(ARCH_FLAG "-m64 -msse -msse2")
add_definitions(-D_ARCH_64=1)
add_definitions(-D_ARCH_64=1 -D_M_X86=1 -D_M_X86_64=1)
set(_ARCH_64 1)
set(_M_X86 1)
set(_M_X86_64 1)
else()
message("Compiling 32bit build on 32/64bit architecture")
# Do not search library in /usr/lib64
@ -110,7 +113,10 @@ else()
endif()
set(ARCH_FLAG "-m32 -msse -msse2 -march=i686")
add_definitions(-D_ARCH_32=1)
add_definitions(-D_ARCH_32=1 -D_M_X86=1 -D_M_X86_32=1)
set(_ARCH_32 1)
set(_M_X86 1)
set(_M_X86_32 1)
endif()
# * -fPIC option was removed for multiple reasons.

View File

@ -343,14 +343,17 @@ public:
/// This method has been optimized to give typical 32 bit pointers a reasonably
/// wide spread across the integer spectrum.
/// Note:
/// This method is optimized for 32 bit pointers only. 64 bit pointer support
/// has not been implemented, and thus on 64 bit platforms performance could be poor or,
/// worse yet, results may not have a high degree of uniqueness.
/// This method is optimized for 32 bit pointers only.
/// 64 bit pointer support is implemented but not optimized.
/// </remarks>
hash_key_t operator()( const void* addr ) const
{
#ifdef _ARCH_64
return GetCommonHash((u64)addr);
#else
hash_key_t key = (hash_key_t) addr;
return (hash_key_t)((key >> 3) * 2654435761ul);
#endif
}

View File

@ -442,7 +442,7 @@ extern void AND8RtoR( x86IntRegType to, x86IntRegType from );
// not r32
extern void NOT32R( x86IntRegType from );
// not m32
extern void NOT32M( u32 from );
extern void NOT32M( uptr from );
// neg r32
extern void NEG32R( x86IntRegType from );
// neg m32

View File

@ -126,7 +126,12 @@ __emitinline void xJccKnownTarget( JccComparisonType comparison, const void* tar
{
// Perform a 32 bit jump instead. :(
s32* bah = xJcc32( comparison );
*bah = (s32)target - (s32)xGetPtr();
sptr distance = (sptr)target - (sptr)xGetPtr();
// This assert won't physically happen on x86 targets
pxAssertDev(distance >= -0x80000000LL && distance < 0x80000000LL, "Jump target is too far away, needs an indirect register");
*bah = (s32)distance;
}
}

View File

@ -20,17 +20,11 @@
!define INC_CRT_2013 1
!endif
!ifndef INC_AVG
; We are including the AVG SafeGuard with the full installer.
!define INC_AVG 1
!endif
ShowInstDetails nevershow
ShowUninstDetails nevershow
!define OUTFILE_POSTFIX "setup"
!include "SharedBase.nsh"
!include "AVGPage.nsdinc"
!include "x64.nsh"
; Reserve features for improved performance with solid archiving.
@ -39,7 +33,6 @@ ShowUninstDetails nevershow
;!insertmacro MUI_RESERVEFILE_LANGDLL
!insertmacro MUI_PAGE_COMPONENTS
Page custom fnc_AVGPage_Show
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

View File

@ -332,8 +332,8 @@ namespace Interpreter {
namespace OpcodeImpl {
namespace COP0 {
void TLBR() {
DevCon.Warning("COP0_TLBR %d:%x,%x,%x,%x\n",
void TLBR() {
DevCon.Warning("COP0_TLBR %d:%x,%x,%x,%x\n",
cpuRegs.CP0.n.Index, cpuRegs.CP0.n.PageMask, cpuRegs.CP0.n.EntryHi,
cpuRegs.CP0.n.EntryLo0, cpuRegs.CP0.n.EntryLo1);

View File

@ -27,6 +27,10 @@
#include "../IopMem.h"
#include "SymbolMap.h"
#ifdef _WIN32
#include <Windows.h>
#endif
extern AppCoreThread CoreThread;
R5900DebugInterface r5900Debug;
@ -204,25 +208,48 @@ bool DebugInterface::parseExpression(PostfixExpression& exp, u64& dest)
// R5900DebugInterface
//
u32 R5900DebugInterface::read8(u32 address)
u32 R5900DebugInterface::readMemory(u32 address, u32 size)
{
if (!isValidAddress(address))
return -1;
return memRead8(address);
// TODO: Add linux variant of the following __try/__except
#if defined(_MSC_VER)
__try
{
#endif
switch (size)
{
case 1:
return memRead8(address);
case 2:
return memRead16(address);
case 4:
return memRead32(address);
default:
return -1;
}
#if defined(_MSC_VER)
} __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
{
return -1;
}
#endif
}
u32 R5900DebugInterface::read8(u32 address)
{
return readMemory(address,1);
}
u32 R5900DebugInterface::read16(u32 address)
{
if (!isValidAddress(address))
return -1;
return memRead16(address);
return readMemory(address,2);
}
u32 R5900DebugInterface::read32(u32 address)
{
if (!isValidAddress(address))
return -1;
return memRead32(address);
return readMemory(address,4);
}
u64 R5900DebugInterface::read64(u32 address)
@ -231,7 +258,19 @@ u64 R5900DebugInterface::read64(u32 address)
return -1;
u64 result;
memRead64(address,result);
// TODO: Add linux variant of the following __try/__except
#if defined(_MSC_VER)
__try {
#endif
memRead64(address,result);
#if defined(_MSC_VER)
} __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
{
result = -1;
}
#endif
return result;
}
@ -240,8 +279,20 @@ u128 R5900DebugInterface::read128(u32 address)
if (!isValidAddress(address))
return u128::From32(-1);
u128 result;
memRead128(address,result);
__aligned16 u128 result;
// TODO: Add linux variant of the following __try/__except
#if defined(_MSC_VER)
__try {
#endif
memRead128(address,result);
#if defined(_MSC_VER)
} __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
{
result.hi = result.lo = -1;
}
#endif
return result;
}

View File

@ -84,6 +84,8 @@ public:
virtual std::string disasm(u32 address);
virtual bool isValidAddress(u32 address);
virtual u32 getCycles();
private:
u32 readMemory(u32 address, u32 size);
};

View File

@ -337,6 +337,9 @@ namespace MIPSAnalyst
case 0x2C: // sdl
size = 8;
off = -7;
case 0x1E: // lq
case 0x1F: // sq
size = 16;
break;
}

View File

@ -58,6 +58,7 @@ void yuv2rgb_reference(void)
}
}
#ifdef _M_X86_32
// Everything below is bit accurate to the IPU specification (except maybe rounding).
// Know the specification before you touch it.
#define SSE_BYTES(x) {x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x}
@ -403,3 +404,4 @@ ihatemsvc:
# error Unsupported compiler
#endif
}
#endif

View File

@ -15,7 +15,10 @@
#pragma once
#define yuv2rgb yuv2rgb_sse2
extern void yuv2rgb_reference();
#ifdef _M_X86_32
#define yuv2rgb yuv2rgb_sse2
extern void yuv2rgb_sse2();
#else
#define yuv2rgb yuv2rgb_reference
#endif

View File

@ -757,14 +757,14 @@ void Pcsx2App::enterDebugMode()
{
DisassemblyDialog* dlg = GetDisassemblyPtr();
if (dlg)
dlg->setDebugMode(true);
dlg->setDebugMode(true,false);
}
void Pcsx2App::leaveDebugMode()
{
DisassemblyDialog* dlg = GetDisassemblyPtr();
if (dlg)
dlg->setDebugMode(false);
dlg->setDebugMode(false,false);
}
void Pcsx2App::resetDebugger()

View File

@ -811,7 +811,7 @@ void CtrlDisassemblyView::updateStatusBarText()
}
case 16:
{
u128 data = cpu->read128(line.info.dataAddress);
__aligned16 u128 data = cpu->read128(line.info.dataAddress);
sprintf(text,"[%08X] = %016llX%016llX",line.info.dataAddress,data._u64[1],data._u64[0]);
break;
}

View File

@ -170,7 +170,7 @@ DisassemblyDialog::DisassemblyDialog(wxWindow* parent):
SetMinSize(wxSize(1000,600));
panel->GetSizer()->Fit(this);
setDebugMode(true);
setDebugMode(true,true);
}
#ifdef WIN32
@ -212,8 +212,10 @@ void DisassemblyDialog::onBreakRunClicked(wxCommandEvent& evt)
// If the current PC is on a breakpoint, the user doesn't want to do nothing.
CBreakPoints::SetSkipFirst(r5900Debug.getPC());
r5900Debug.resumeCpu();
} else
} else {
r5900Debug.pauseCpu();
gotoPc();
}
}
void DisassemblyDialog::onStepOverClicked(wxCommandEvent& evt)
@ -352,7 +354,9 @@ void DisassemblyDialog::onDebuggerEvent(wxCommandEvent& evt)
wxEventType type = evt.GetEventType();
if (type == debEVT_SETSTATUSBARTEXT)
{
GetStatusBar()->SetLabel(evt.GetString());
CtrlDisassemblyView* view = reinterpret_cast<CtrlDisassemblyView*>(evt.GetEventObject());
if (view != NULL && view == currentCpu->getDisassembly())
GetStatusBar()->SetLabel(evt.GetString());
} else if (type == debEVT_UPDATELAYOUT)
{
if (currentCpu != NULL)
@ -420,7 +424,13 @@ void DisassemblyDialog::reset()
iopTab->getDisassembly()->clearFunctions();
};
void DisassemblyDialog::setDebugMode(bool debugMode)
void DisassemblyDialog::gotoPc()
{
eeTab->getDisassembly()->gotoPc();
iopTab->getDisassembly()->gotoPc();
}
void DisassemblyDialog::setDebugMode(bool debugMode, bool switchPC)
{
bool running = r5900Debug.isAlive();
@ -437,8 +447,8 @@ void DisassemblyDialog::setDebugMode(bool debugMode)
stepOverButton->Enable(true);
stepIntoButton->Enable(true);
eeTab->getDisassembly()->gotoPc();
iopTab->getDisassembly()->gotoPc();
if (switchPC || CBreakPoints::GetBreakpointTriggered())
gotoPc();
if (CBreakPoints::GetBreakpointTriggered())
{

View File

@ -62,7 +62,7 @@ public:
void update();
void reset();
void setDebugMode(bool debugMode);
void setDebugMode(bool debugMode, bool switchPC);
#ifdef WIN32
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
@ -79,6 +79,7 @@ protected:
void onClose(wxCloseEvent& evt);
void stepOver();
void stepInto();
void gotoPc();
private:
CpuTabPage* eeTab;
CpuTabPage* iopTab;

View File

@ -193,7 +193,7 @@ void FirstTimeWizard::OnPageChanging( wxWizardEvent& evt )
{
if( evt.GetPage() == NULL ) return; // safety valve!
int page = (int)evt.GetPage()->GetClientData();
sptr page = (sptr)evt.GetPage()->GetClientData();
if( evt.GetDirection() )
{

View File

@ -139,7 +139,7 @@ void Panels::BiosSelectorPanel::Apply()
) );
}
g_Conf->BaseFilenames.Bios = (*m_BiosList)[(int)m_ComboBox->GetClientData(sel)];
g_Conf->BaseFilenames.Bios = (*m_BiosList)[(sptr)m_ComboBox->GetClientData(sel)];
}
void Panels::BiosSelectorPanel::AppStatusEvent_OnSettingsApplied()

View File

@ -96,8 +96,8 @@ template< typename DataType >
DataType __fastcall vtlb_memRead(u32 addr)
{
static const uint DataSize = sizeof(DataType) * 8;
u32 vmv=vtlbdata.vmap[addr>>VTLB_PAGE_BITS];
s32 ppf=addr+vmv;
uptr vmv=vtlbdata.vmap[addr>>VTLB_PAGE_BITS];
sptr ppf=addr+vmv;
if (!(ppf<0))
{
@ -151,8 +151,8 @@ DataType __fastcall vtlb_memRead(u32 addr)
void __fastcall vtlb_memRead64(u32 mem, mem64_t *out)
{
u32 vmv=vtlbdata.vmap[mem>>VTLB_PAGE_BITS];
s32 ppf=mem+vmv;
uptr vmv=vtlbdata.vmap[mem>>VTLB_PAGE_BITS];
sptr ppf=mem+vmv;
if (!(ppf<0))
{
@ -178,8 +178,8 @@ void __fastcall vtlb_memRead64(u32 mem, mem64_t *out)
}
void __fastcall vtlb_memRead128(u32 mem, mem128_t *out)
{
u32 vmv=vtlbdata.vmap[mem>>VTLB_PAGE_BITS];
s32 ppf=mem+vmv;
uptr vmv=vtlbdata.vmap[mem>>VTLB_PAGE_BITS];
sptr ppf=mem+vmv;
if (!(ppf<0))
{
@ -211,8 +211,8 @@ void __fastcall vtlb_memWrite(u32 addr, DataType data)
{
static const uint DataSize = sizeof(DataType) * 8;
u32 vmv=vtlbdata.vmap[addr>>VTLB_PAGE_BITS];
s32 ppf=addr+vmv;
uptr vmv=vtlbdata.vmap[addr>>VTLB_PAGE_BITS];
sptr ppf=addr+vmv;
if (!(ppf<0))
{
if (!CHECK_EEREC)
@ -259,8 +259,8 @@ void __fastcall vtlb_memWrite(u32 addr, DataType data)
void __fastcall vtlb_memWrite64(u32 mem, const mem64_t* value)
{
u32 vmv=vtlbdata.vmap[mem>>VTLB_PAGE_BITS];
s32 ppf=mem+vmv;
uptr vmv=vtlbdata.vmap[mem>>VTLB_PAGE_BITS];
sptr ppf=mem+vmv;
if (!(ppf<0))
{
if (!CHECK_EEREC)
@ -287,8 +287,8 @@ void __fastcall vtlb_memWrite64(u32 mem, const mem64_t* value)
void __fastcall vtlb_memWrite128(u32 mem, const mem128_t *value)
{
u32 vmv=vtlbdata.vmap[mem>>VTLB_PAGE_BITS];
s32 ppf=mem+vmv;
uptr vmv=vtlbdata.vmap[mem>>VTLB_PAGE_BITS];
sptr ppf=mem+vmv;
if (!(ppf<0))
{
if (!CHECK_EEREC)
@ -573,14 +573,14 @@ void vtlb_MapBlock(void* base, u32 start, u32 size, u32 blocksize)
verify(0==(blocksize&VTLB_PAGE_MASK) && blocksize>0);
verify(0==(size%blocksize));
s32 baseint = (s32)base;
sptr baseint = (sptr)base;
u32 end = start + (size - VTLB_PAGE_SIZE);
verify((end>>VTLB_PAGE_BITS) < ArraySize(vtlbdata.pmap));
while (start <= end)
{
u32 loopsz = blocksize;
s32 ptr = baseint;
sptr ptr = baseint;
while (loopsz > 0)
{
@ -668,7 +668,7 @@ void vtlb_VMapBuffer(u32 vaddr,void* buffer,u32 size)
verify(0==(vaddr&VTLB_PAGE_MASK));
verify(0==(size&VTLB_PAGE_MASK) && size>0);
u32 bu8 = (u32)buffer;
uptr bu8 = (uptr)buffer;
while (size > 0)
{
vtlbdata.vmap[vaddr>>VTLB_PAGE_BITS] = bu8-vaddr;
@ -764,7 +764,7 @@ void vtlb_Core_Alloc()
{
if (!vtlbdata.vmap)
{
vtlbdata.vmap = (s32*)_aligned_malloc( VTLB_VMAP_ITEMS * sizeof(*vtlbdata.vmap), 16 );
vtlbdata.vmap = (sptr*)_aligned_malloc( VTLB_VMAP_ITEMS * sizeof(*vtlbdata.vmap), 16 );
if (!vtlbdata.vmap)
throw Exception::OutOfMemory( L"VTLB Virtual Address Translation LUT" )
.SetDiagMsg(pxsFmt("(%u megs)", VTLB_VMAP_ITEMS * sizeof(*vtlbdata.vmap) / _1mb)

View File

@ -197,11 +197,11 @@ namespace vtlb_private
// third indexer -- 128 possible handlers!
void* RWFT[5][2][VTLB_HANDLER_ITEMS];
s32 pmap[VTLB_PMAP_ITEMS]; //512KB // PS2 physical to x86 physical
sptr pmap[VTLB_PMAP_ITEMS]; //512KB // PS2 physical to x86 physical
s32* vmap; //4MB (allocated by vtlb_init) // PS2 virtual to x86 physical
sptr* vmap; //4MB (allocated by vtlb_init) // PS2 virtual to x86 physical
u32* ppmap; //4MB (allocated by vtlb_init) // PS2 virtual to PS2 physical
u32* ppmap; //4MB (allocated by vtlb_init) // PS2 virtual to PS2 physical
MapData()
{

View File

@ -13,11 +13,13 @@
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>./;../../;../../x86;../../x86/ix86-32;../../IPU;../../System;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>__i386__;TIXML_USE_STL;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_M_X86;__i386__;TIXML_USE_STL;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeaderOutputFile>$(IntDir)pcsx2.pch</PrecompiledHeaderOutputFile>
<CompileAs>Default</CompileAs>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions Condition="'$(Platform)'=='x64'">_ARCH_64=1;_M_X86_64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='Win32'">_ARCH_32=1;_M_X86_32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
@ -44,4 +46,4 @@
<Value>$(PcsxSubsection)</Value>
</BuildMacro>
</ItemGroup>
</Project>
</Project>

View File

@ -172,9 +172,9 @@ __ri microProgram* mVUcreateProg(microVU& mVU, int startPC) {
prog->ranges = new deque<microRange>();
prog->startPC = startPC;
mVUcacheProg(mVU, *prog); // Cache Micro Program
double cacheSize = (double)((u32)mVU.prog.x86end - (u32)mVU.prog.x86start);
double cacheUsed =((double)((u32)mVU.prog.x86ptr - (u32)mVU.prog.x86start)) / (double)_1mb;
double cachePerc =((double)((u32)mVU.prog.x86ptr - (u32)mVU.prog.x86start)) / cacheSize * 100;
double cacheSize = (double)((uptr)mVU.prog.x86end - (uptr)mVU.prog.x86start);
double cacheUsed =((double)((uptr)mVU.prog.x86ptr - (uptr)mVU.prog.x86start)) / (double)_1mb;
double cachePerc =((double)((uptr)mVU.prog.x86ptr - (uptr)mVU.prog.x86start)) / cacheSize * 100;
ConsoleColors c = mVU.index ? Color_Orange : Color_Magenta;
DevCon.WriteLn(c, "microVU%d: Cached Prog = [%03d] [PC=%04x] [List=%02d] (Cache=%3.3f%%) [%3.1fmb]",
mVU.index, prog->idx, startPC*8, mVU.prog.prog[startPC]->size()+1, cachePerc, cacheUsed);

View File

@ -395,7 +395,7 @@ void DestroyVUHeaders(int vuindex)
// destroy VU resources
void SuperVUDestroy(int vuindex)
{
pxAssertDev(vuindex >= 0 && vuindex <= 2, "Invalid VU index parameter!");
pxAssertDev(vuindex == 0 || vuindex == 1, "Invalid VU index parameter!");
safe_delete_array(recVUHeaders[vuindex]);
safe_delete_array(recVUBlocks[vuindex]);
@ -417,7 +417,7 @@ void SuperVUDestroy(int vuindex)
// reset VU
void SuperVUReset(int vuindex)
{
pxAssertDev(vuindex >= 0 && vuindex <= 2, "Invalid VU index parameter!");
pxAssertDev(vuindex == 0 || vuindex == 1, "Invalid VU index parameter!");
#ifdef PCSX2_DEBUG
s_vucount = 0;
@ -816,7 +816,7 @@ void VuBaseBlock::GetInstsAtPc(int instpc, list<VuInstruction*>& listinsts)
static VuFunctionHeader* SuperVURecompileProgram(u32 startpc, int vuindex)
{
pxAssert(vuindex < 2);
pxAssert(vuindex == 0 || vuindex == 1);
pxAssert(s_recVUPtr[vuindex] != NULL);
//Console.WriteLn("svu%c rec: %x", '0'+vuindex, startpc);

View File

@ -220,7 +220,7 @@ void GSDevice9::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSel
ss->AddressU = ssel.tau ? D3DTADDRESS_WRAP : D3DTADDRESS_CLAMP;
ss->AddressV = ssel.tav ? D3DTADDRESS_WRAP : D3DTADDRESS_CLAMP;
ss->MaxAnisotropy = theApp.GetConfig("MaxAnisotropy", 0);
ss->MaxLOD = FLT_MAX;
ss->MaxLOD = ULONG_MAX;
m_ps_ss[ssel] = ss;

View File

@ -39,7 +39,7 @@ void SaveConfig()
WritePrivateProfileString(L"Settings", L"Bilinear", szValue, iniFile);
wxSprintf(szValue, L"%u", conf.zz_options);
WritePrivateProfileString(L"Settings", L"ZZOptions", szValue, iniFile);
wxSprintf(szValue, L"%u", conf.hacks);
wxSprintf(szValue, L"%u", conf.hacks._u32);
WritePrivateProfileString(L"Settings", L"AdvancedOptions", szValue, iniFile);
wxSprintf(szValue, L"%u", conf.width);
WritePrivateProfileString(L"Settings", L"Width", szValue, iniFile);

View File

@ -392,7 +392,7 @@ __forceinline void GSMem_to_ClutBuffer__T32_I4_CSM1_c(u32* vm, u32 csa)
dst += 2;
// check for wrapping
if (((u32)dst & 0x3ff) == 0) dst = GetClutBufferAddress<u16>(16);
if (((uptr)dst & 0x3ff) == 0) dst = GetClutBufferAddress<u16>(16);
}
break;
}
@ -408,7 +408,7 @@ __forceinline void GSMem_to_ClutBuffer__T32_I4_CSM1_c(u32* vm, u32 csa)
dst += 2;
// check for wrapping
if (((u32)dst & 0x3ff) == 0) dst = GetClutBufferAddress<u16>(16);
if (((uptr)dst & 0x3ff) == 0) dst = GetClutBufferAddress<u16>(16);
}
break;
}