Merge branch 'master' into jit_exit_addresses

This commit is contained in:
Ryan Houdek committed 2013-11-21 21:17:58 -06:00
commit ea9ac07ec9
143 files changed
+1773 -1093

No files matched your search

+36 -30
View File
@@ -133,6 +133,9 @@
<Filter Include="IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote">
<UniqueIdentifier>{8352be4d-d37d-4f55-adec-b940a9712802}</UniqueIdentifier>
</Filter>
<Filter Include="PowerPC\JitILCommon">
<UniqueIdentifier>{827afa93-1a80-4835-93ae-b5516d95867f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Src\BootManager.cpp" />
@@ -636,39 +639,12 @@
<ClCompile Include="Src\PowerPC\JitCommon\JitCache.cpp">
<Filter>PowerPC\JitCommon</Filter>
</ClCompile>
<ClCompile Include="Src\PowerPC\Jit64IL\IR.cpp">
<Filter>PowerPC\JitIL</Filter>
</ClCompile>
<ClCompile Include="Src\PowerPC\Jit64IL\IR_X86.cpp">
<Filter>PowerPC\JitIL</Filter>
</ClCompile>
<ClCompile Include="Src\PowerPC\Jit64IL\JitIL.cpp">
<Filter>PowerPC\JitIL</Filter>
</ClCompile>
<ClCompile Include="Src\PowerPC\Jit64IL\JitIL_Branch.cpp">
<Filter>PowerPC\JitIL</Filter>
</ClCompile>
<ClCompile Include="Src\PowerPC\Jit64IL\JitIL_FloatingPoint.cpp">
<Filter>PowerPC\JitIL</Filter>
</ClCompile>
<ClCompile Include="Src\PowerPC\Jit64IL\JitIL_Integer.cpp">
<Filter>PowerPC\JitIL</Filter>
</ClCompile>
<ClCompile Include="Src\PowerPC\Jit64IL\JitIL_LoadStore.cpp">
<Filter>PowerPC\JitIL</Filter>
</ClCompile>
<ClCompile Include="Src\PowerPC\Jit64IL\JitIL_LoadStoreFloating.cpp">
<Filter>PowerPC\JitIL</Filter>
</ClCompile>
<ClCompile Include="Src\PowerPC\Jit64IL\JitIL_LoadStorePaired.cpp">
<Filter>PowerPC\JitIL</Filter>
</ClCompile>
<ClCompile Include="Src\PowerPC\Jit64IL\JitIL_Paired.cpp">
<Filter>PowerPC\JitIL</Filter>
</ClCompile>
<ClCompile Include="Src\PowerPC\Jit64IL\JitIL_SystemRegisters.cpp">
<Filter>PowerPC\JitIL</Filter>
</ClCompile>
<ClCompile Include="Src\PowerPC\Jit64IL\JitIL_Tables.cpp">
<Filter>PowerPC\JitIL</Filter>
</ClCompile>
@@ -706,6 +682,33 @@
<Filter>PowerPC\Jit64</Filter>
</ClCompile>
<ClCompile Include="Src\stdafx.cpp" />
<ClCompile Include="Src\PowerPC\JitILCommon\JitILBase_Branch.cpp">
<Filter>PowerPC\JitILCommon</Filter>
</ClCompile>
<ClCompile Include="Src\PowerPC\JitILCommon\JitILBase_FloatingPoint.cpp">
<Filter>PowerPC\JitILCommon</Filter>
</ClCompile>
<ClCompile Include="Src\PowerPC\JitILCommon\JitILBase_Integer.cpp">
<Filter>PowerPC\JitILCommon</Filter>
</ClCompile>
<ClCompile Include="Src\PowerPC\JitILCommon\JitILBase_LoadStore.cpp">
<Filter>PowerPC\JitILCommon</Filter>
</ClCompile>
<ClCompile Include="Src\PowerPC\JitILCommon\JitILBase_LoadStoreFloating.cpp">
<Filter>PowerPC\JitILCommon</Filter>
</ClCompile>
<ClCompile Include="Src\PowerPC\JitILCommon\JitILBase_LoadStorePaired.cpp">
<Filter>PowerPC\JitILCommon</Filter>
</ClCompile>
<ClCompile Include="Src\PowerPC\JitILCommon\JitILBase_Paired.cpp">
<Filter>PowerPC\JitILCommon</Filter>
</ClCompile>
<ClCompile Include="Src\PowerPC\JitILCommon\JitILBase_SystemRegisters.cpp">
<Filter>PowerPC\JitILCommon</Filter>
</ClCompile>
<ClCompile Include="Src\PowerPC\JitILCommon\IR.cpp">
<Filter>PowerPC\JitILCommon</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Src\BootManager.h" />
@@ -1190,9 +1193,6 @@
<ClInclude Include="Src\PowerPC\JitCommon\JitCache.h">
<Filter>PowerPC\JitCommon</Filter>
</ClInclude>
<ClInclude Include="Src\PowerPC\Jit64IL\IR.h">
<Filter>PowerPC\JitIL</Filter>
</ClInclude>
<ClInclude Include="Src\PowerPC\Jit64IL\JitIL.h">
<Filter>PowerPC\JitIL</Filter>
</ClInclude>
@@ -1209,6 +1209,12 @@
<Filter>PowerPC\Jit64</Filter>
</ClInclude>
<ClInclude Include="Src\stdafx.h" />
<ClInclude Include="Src\PowerPC\JitILCommon\JitILBase.h">
<Filter>PowerPC\JitILCommon</Filter>
</ClInclude>
<ClInclude Include="Src\PowerPC\JitILCommon\IR.h">
<Filter>PowerPC\JitILCommon</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Text Include="CMakeLists.txt" />
+6 -3
View File
@@ -17,8 +17,8 @@
#include "PowerPCDisasm.h"
#include "Console.h"
#define CASE1(x) if (memcmp(cmd, x, 2*sizeof(TCHAR))==0)
#define CASE(x) else if (memcmp(cmd, x, 4*sizeof(TCHAR))==0)
#define CASE1(x) if (!strcmp(cmd, (x)))
#define CASE(x) else if (!strcmp(cmd, (x)))
void Console_Submit(const char *cmd)
{
@@ -27,7 +27,7 @@ void Console_Submit(const char *cmd)
Core::StartTrace(false);
INFO_LOG(CONSOLE, "Read tracing started.");
}
CASE1("w")
CASE("w")
{
Core::StartTrace(true);
INFO_LOG(CONSOLE, "Write tracing started.");
@@ -141,3 +141,6 @@ void Console_Submit(const char *cmd)
ERROR_LOG(CONSOLE, "Invalid command");
}
}
#undef CASE1
#undef CASE
+2 -2
View File
@@ -388,8 +388,8 @@ void EmuThread()
OSD::AddMessage("Dolphin " + g_video_backend->GetName() + " Video Backend.", 5000);
if (!DSP::GetDSPEmulator()->Initialize(_CoreParameter.bWii,
_CoreParameter.bDSPThread))
if (!DSP::GetDSPEmulator()->Initialize(g_pWindowHandle,
_CoreParameter.bWii, _CoreParameter.bDSPThread))
{
HW::Shutdown();
g_video_backend->Shutdown();
+3 -1
View File
@@ -18,6 +18,8 @@
#include "Core.h" // for bWii
#include "FifoPlayer/FifoDataFile.h"
#include <cinttypes>
SCoreStartupParameter::SCoreStartupParameter()
: hInstance(0),
bEnableDebugging(false), bAutomaticStart(false), bBootToPause(false),
@@ -278,7 +280,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2)
// Use the TitleIDhex for name and/or unique ID if launching from nand folder
// or if it is not ascii characters (specifically sysmenu could potentially apply to other things)
char titleidstr[17];
snprintf(titleidstr, 17, "%016llx", ContentLoader.GetTitleID());
snprintf(titleidstr, 17, "%016" PRIx64, ContentLoader.GetTitleID());
if (!m_strName.length())
{
+2 -1
View File
@@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include <vector>
#include <cinttypes>
#include "Thread.h"
#include "PowerPC/PowerPC.h"
@@ -429,7 +430,7 @@ void LogPendingEvents()
Event *ptr = first;
while (ptr)
{
INFO_LOG(POWERPC, "PENDING: Now: %lld Pending: %lld Type: %d", globalTimer, ptr->time, ptr->type);
INFO_LOG(POWERPC, "PENDING: Now: %" PRId64 " Pending: %" PRId64 " Type: %d", globalTimer, ptr->time, ptr->type);
ptr = ptr->next;
}
}
+2 -1
View File
@@ -15,7 +15,7 @@ public:
virtual bool IsLLE() = 0;
virtual bool Initialize(bool bWii, bool bDSPThread) = 0;
virtual bool Initialize(void *hWnd, bool bWii, bool bDSPThread) = 0;
virtual void Shutdown() = 0;
virtual void DoState(PointerWrap &p) = 0;
@@ -35,6 +35,7 @@ public:
protected:
SoundStream *soundStream;
void *m_hWnd;
};
DSPEmulator *CreateDSPEmulator(bool HLE);
@@ -86,7 +86,7 @@ bool FifoDataFile::Save(const char *filename)
header.xfRegsSize = XF_REGS_SIZE;
header.frameListOffset = frameListOffset;
header.frameCount = m_Frames.size();
header.frameCount = (u32)m_Frames.size();
header.flags = m_Flags;
@@ -111,7 +111,7 @@ bool FifoDataFile::Save(const char *filename)
dstFrame.fifoStart = srcFrame.fifoStart;
dstFrame.fifoEnd = srcFrame.fifoEnd;
dstFrame.memoryUpdatesOffset = memoryUpdatesOffset;
dstFrame.numMemoryUpdates = srcFrame.memoryUpdates.size();
dstFrame.numMemoryUpdates = (u32)srcFrame.memoryUpdates.size();
// Write frame info
u64 frameOffset = frameListOffset + (i * sizeof(FileFrameInfo));
@@ -234,7 +234,7 @@ u32 FifoPlaybackAnalyzer::DecodeCommand(u8 *data)
break;
}
return data - dataStart;
return (u32)(data - dataStart);
}
void FifoPlaybackAnalyzer::StoreEfbCopyRegion()
@@ -105,7 +105,9 @@ bool FifoPlayer::Play()
u32 FifoPlayer::GetFrameObjectCount()
{
if (m_CurrentFrame < m_FrameInfo.size())
return m_FrameInfo[m_CurrentFrame].objectStarts.size();
{
return (u32)(m_FrameInfo[m_CurrentFrame].objectStarts.size());
}
return 0;
}
@@ -172,7 +174,7 @@ void FifoPlayer::WriteFrame(const FifoFrameInfo &frame, const AnalyzedFrameInfo
m_FrameFifoSize = frame.fifoDataSize;
// Determine start and end objects
u32 numObjects = info.objectStarts.size();
u32 numObjects = (u32)(info.objectStarts.size());
u32 drawStart = std::min(numObjects, m_ObjectRangeStart);
u32 drawEnd = std::min(numObjects - 1, m_ObjectRangeEnd);
@@ -181,7 +183,9 @@ void FifoPlayer::WriteFrame(const FifoFrameInfo &frame, const AnalyzedFrameInfo
// Skip memory updates during frame if true
if (m_EarlyMemoryUpdates)
memoryUpdate = frame.memoryUpdates.size();
{
memoryUpdate = (u32)(frame.memoryUpdates.size());
}
if (numObjects > 0)
{
@@ -83,9 +83,9 @@ void FifoRecorder::WriteGPCommand(u8 *data, u32 size)
if (m_FrameEnded && m_FifoData.size() > 0)
{
size_t dataSize = m_FifoData.size();
m_CurrentFrame.fifoDataSize = dataSize;
m_CurrentFrame.fifoDataSize = (u32)dataSize;
m_CurrentFrame.fifoData = new u8[dataSize];
memcpy(m_CurrentFrame.fifoData, &m_FifoData[0], dataSize);
memcpy(m_CurrentFrame.fifoData, m_FifoData.data(), dataSize);
sMutex.lock();
@@ -129,7 +129,7 @@ void FifoRecorder::WriteMemory(u32 address, u32 size, MemoryUpdate::Type type)
// Record memory update
MemoryUpdate memUpdate;
memUpdate.address = address;
memUpdate.fifoPosition = m_FifoData.size();
memUpdate.fifoPosition = (u32)(m_FifoData.size());
memUpdate.size = size;
memUpdate.type = type;
memUpdate.data = new u8[size];
+3 -2
View File
@@ -42,8 +42,9 @@ struct DSPState
}
};
bool DSPHLE::Initialize(bool bWii, bool bDSPThread)
bool DSPHLE::Initialize(void *hWnd, bool bWii, bool bDSPThread)
{
m_hWnd = hWnd;
m_bWii = bWii;
m_pUCode = NULL;
m_lastUCode = NULL;
@@ -265,7 +266,7 @@ void DSPHLE::InitMixer()
unsigned int AISampleRate, DACSampleRate;
AudioInterface::Callback_GetSampleRate(AISampleRate, DACSampleRate);
delete soundStream;
soundStream = AudioCommon::InitSoundStream(new HLEMixer(this, AISampleRate, DACSampleRate, 48000));
soundStream = AudioCommon::InitSoundStream(new HLEMixer(this, AISampleRate, DACSampleRate, 48000), m_hWnd);
if(!soundStream) PanicAlert("Error starting up sound stream");
// Mixer is initialized
m_InitMixer = true;
+1 -1
View File
@@ -16,7 +16,7 @@ class DSPHLE : public DSPEmulator {
public:
DSPHLE();
virtual bool Initialize(bool bWii, bool bDSPThread) override;
virtual bool Initialize(void *hWnd, bool bWii, bool bDSPThread) override;
virtual void Shutdown() override;
virtual bool IsLLE() override { return false ; }
@@ -469,36 +469,42 @@ void ProcessVoice(PB_TYPE& pb, const AXBuffers& buffers, u16 count, AXMixControl
// Mix LRS, AUXA and AUXB depending on mixer_control
// TODO: Handle DPL2 on AUXB.
if (mctrl & MIX_L)
MixAdd(buffers.left, samples, count, &pb.mixer.left, &pb.dpop.left, mctrl & MIX_L_RAMP);
if (mctrl & MIX_R)
MixAdd(buffers.right, samples, count, &pb.mixer.right, &pb.dpop.right, mctrl & MIX_R_RAMP);
if (mctrl & MIX_S)
MixAdd(buffers.surround, samples, count, &pb.mixer.surround, &pb.dpop.surround, mctrl & MIX_S_RAMP);
#define MIX_ON(C) (0 != (mctrl & MIX_##C))
#define RAMP_ON(C) (0 != (mctrl & MIX_##C##_RAMP))
if (mctrl & MIX_AUXA_L)
MixAdd(buffers.auxA_left, samples, count, &pb.mixer.auxA_left, &pb.dpop.auxA_left, mctrl & MIX_AUXA_L_RAMP);
if (mctrl & MIX_AUXA_R)
MixAdd(buffers.auxA_right, samples, count, &pb.mixer.auxA_right, &pb.dpop.auxA_right, mctrl & MIX_AUXA_R_RAMP);
if (mctrl & MIX_AUXA_S)
MixAdd(buffers.auxA_surround, samples, count, &pb.mixer.auxA_surround, &pb.dpop.auxA_surround, mctrl & MIX_AUXA_S_RAMP);
if (MIX_ON(L))
MixAdd(buffers.left, samples, count, &pb.mixer.left, &pb.dpop.left, RAMP_ON(L));
if (MIX_ON(R))
MixAdd(buffers.right, samples, count, &pb.mixer.right, &pb.dpop.right, RAMP_ON(R));
if (MIX_ON(S))
MixAdd(buffers.surround, samples, count, &pb.mixer.surround, &pb.dpop.surround, RAMP_ON(S));
if (mctrl & MIX_AUXB_L)
MixAdd(buffers.auxB_left, samples, count, &pb.mixer.auxB_left, &pb.dpop.auxB_left, mctrl & MIX_AUXB_L_RAMP);
if (mctrl & MIX_AUXB_R)
MixAdd(buffers.auxB_right, samples, count, &pb.mixer.auxB_right, &pb.dpop.auxB_right, mctrl & MIX_AUXB_R_RAMP);
if (mctrl & MIX_AUXB_S)
MixAdd(buffers.auxB_surround, samples, count, &pb.mixer.auxB_surround, &pb.dpop.auxB_surround, mctrl & MIX_AUXB_S_RAMP);
if (MIX_ON(AUXA_L))
MixAdd(buffers.auxA_left, samples, count, &pb.mixer.auxA_left, &pb.dpop.auxA_left, RAMP_ON(AUXA_L));
if (MIX_ON(AUXA_R))
MixAdd(buffers.auxA_right, samples, count, &pb.mixer.auxA_right, &pb.dpop.auxA_right, RAMP_ON(AUXA_R));
if (MIX_ON(AUXA_S))
MixAdd(buffers.auxA_surround, samples, count, &pb.mixer.auxA_surround, &pb.dpop.auxA_surround, RAMP_ON(AUXA_S));
if (MIX_ON(AUXB_L))
MixAdd(buffers.auxB_left, samples, count, &pb.mixer.auxB_left, &pb.dpop.auxB_left, RAMP_ON(AUXB_L));
if (MIX_ON(AUXB_R))
MixAdd(buffers.auxB_right, samples, count, &pb.mixer.auxB_right, &pb.dpop.auxB_right, RAMP_ON(AUXB_R));
if (MIX_ON(AUXB_S))
MixAdd(buffers.auxB_surround, samples, count, &pb.mixer.auxB_surround, &pb.dpop.auxB_surround, RAMP_ON(AUXB_S));
#ifdef AX_WII
if (mctrl & MIX_AUXC_L)
MixAdd(buffers.auxC_left, samples, count, &pb.mixer.auxC_left, &pb.dpop.auxC_left, mctrl & MIX_AUXC_L_RAMP);
if (mctrl & MIX_AUXC_R)
MixAdd(buffers.auxC_right, samples, count, &pb.mixer.auxC_right, &pb.dpop.auxC_right, mctrl & MIX_AUXC_R_RAMP);
if (mctrl & MIX_AUXC_S)
MixAdd(buffers.auxC_surround, samples, count, &pb.mixer.auxC_surround, &pb.dpop.auxC_surround, mctrl & MIX_AUXC_S_RAMP);
if (MIX_ON(AUXC_L))
MixAdd(buffers.auxC_left, samples, count, &pb.mixer.auxC_left, &pb.dpop.auxC_left, RAMP_ON(AUXC_L));
if (MIX_ON(AUXC_R))
MixAdd(buffers.auxC_right, samples, count, &pb.mixer.auxC_right, &pb.dpop.auxC_right, RAMP_ON(AUXC_R));
if (MIX_ON(AUXC_S))
MixAdd(buffers.auxC_surround, samples, count, &pb.mixer.auxC_surround, &pb.dpop.auxC_surround, RAMP_ON(AUXC_S));
#endif
#undef MIX_ON
#undef RAMP_ON
// Optionally, phase shift left or right channel to simulate 3D sound.
if (pb.initial_time_delay.on)
{
@@ -524,8 +530,8 @@ void ProcessVoice(PB_TYPE& pb, const AXBuffers& buffers, u16 count, AXMixControl
pb.remote_src.cur_addr_frac = curr_pos & 0xFFFF;
// Mix to main[0-3] and aux[0-3]
#define WMCHAN_MIX_ON(n) ((pb.remote_mixer_control >> (2 * n)) & 3)
#define WMCHAN_MIX_RAMP(n) ((pb.remote_mixer_control >> (2 * n)) & 2)
#define WMCHAN_MIX_ON(n) (0 != ((pb.remote_mixer_control >> (2 * n)) & 3))
#define WMCHAN_MIX_RAMP(n) (0 != ((pb.remote_mixer_control >> (2 * n)) & 2))
if (WMCHAN_MIX_ON(0))
MixAdd(buffers.wm_main0, wm_samples, wm_count, &pb.remote_mixer.main0, &pb.remote_dpop.main0, WMCHAN_MIX_RAMP(0));
@@ -544,6 +550,8 @@ void ProcessVoice(PB_TYPE& pb, const AXBuffers& buffers, u16 count, AXMixControl
if (WMCHAN_MIX_ON(7))
MixAdd(buffers.wm_aux3, wm_samples, wm_count, &pb.remote_mixer.aux3, &pb.remote_dpop.aux3, WMCHAN_MIX_RAMP(7));
}
#undef WMCHAN_MIX_RAMP
#undef WMCHAN_MIX_ON
#endif
}
+3 -2
View File
@@ -130,8 +130,9 @@ void DSPLLE::dsp_thread(DSPLLE *dsp_lle)
}
}
bool DSPLLE::Initialize(bool bWii, bool bDSPThread)
bool DSPLLE::Initialize(void *hWnd, bool bWii, bool bDSPThread)
{
m_hWnd = hWnd;
m_bWii = bWii;
m_bDSPThread = bDSPThread;
m_InitMixer = false;
@@ -184,7 +185,7 @@ void DSPLLE::InitMixer()
unsigned int AISampleRate, DACSampleRate;
AudioInterface::Callback_GetSampleRate(AISampleRate, DACSampleRate);
delete soundStream;
soundStream = AudioCommon::InitSoundStream(new CMixer(AISampleRate, DACSampleRate, 48000));
soundStream = AudioCommon::InitSoundStream(new CMixer(AISampleRate, DACSampleRate, 48000), m_hWnd);
if(!soundStream) PanicAlert("Error starting up sound stream");
// Mixer is initialized
m_InitMixer = true;
+1 -1
View File
@@ -14,7 +14,7 @@ class DSPLLE : public DSPEmulator {
public:
DSPLLE();
virtual bool Initialize(bool bWii, bool bDSPThread);
virtual bool Initialize(void *hWnd, bool bWii, bool bDSPThread);
virtual void Shutdown();
virtual bool IsLLE() { return true; }
@@ -6,6 +6,7 @@
#include "FileUtil.h"
#include "DSP/DSPCore.h"
#include "DSPLLEGlobals.h"
#include <cinttypes>
#if PROFILE
@@ -37,12 +38,12 @@ void ProfilerDump(u64 count)
File::IOFile pFile("DSP_Prof.txt", "wt");
if (pFile)
{
fprintf(pFile.GetHandle(), "Number of DSP steps: %llu\n\n", count);
fprintf(pFile.GetHandle(), "Number of DSP steps: %" PRIu64 "\n\n", count);
for (int i=0; i<PROFILE_MAP_SIZE;i++)
{
if (g_profileMap[i] > 0)
{
fprintf(pFile.GetHandle(), "0x%04X: %llu\n", i, g_profileMap[i]);
fprintf(pFile.GetHandle(), "0x%04X: %" PRIu64 "\n", i, g_profileMap[i]);
}
}
}
+1 -1
View File
@@ -325,7 +325,7 @@ void ChangeDisc(const char* _newFileName)
{
Movie::g_bDiscChange = true;
std::string fileName = _newFileName;
int sizeofpath = fileName.find_last_of("/\\") + 1;
auto sizeofpath = fileName.find_last_of("/\\") + 1;
if (fileName.substr(sizeofpath).length() > 40)
{
PanicAlert("Saving iso filename to .dtm failed; max file name length is 40 characters.");
@@ -191,7 +191,7 @@ void CEXIMemoryCard::CmdDone()
void CEXIMemoryCard::CmdDoneLater(u64 cycles)
{
CoreTiming::RemoveEvent(et_cmd_done);
CoreTiming::ScheduleEvent(cycles, et_cmd_done, (u64)card_index);
CoreTiming::ScheduleEvent((int)cycles, et_cmd_done, (u64)card_index);
}
void CEXIMemoryCard::SetCS(int cs)
+9 -6
View File
@@ -4,6 +4,9 @@
#include "GCMemcard.h"
#include "ColorUtil.h"
#include <cinttypes>
static void ByteSwap(u8 *valueA, u8 *valueB)
{
u8 tmp = *valueA;
@@ -37,19 +40,19 @@ GCMemcard::GCMemcard(const char *filename, bool forceCreation, bool sjis)
PanicAlertT("File has the extension \"%s\"\nvalid extensions are (.raw/.gcp)", fileType.c_str());
return;
}
u32 size = mcdFile.GetSize();
auto size = mcdFile.GetSize();
if (size < MC_FST_BLOCKS*BLOCK_SIZE)
{
PanicAlertT("%s failed to load as a memorycard \nfile is not large enough to be a valid memory card file (0x%x bytes)", filename, size);
PanicAlertT("%s failed to load as a memorycard \nfile is not large enough to be a valid memory card file (0x%x bytes)", filename, (unsigned) size);
return;
}
if (size % BLOCK_SIZE)
{
PanicAlertT("%s failed to load as a memorycard \n Card file size is invalid (0x%x bytes)", filename, size);
PanicAlertT("%s failed to load as a memorycard \n Card file size is invalid (0x%x bytes)", filename, (unsigned) size);
return;
}
m_sizeMb = (size/BLOCK_SIZE) / MBIT_TO_BLOCKS;
m_sizeMb = (u16)((size/BLOCK_SIZE) / MBIT_TO_BLOCKS);
switch (m_sizeMb)
{
case MemCard59Mb:
@@ -60,7 +63,7 @@ GCMemcard::GCMemcard(const char *filename, bool forceCreation, bool sjis)
case MemCard2043Mb:
break;
default:
PanicAlertT("%s failed to load as a memorycard \n Card size is invalid (0x%x bytes)", filename, size);
PanicAlertT("%s failed to load as a memorycard \n Card size is invalid (0x%x bytes)", filename, (unsigned) size);
return;
}
}
@@ -173,7 +176,7 @@ GCMemcard::GCMemcard(const char *filename, bool forceCreation, bool sjis)
}
else
{
PanicAlertT("Failed to read block %d of the save data\nMemcard may be truncated\nFilePosition:%llx", i, mcdFile.Tell());
PanicAlertT("Failed to read block %d of the save data\nMemcard may be truncated\nFilePosition:%" PRIx64, i, mcdFile.Tell());
m_valid = false;
break;
}
+1 -1
View File
@@ -209,5 +209,5 @@ void GCPad::LoadDefaults(const ControllerInterface& ciface)
bool GCPad::GetMicButton() const
{
return m_buttons->controls.back()->control_ref->State();
return (0.0f != m_buttons->controls.back()->control_ref->State());
}
@@ -32,7 +32,7 @@
namespace WiimoteEmu
{
void Spy(Wiimote* wm_, const void* data_, int size_)
void Spy(Wiimote* wm_, const void* data_, size_t size_)
{
#if 0
// enable log
@@ -1275,7 +1275,7 @@ void Wiimote::DoState(PointerWrap& p)
else
{
std::queue<ReadRequest> tmp_queue(m_read_requests);
size = m_read_requests.size();
size = (u32)(m_read_requests.size());
p.Do(size);
while (!tmp_queue.empty())
{
@@ -765,7 +765,7 @@ void Wiimote::Update()
if (-1 == rptf_size)
{
std::copy(rpt.begin(), rpt.end(), data);
rptf_size = rpt.size();
rptf_size = (s8)(rpt.size());
}
}
}
@@ -96,7 +96,7 @@ inline double trim(double a)
class Wiimote : public ControllerEmu
{
friend class WiimoteReal::Wiimote;
friend void Spy(Wiimote* wm_, const void* data_, int size_);
friend void Spy(Wiimote* wm_, const void* data_, size_t size_);
public:
enum
@@ -245,7 +245,7 @@ private:
} m_reg_speaker;
};
void Spy(Wiimote* wm_, const void* data_, int size_);
void Spy(Wiimote* wm_, const void* data_, size_t size_);
}
@@ -72,7 +72,7 @@ int Wiimote::IORead(u8* buf)
return 0;
}
int Wiimote::IOWrite(const u8* buf, int len)
int Wiimote::IOWrite(const u8* buf, size_t len)
{
return 0;
}
@@ -263,9 +263,9 @@ int Wiimote::IORead(u8* buf)
return r;
}
int Wiimote::IOWrite(u8 const* buf, int len)
int Wiimote::IOWrite(u8 const* buf, size_t len)
{
return write(int_sock, buf, len);
return write(int_sock, buf, (int)len);
}
}; // WiimoteReal
@@ -140,7 +140,7 @@ namespace WiimoteReal
{
int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stack_t &stack, const u8* buf, int len);
int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stack_t &stack, const u8* buf, size_t len);
int _IORead(HANDLE &dev_handle, OVERLAPPED &hid_overlap_read, u8* buf, int index);
void _IOWakeup(HANDLE &dev_handle, OVERLAPPED &hid_overlap_read);
@@ -247,7 +247,7 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
// SLEEP(2000);
}
int CheckDeviceType_Write(HANDLE &dev_handle, const u8* buf, int size, int attempts)
int CheckDeviceType_Write(HANDLE &dev_handle, const u8* buf, size_t size, int attempts)
{
OVERLAPPED hid_overlap_write = OVERLAPPED();
hid_overlap_write.hEvent = CreateEvent(NULL, true, false, NULL);
@@ -641,7 +641,7 @@ int Wiimote::IORead(u8* buf)
}
int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stack_t &stack, const u8* buf, int len)
int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stack_t &stack, const u8* buf, size_t len)
{
WiimoteEmu::Spy(NULL, buf, len);
@@ -663,7 +663,7 @@ int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stac
}
case MSBT_STACK_MS:
{
auto result = HidD_SetOutputReport(dev_handle, const_cast<u8*>(buf) + 1, len - 1);
auto result = HidD_SetOutputReport(dev_handle, const_cast<u8*>(buf) + 1, (ULONG)(len - 1));
//FlushFileBuffers(dev_handle);
if (!result)
@@ -715,7 +715,7 @@ int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stac
return 0;
}
int Wiimote::IOWrite(const u8* buf, int len)
int Wiimote::IOWrite(const u8* buf, size_t len)
{
return _IOWrite(dev_handle, hid_overlap_write, stack, buf, len);
}
@@ -310,14 +310,14 @@ int Wiimote::IORead(unsigned char *buf)
return inputlen;
}
int Wiimote::IOWrite(const unsigned char *buf, int len)
int Wiimote::IOWrite(const unsigned char *buf, size_t len)
{
IOReturn ret;
if (!IsConnected())
return 0;
ret = [ichan writeAsync: const_cast<void*>((void *)buf) length: len refcon: nil];
ret = [ichan writeAsync: const_cast<void*>((void *)buf) length: (int)len refcon: nil];
if (ret == kIOReturnSuccess)
return len;
@@ -239,7 +239,9 @@ bool Wiimote::Write()
IOWrite(rpt.data(), rpt.size());
if (is_speaker_data)
{
m_last_audio_report.Update();
}
m_write_reports.Pop();
return true;
@@ -293,8 +295,10 @@ void Wiimote::Update()
// Send the report
if (!rpt.empty() && m_channel > 0)
Core::Callback_WiimoteInterruptChannel(index, m_channel,
rpt.data(), rpt.size());
{
Core::Callback_WiimoteInterruptChannel(index, m_channel,
rpt.data(), (u32)rpt.size());
}
}
void Wiimote::Prepare(int _index)
@@ -106,7 +106,7 @@ private:
void WriteReport(Report rpt);
int IORead(u8* buf);
int IOWrite(u8 const* buf, int len);
int IOWrite(u8 const* buf, size_t len);
void IOWakeup();
void ThreadFunc();
+4 -2
View File
@@ -83,7 +83,7 @@ static u64 last_reply_time;
void EnqueReplyCallback(u64 userdata, int)
{
std::lock_guard<std::mutex> lk(s_reply_queue);
reply_queue.push_back(userdata);
reply_queue.push_back((u32)userdata);
}
void Init()
@@ -546,7 +546,9 @@ void ExecuteCommand(u32 _Address)
const s64 ticks_til_last_reply = last_reply_time - CoreTiming::GetTicks();
if (ticks_til_last_reply > 0)
reply_delay = ticks_til_last_reply;
{
reply_delay = (int)ticks_til_last_reply;
}
last_reply_time = CoreTiming::GetTicks() + reply_delay;
@@ -19,6 +19,8 @@
#include "../../DiscIO/Src/FileMonitor.h"
#include <cinttypes>
using namespace DVDInterface;
@@ -108,7 +110,7 @@ bool CWII_IPC_HLE_Device_di::IOCtlV(u32 _CommandAddress)
// Get TMD offset for requested partition...
u64 const TMDOffset = ((u64)Memory::Read_U32(CommandBuffer.InBuffer[0].m_Address + 4) << 2 ) + 0x2c0;
INFO_LOG(WII_IPC_DVD, "DVDLowOpenPartition: TMDOffset 0x%016llx", TMDOffset);
INFO_LOG(WII_IPC_DVD, "DVDLowOpenPartition: TMDOffset 0x%016" PRIx64, TMDOffset);
static u32 const TMDsz = 0x208; //CommandBuffer.PayloadBuffer[0].m_Size;
u8 pTMD[TMDsz];
@@ -204,13 +206,13 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
pFilename = m_pFileSystem->GetFileName(DVDAddress);
if (pFilename != NULL)
{
INFO_LOG(WII_IPC_DVD, "DVDLowRead: %s (0x%llx) - (DVDAddr: 0x%llx, Size: 0x%x)",
INFO_LOG(WII_IPC_DVD, "DVDLowRead: %s (0x%" PRIx64 ") - (DVDAddr: 0x%" PRIx64 ", Size: 0x%x)",
pFilename, m_pFileSystem->GetFileSize(pFilename), DVDAddress, Size);
FileMon::CheckFile(std::string(pFilename), (int)m_pFileSystem->GetFileSize(pFilename));
}
else
{
INFO_LOG(WII_IPC_DVD, "DVDLowRead: file unknown - (DVDAddr: 0x%llx, Size: 0x%x)",
INFO_LOG(WII_IPC_DVD, "DVDLowRead: file unknown - (DVDAddr: 0x%" PRIx64 ", Size: 0x%x)",
DVDAddress, Size);
}
}
@@ -308,7 +310,7 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
u64 DVDAddress = (u64)DVDAddress32 << 2;
INFO_LOG(WII_IPC_DVD, "DVDLowUnencryptedRead: DVDAddr: 0x%08llx, Size: 0x%x", DVDAddress, Size);
INFO_LOG(WII_IPC_DVD, "DVDLowUnencryptedRead: DVDAddr: 0x%08" PRIx64 ", Size: 0x%x", DVDAddress, Size);
if (Size > _BufferOutSize)
{
@@ -342,12 +344,12 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
pFilename = m_pFileSystem->GetFileName(DVDAddress);
if (pFilename != NULL)
{
INFO_LOG(WII_IPC_DVD, "DVDLowSeek: %s (0x%llx) - (DVDAddr: 0x%llx)",
INFO_LOG(WII_IPC_DVD, "DVDLowSeek: %s (0x%" PRIx64 ") - (DVDAddr: 0x%" PRIx64 ")",
pFilename, m_pFileSystem->GetFileSize(pFilename), DVDAddress);
}
else
{
INFO_LOG(WII_IPC_DVD, "DVDLowSeek: file unknown - (DVDAddr: 0x%llx)",
INFO_LOG(WII_IPC_DVD, "DVDLowSeek: file unknown - (DVDAddr: 0x%" PRIx64 ")",
DVDAddress);
}
}
@@ -35,6 +35,10 @@
#include "WII_IPC_HLE_Device_es.h"
// need to include this before polarssl/aes.h,
// otherwise we may not get __STDC_FORMAT_MACROS
#include <cinttypes>
#include "../PowerPC/PowerPC.h"
#include "../VolumeHandler.h"
#include "FileUtil.h"
@@ -129,7 +133,7 @@ void CWII_IPC_HLE_Device_es::DoState(PointerWrap& p)
p.Do(m_AccessIdentID);
p.Do(m_TitleIDs);
u32 Count = m_ContentAccessMap.size();
u32 Count = (u32)(m_ContentAccessMap.size());
p.Do(Count);
u32 CFD, Position;
@@ -205,7 +209,7 @@ u32 CWII_IPC_HLE_Device_es::OpenTitleContent(u32 CFD, u64 TitleID, u16 Index)
if (!Loader.IsValid())
{
WARN_LOG(WII_IPC_ES, "ES: loader not valid for %llx", TitleID);
WARN_LOG(WII_IPC_ES, "ES: loader not valid for %" PRIx64, TitleID);
return 0xffffffff;
}
@@ -940,7 +944,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
if (!bSuccess)
{
PanicAlertT("IOCTL_ES_LAUNCH: Game tried to reload a title that is not available in your NAND dump\n"
"TitleID %016llx.\n Dolphin will likely hang now.", TitleID);
"TitleID %016" PRIx64".\n Dolphin will likely hang now.", TitleID);
}
else
{
@@ -983,7 +987,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
//TODO: provide correct return code when bSuccess= false
Memory::Write_U32(0, _CommandAddress + 0x4);
ERROR_LOG(WII_IPC_ES, "IOCTL_ES_LAUNCH %016llx %08x %016llx %08x %016llx %04x", TitleID,view,ticketid,devicetype,titleid,access);
ERROR_LOG(WII_IPC_ES, "IOCTL_ES_LAUNCH %016" PRIx64 " %08x %016" PRIx64 " %08x %016" PRIx64 " %04x", TitleID,view,ticketid,devicetype,titleid,access);
// IOCTL_ES_LAUNCH 0001000248414341 00000001 0001c0fef3df2cfa 00000000 0001000248414341 ffff
// This is necessary because Reset(true) above deleted this object. Ew.
@@ -571,7 +571,7 @@ void CWII_IPC_HLE_Device_fs::DoState(PointerWrap& p)
}
else
{
u32 size = entry.size;
u32 size = (u32)entry.size;
p.Do(size);
File::IOFile handle(entry.physicalName, "rb");
@@ -385,12 +385,12 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize)
Memory::WriteBigEData((const u8*)&wii_device, OffsetBuffer, Align(wii_device.bLength, 4));
OffsetBuffer += Align(wii_device.bLength, 4);
bool deviceValid = true;
bool isHID = false;
for (c = 0; deviceValid && c < desc.bNumConfigurations; c++)
{
struct libusb_config_descriptor *config = NULL;
int cRet = libusb_get_config_descriptor(device, c, &config);
// do not try to use usb devices with more than one interface, games can crash
if(cRet == 0 && config->bNumInterfaces <= MAX_HID_INTERFACES)
{
@@ -402,10 +402,14 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize)
for (ic = 0; ic < config->bNumInterfaces; ic++)
{
const struct libusb_interface *interfaceContainer = &config->interface[ic];
for (i = 0; i < interfaceContainer->num_altsetting; i++)
{
const struct libusb_interface_descriptor *interface = &interfaceContainer->altsetting[i];
if (interface->bInterfaceClass == LIBUSB_CLASS_HID)
isHID = true;
WiiHIDInterfaceDescriptor wii_interface;
ConvertInterfaceToWii(&wii_interface, interface);
Memory::WriteBigEData((const u8*)&wii_interface, OffsetBuffer, Align(wii_interface.bLength, 4));
@@ -435,6 +439,12 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize)
}
} // configs
if (!isHID)
{
deviceValid = false;
OffsetBuffer = OffsetStart;
}
if (deviceValid)
{
Memory::Write_U32(OffsetBuffer-OffsetStart, OffsetStart); // fill in length
@@ -866,7 +866,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRoleChange(bdaddr_t _bd, bool
bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventNumberOfCompletedPackets()
{
SQueuedEvent Event(sizeof(hci_event_hdr_t) + sizeof(hci_num_compl_pkts_ep) + sizeof(hci_num_compl_pkts_info) * m_WiiMotes.size(), 0);
SQueuedEvent Event((u32)(sizeof(hci_event_hdr_t) + sizeof(hci_num_compl_pkts_ep) + (sizeof(hci_num_compl_pkts_info) * m_WiiMotes.size())), 0);
INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventNumberOfCompletedPackets");
+1 -10
View File
@@ -84,14 +84,6 @@
// All structs in this file are packed
#pragma pack(push, 1)
/*
* Bluetooth Address Family Protocol Numbers
*/
#define BTPROTO_HCI 1
#define BTPROTO_L2CAP 2
#define BTPROTO_RFCOMM 3
#define BTPROTO_SCO 4
/* All sizes are in bytes */
#define BLUETOOTH_BDADDR_SIZE 6
@@ -102,9 +94,8 @@
typedef struct {
uint8_t b[BLUETOOTH_BDADDR_SIZE];
} bdaddr_t;
#endif
#define BDADDR_ANY { { 0, 0, 0, 0, 0, 0 } }
#endif
/**************************************************************************
**************************************************************************
+5 -4
View File
@@ -445,10 +445,11 @@ void NetPlayClient::SendWiimoteState(const PadMapping in_game_pad, const NetWiim
sf::Packet spac;
spac << (MessageId)NP_MSG_WIIMOTE_DATA;
spac << in_game_pad;
u8 size = nw.size();
spac << size;
for (unsigned int i = 0; i < size; ++i)
spac << nw.data()[i];
spac << (u8)nw.size();
for (auto it : nw)
{
spac << it;
}
std::lock_guard<std::recursive_mutex> lks(m_crit.send);
m_socket.Send(spac);
+4 -2
View File
@@ -153,7 +153,7 @@ unsigned int NetPlayServer::OnConnect(sf::SocketTCP& socket)
rpac >> player.name;
// give new client first available id
player.pid = m_players.size() + 1;
player.pid = (PlayerId)(m_players.size() + 1);
// try to automatically assign new user a pad
for (unsigned int m = 0; m < 4; ++m)
@@ -435,12 +435,14 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, sf::SocketTCP& socket)
case NP_MSG_PONG :
{
const u32 ping = m_ping_timer.GetTimeElapsed();
const u32 ping = (u32)m_ping_timer.GetTimeElapsed();
u32 ping_key = 0;
packet >> ping_key;
if (m_ping_key == ping_key)
{
player.ping = ping;
}
sf::Packet spac;
spac << (MessageId)NP_MSG_PLAYER_PING_DATA;
@@ -10,11 +10,11 @@
#include "../../Host.h"
#include "../../IPC_HLE/WII_IPC_HLE.h"
#ifdef USE_GDBSTUB
#include "../GDBStub.h"
#endif
#include <cinttypes>
namespace {
u32 last_pc;
@@ -79,7 +79,7 @@ void Trace( UGeckoInstruction &instCode )
std::string fregs = "";
for (int i=0; i<32; i++)
{
sprintf(freg, "f%02d: %08llx %08llx ", i, PowerPC::ppcState.ps[i][0], PowerPC::ppcState.ps[i][1]);
sprintf(freg, "f%02d: %08" PRIx64 " %08" PRIx64 " ", i, PowerPC::ppcState.ps[i][0], PowerPC::ppcState.ps[i][1]);
fregs.append(freg);
}
@@ -5,6 +5,7 @@
#ifndef _INTERPRETER_FPUTILS_H
#define _INTERPRETER_FPUTILS_H
#include "CPUDetect.h"
#include "Interpreter.h"
#include "MathUtil.h"
@@ -69,28 +70,22 @@ inline void UpdateFPSCR()
inline double ForceSingle(double _x)
{
//if (FPSCR.RN != 0)
// PanicAlert("RN = %d at %x", (int)FPSCR.RN, PC);
if (FPSCR.NI)
_x = FlushToZeroAsFloat(_x);
double x = static_cast<float>(_x);
// convert to float...
float x = _x;
if (!cpu_info.bFlushToZero && FPSCR.NI)
{
x = FlushToZero(x);
}
// ...and back to double:
return x;
}
inline double ForceDouble(double d)
{
//if (FPSCR.RN != 0)
// PanicAlert("RN = %d at %x", (int)FPSCR.RN, PC);
//if (FPSCR.NI)
//{
// IntDouble x; x.d = d;
//if ((x.i & DOUBLE_EXP) == 0)
// x.i &= DOUBLE_SIGN; // turn into signed zero
// return x.d;
//}
if (!cpu_info.bFlushToZero && FPSCR.NI)
{
d = FlushToZero(d);
}
return d;
}
@@ -48,15 +48,8 @@ static void FPSCRtoFPUSettings(UReg_FPSCR fp)
// Pokemon Colosseum does this. Gah.
}
// Also corresponding SSE rounding mode setting
if (FPSCR.NI)
{
// Either one of these two breaks Beyond Good & Evil.
// if (cpu_info.bSSSE3)
// csr |= DAZ;
// csr |= FTZ;
}
FPURoundMode::SetSIMDMode(FPSCR.RN);
// Set SSE rounding mode and denormal handling
FPURoundMode::SetSIMDMode(FPSCR.RN, FPSCR.NI);
}
void Interpreter::mtfsb0x(UGeckoInstruction _inst)
+2 -2
View File
@@ -119,7 +119,7 @@ public:
void tri_op(int d, int a, int b, bool reversible, void (XEmitter::*op)(Gen::X64Reg, Gen::OpArg));
typedef u32 (*Operation)(u32 a, u32 b);
void regimmop(int d, int a, bool binary, u32 value, Operation doop, void (XEmitter::*op)(int, const Gen::OpArg&, const Gen::OpArg&), bool Rc = false, bool carry = false);
void fp_tri_op(int d, int a, int b, bool reversible, bool dupe, void (XEmitter::*op)(Gen::X64Reg, Gen::OpArg));
void fp_tri_op(int d, int a, int b, bool reversible, bool dupe, void (XEmitter::*op_2)(Gen::X64Reg, Gen::OpArg), void (XEmitter::*op_3)(Gen::X64Reg, Gen::X64Reg, Gen::OpArg));
// OPCODES
void unknown_instruction(UGeckoInstruction _inst);
@@ -182,7 +182,7 @@ public:
void ps_sum(UGeckoInstruction inst);
void ps_muls(UGeckoInstruction inst);
void fp_arith_s(UGeckoInstruction inst);
void fp_arith(UGeckoInstruction inst);
void frsqrtex(UGeckoInstruction inst);
void fcmpx(UGeckoInstruction inst);
@@ -320,12 +320,12 @@ static GekkoOPTemplate table31_2[] =
static GekkoOPTemplate table59[] =
{
{18, &Jit64::Default}, //{"fdivsx", OPTYPE_FPU, FL_RC_BIT_F, 16}},
{20, &Jit64::fp_arith_s}, //"fsubsx", OPTYPE_FPU, FL_RC_BIT_F}},
{21, &Jit64::fp_arith_s}, //"faddsx", OPTYPE_FPU, FL_RC_BIT_F}},
{18, &Jit64::fp_arith}, //{"fdivsx", OPTYPE_FPU, FL_RC_BIT_F, 16}},
{20, &Jit64::fp_arith}, //"fsubsx", OPTYPE_FPU, FL_RC_BIT_F}},
{21, &Jit64::fp_arith}, //"faddsx", OPTYPE_FPU, FL_RC_BIT_F}},
// {22, &Jit64::Default}, //"fsqrtsx", OPTYPE_FPU, FL_RC_BIT_F}}, // Not implemented on gekko
{24, &Jit64::Default}, //"fresx", OPTYPE_FPU, FL_RC_BIT_F}},
{25, &Jit64::fp_arith_s}, //"fmulsx", OPTYPE_FPU, FL_RC_BIT_F}},
{25, &Jit64::fp_arith}, //"fmulsx", OPTYPE_FPU, FL_RC_BIT_F}},
{28, &Jit64::fmaddXX}, //"fmsubsx", OPTYPE_FPU, FL_RC_BIT_F}},
{29, &Jit64::fmaddXX}, //"fmaddsx", OPTYPE_FPU, FL_RC_BIT_F}},
{30, &Jit64::fmaddXX}, //"fnmsubsx", OPTYPE_FPU, FL_RC_BIT_F}},
@@ -354,12 +354,12 @@ static GekkoOPTemplate table63[] =
static GekkoOPTemplate table63_2[] =
{
{18, &Jit64::Default}, //"fdivx", OPTYPE_FPU, FL_RC_BIT_F, 30}},
{20, &Jit64::Default}, //"fsubx", OPTYPE_FPU, FL_RC_BIT_F}},
{21, &Jit64::Default}, //"faddx", OPTYPE_FPU, FL_RC_BIT_F}},
{18, &Jit64::fp_arith}, //"fdivx", OPTYPE_FPU, FL_RC_BIT_F, 30}},
{20, &Jit64::fp_arith}, //"fsubx", OPTYPE_FPU, FL_RC_BIT_F}},
{21, &Jit64::fp_arith}, //"faddx", OPTYPE_FPU, FL_RC_BIT_F}},
{22, &Jit64::Default}, //"fsqrtx", OPTYPE_FPU, FL_RC_BIT_F}},
{23, &Jit64::Default}, //"fselx", OPTYPE_FPU, FL_RC_BIT_F}},
{25, &Jit64::fp_arith_s}, //"fmulx", OPTYPE_FPU, FL_RC_BIT_F}},
{25, &Jit64::fp_arith}, //"fmulx", OPTYPE_FPU, FL_RC_BIT_F}},
{26, &Jit64::frsqrtex}, //"frsqrtex", OPTYPE_FPU, FL_RC_BIT_F}},
{28, &Jit64::fmaddXX}, //"fmsubx", OPTYPE_FPU, FL_RC_BIT_F}},
{29, &Jit64::fmaddXX}, //"fmaddx", OPTYPE_FPU, FL_RC_BIT_F}},
@@ -166,7 +166,7 @@ int RegCache::SanityCheck() const
void RegCache::DiscardRegContentsIfCached(int preg)
{
if (regs[preg].away && regs[preg].location.IsSimpleReg())
if (IsBound(preg))
{
X64Reg xr = regs[preg].location.GetSimpleReg();
xregs[xr].free = true;
@@ -351,11 +351,12 @@ void FPURegCache::StoreFromRegister(int i)
{
X64Reg xr = regs[i].location.GetSimpleReg();
_assert_msg_(DYNA_REC, xr < NUMXREGS, "WTF - store - invalid reg");
OpArg newLoc = GetDefaultLocation(i);
if (xregs[xr].dirty)
emit->MOVAPD(newLoc, xr);
xregs[xr].free = true;
xregs[xr].dirty = false;
xregs[xr].ppcReg = -1;
OpArg newLoc = GetDefaultLocation(i);
emit->MOVAPD(newLoc, xr);
regs[i].location = newLoc;
regs[i].away = false;
}
@@ -93,7 +93,7 @@ public:
const OpArg &R(int preg) const {return regs[preg].location;}
X64Reg RX(int preg) const
{
if (regs[preg].away && regs[preg].location.IsSimpleReg())
if (IsBound(preg))
return regs[preg].location.GetSimpleReg();
PanicAlert("Not so simple - %i", preg);
return (X64Reg)-1;
@@ -111,6 +111,11 @@ public:
return xregs[xreg].free && !xlocks[xreg];
}
bool IsBound(int preg) const
{
return regs[preg].away && regs[preg].location.IsSimpleReg();
}
X64Reg GetFreeXReg();
@@ -13,37 +13,62 @@ static const u64 GC_ALIGNED16(psAbsMask2[2]) = {0x7FFFFFFFFFFFFFFFULL, 0x7FFFFF
static const double GC_ALIGNED16(psOneOne2[2]) = {1.0, 1.0};
static const double one_const = 1.0f;
void Jit64::fp_tri_op(int d, int a, int b, bool reversible, bool dupe, void (XEmitter::*op)(Gen::X64Reg, Gen::OpArg))
void Jit64::fp_tri_op(int d, int a, int b, bool reversible, bool single,
void (XEmitter::*op_2)(Gen::X64Reg, Gen::OpArg),
void (XEmitter::*op_3)(Gen::X64Reg, Gen::X64Reg, Gen::OpArg))
{
if (!cpu_info.bAVX)
{
op_3 = nullptr;
}
fpr.Lock(d, a, b);
if (d == a)
{
fpr.BindToRegister(d, true);
(this->*op)(fpr.RX(d), fpr.R(b));
fpr.BindToRegister(d);
(this->*op_2)(fpr.RX(d), fpr.R(b));
}
else if (d == b)
{
if (reversible)
{
fpr.BindToRegister(d, true);
(this->*op)(fpr.RX(d), fpr.R(a));
fpr.BindToRegister(d);
(this->*op_2)(fpr.RX(d), fpr.R(a));
}
else
{
MOVSD(XMM0, fpr.R(b));
fpr.BindToRegister(d, !dupe);
MOVSD(fpr.RX(d), fpr.R(a));
(this->*op)(fpr.RX(d), Gen::R(XMM0));
if (op_3)
{
fpr.BindToRegister(d);
fpr.BindToRegister(a, true, false);
(this->*op_3)(fpr.RX(d), fpr.RX(a), fpr.R(b));
}
else
{
MOVSD(XMM0, fpr.R(b));
fpr.BindToRegister(d, false);
MOVSD(fpr.RX(d), fpr.R(a));
(this->*op_2)(fpr.RX(d), Gen::R(XMM0));
}
}
}
else
{
// Sources different from d, can use rather quick solution
fpr.BindToRegister(d, !dupe);
MOVSD(fpr.RX(d), fpr.R(a));
(this->*op)(fpr.RX(d), fpr.R(b));
if (op_3)
{
fpr.BindToRegister(d, false);
fpr.BindToRegister(a);
(this->*op_3)(fpr.RX(d), fpr.RX(a), fpr.R(b));
}
else
{
fpr.BindToRegister(d, false);
MOVSD(fpr.RX(d), fpr.R(a));
(this->*op_2)(fpr.RX(d), fpr.R(b));
}
}
if (dupe)
if (single)
{
ForceSinglePrecisionS(fpr.RX(d));
if (cpu_info.bSSE3)
@@ -60,7 +85,7 @@ void Jit64::fp_tri_op(int d, int a, int b, bool reversible, bool dupe, void (XEm
fpr.UnlockAll();
}
void Jit64::fp_arith_s(UGeckoInstruction inst)
void Jit64::fp_arith(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(bJITFloatingPointOff)
@@ -73,31 +98,38 @@ void Jit64::fp_arith_s(UGeckoInstruction inst)
Default(inst); return;
}
bool dupe = inst.OPCD == 59;
bool single = inst.OPCD == 59;
switch (inst.SUBOP5)
{
case 18: fp_tri_op(inst.FD, inst.FA, inst.FB, false, dupe, &XEmitter::DIVSD); break; //div
case 20: fp_tri_op(inst.FD, inst.FA, inst.FB, false, dupe, &XEmitter::SUBSD); break; //sub
case 21: fp_tri_op(inst.FD, inst.FA, inst.FB, true, dupe, &XEmitter::ADDSD); break; //add
case 25: fp_tri_op(inst.FD, inst.FA, inst.FC, true, dupe, &XEmitter::MULSD); break; //mul
case 18: fp_tri_op(inst.FD, inst.FA, inst.FB, false, single, &XEmitter::DIVSD, &XEmitter::VDIVSD); break; //div
case 20: fp_tri_op(inst.FD, inst.FA, inst.FB, false, single, &XEmitter::SUBSD, &XEmitter::VSUBSD); break; //sub
case 21: fp_tri_op(inst.FD, inst.FA, inst.FB, true, single, &XEmitter::ADDSD, &XEmitter::VADDSD); break; //add
case 25: fp_tri_op(inst.FD, inst.FA, inst.FC, true, single, &XEmitter::MULSD, &XEmitter::VMULSD); break; //mul
default:
_assert_msg_(DYNA_REC, 0, "fp_arith_s WTF!!!");
_assert_msg_(DYNA_REC, 0, "fp_arith WTF!!!");
}
}
void Jit64::frsqrtex(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(bJITFloatingPointOff)
int d = inst.FD;
int b = inst.FB;
fpr.Lock(b, d);
fpr.BindToRegister(d, true, true);
MOVSD(XMM0, M((void *)&one_const));
SQRTSD(XMM1, fpr.R(b));
DIVSD(XMM0, R(XMM1));
MOVSD(fpr.R(d), XMM0);
fpr.UnlockAll();
INSTRUCTION_START
JITDISABLE(bJITFloatingPointOff)
int d = inst.FD;
int b = inst.FB;
fpr.Lock(b, d);
fpr.BindToRegister(d, d == b, true);
MOVSD(XMM0, M((void *)&one_const));
SQRTSD(XMM1, fpr.R(b));
if (cpu_info.bAVX)
{
VDIVSD(fpr.RX(d), XMM0, R(XMM1));
}
else
{
DIVSD(XMM0, R(XMM1));
MOVSD(fpr.R(d), XMM0);
}
fpr.UnlockAll();
}
void Jit64::fmaddXX(UGeckoInstruction inst)
@@ -192,16 +224,28 @@ void Jit64::fmrx(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(bJITFloatingPointOff)
if (inst.Rc) {
if (inst.Rc)
{
Default(inst); return;
}
int d = inst.FD;
int b = inst.FB;
fpr.Lock(b, d);
fpr.BindToRegister(d, true, true);
MOVSD(XMM0, fpr.R(b));
MOVSD(fpr.R(d), XMM0);
fpr.UnlockAll();
if (d != b)
{
fpr.Lock(b, d);
// we don't need to load d, but if it already is, it must be marked as dirty
if (fpr.IsBound(d))
{
fpr.BindToRegister(d);
}
fpr.BindToRegister(b, true, false);
// caveat: the order of ModRM:r/m, ModRM:reg is deliberate!
// "MOVSD reg, mem" zeros out the upper half of the destination register
MOVSD(fpr.R(d), fpr.RX(b));
fpr.UnlockAll();
}
}
void Jit64::fcmpx(UGeckoInstruction inst)
@@ -122,12 +122,6 @@ void Jit64::psq_l(UGeckoInstruction inst)
const UGQR gqr(rSPR(SPR_GQR0 + inst.I));
if (inst.W) {
// PanicAlert("Single ps load: %i %i", gqr.ST_TYPE, gqr.ST_SCALE);
Default(inst);
return;
}
bool update = inst.OPCD == 57;
int offset = inst.SIMM_12;
@@ -143,6 +137,8 @@ void Jit64::psq_l(UGeckoInstruction inst)
MOV(32, gpr.R(inst.RA), R(ECX));
MOVZX(32, 16, EAX, M(((char *)&GQR(inst.I)) + 2));
MOVZX(32, 8, EDX, R(AL));
if (inst.W)
OR(32, R(EDX), Imm8(8));
#ifdef _M_IX86
int addr_scale = SCALE_4;
#else
@@ -14,10 +14,9 @@
// cmppd, andpd, andnpd, or
// lfsx, ps_merge01 etc
const u64 GC_ALIGNED16(psSignBits[2]) = {0x8000000000000000ULL, 0x8000000000000000ULL};
const u64 GC_ALIGNED16(psAbsMask[2]) = {0x7FFFFFFFFFFFFFFFULL, 0x7FFFFFFFFFFFFFFFULL};
const double GC_ALIGNED16(psOneOne[2]) = {1.0, 1.0};
const double GC_ALIGNED16(psZeroZero[2]) = {0.0, 0.0};
static const u64 GC_ALIGNED16(psSignBits[2]) = {0x8000000000000000ULL, 0x8000000000000000ULL};
static const u64 GC_ALIGNED16(psAbsMask[2]) = {0x7FFFFFFFFFFFFFFFULL, 0x7FFFFFFFFFFFFFFFULL};
static const double GC_ALIGNED16(psOneOne[2]) = {1.0, 1.0};
void Jit64::ps_mr(UGeckoInstruction inst)
{
@@ -52,14 +51,15 @@ void Jit64::ps_sel(UGeckoInstruction inst)
fpr.Lock(a, b, c, d);
MOVAPD(XMM0, fpr.R(a));
XORPD(XMM1, R(XMM1));
// XMM0 = XMM0 < 0 ? all 1s : all 0s
CMPPD(XMM0, M((void*)psZeroZero), LT);
CMPPD(XMM0, R(XMM1), LT);
MOVAPD(XMM1, R(XMM0));
ANDPD(XMM0, fpr.R(b));
ANDNPD(XMM1, fpr.R(c));
ORPD(XMM0, R(XMM1));
fpr.BindToRegister(d, false);
MOVAPD(fpr.RX(d), R(XMM0));
ORPD(fpr.RX(d), R(XMM1));
fpr.UnlockAll();
}
@@ -470,7 +470,7 @@ static void regEmitMemLoad(RegInfo& RI, InstLoc I, unsigned Size) {
X64Reg reg;
auto info = regBuildMemAddress(RI, I, getOp1(I), 1, Size, &reg);
RI.Jit->SafeLoadToReg(reg, info.first, Size, info.second, regsInUse(RI), false);
RI.Jit->SafeLoadToReg(reg, info.first, Size, info.second, regsInUse(RI), false, EmuCodeBlock::SAFE_LOADSTORE_NO_FASTMEM);
if (regReadUse(RI, I))
RI.regs[reg] = I;
}
@@ -498,7 +498,7 @@ static void regEmitMemStore(RegInfo& RI, InstLoc I, unsigned Size) {
} else {
RI.Jit->MOV(32, R(EAX), regLocForInst(RI, getOp1(I)));
}
RI.Jit->SafeWriteRegToReg(EAX, ECX, Size, 0, regsInUse(RI));
RI.Jit->SafeWriteRegToReg(EAX, ECX, Size, 0, regsInUse(RI), EmuCodeBlock::SAFE_LOADSTORE_NO_FASTMEM);
if (RI.IInfo[I - RI.FirstI] & 4)
regClearInst(RI, getOp1(I));
}
@@ -1188,7 +1188,7 @@ static void DoWriteCode(IRBuilder* ibuild, JitIL* Jit, u32 exitAddress) {
Jit->MOV(32, R(EAX), loc1);
}
Jit->MOV(32, R(ECX), regLocForInst(RI, getOp2(I)));
RI.Jit->SafeWriteRegToReg(EAX, ECX, 32, 0, regsInUse(RI));
RI.Jit->SafeWriteRegToReg(EAX, ECX, 32, 0, regsInUse(RI), EmuCodeBlock::SAFE_LOADSTORE_NO_FASTMEM);
if (RI.IInfo[I - RI.FirstI] & 4)
fregClearInst(RI, getOp1(I));
if (RI.IInfo[I - RI.FirstI] & 8)
@@ -1251,12 +1251,12 @@ static void DoWriteCode(IRBuilder* ibuild, JitIL* Jit, u32 exitAddress) {
Jit->PSRLQ(XMM0, 32);
Jit->MOVD_xmm(R(EAX), XMM0);
Jit->MOV(32, R(ECX), address);
RI.Jit->SafeWriteRegToReg(EAX, ECX, 32, 0, regsInUse(RI));
RI.Jit->SafeWriteRegToReg(EAX, ECX, 32, 0, regsInUse(RI), EmuCodeBlock::SAFE_LOADSTORE_NO_FASTMEM);
Jit->MOVAPD(XMM0, value);
Jit->MOVD_xmm(R(EAX), XMM0);
Jit->MOV(32, R(ECX), address);
RI.Jit->SafeWriteRegToReg(EAX, ECX, 32, 4, regsInUse(RI));
RI.Jit->SafeWriteRegToReg(EAX, ECX, 32, 4, regsInUse(RI), EmuCodeBlock::SAFE_LOADSTORE_NO_FASTMEM);
Jit->SetJumpTarget(exit);
if (RI.IInfo[I - RI.FirstI] & 4)
@@ -3,6 +3,8 @@
// Refer to the license.txt file included.
#include <map>
#include <memory>
#include <cinttypes>
#include "Common.h"
#include "../../HLE/HLE.h"
@@ -217,14 +219,14 @@ namespace JitILProfiler
const u64 totalElapsed = block.totalElapsed;
const u64 numberOfCalls = block.numberOfCalls;
const double elapsedPerCall = totalElapsed / (double)numberOfCalls;
fprintf(file.GetHandle(), "%016llx,%lld,%lld,%f\n", codeHash, totalElapsed, numberOfCalls, elapsedPerCall);
fprintf(file.GetHandle(), "%016" PRIx64 ",%" PRId64 ",%" PRId64 ",%f\n", codeHash, totalElapsed, numberOfCalls, elapsedPerCall);
}
}
};
std::auto_ptr<JitILProfilerFinalizer> finalizer;
std::unique_ptr<JitILProfilerFinalizer> finalizer;
static void Init()
{
finalizer = std::auto_ptr<JitILProfilerFinalizer>(new JitILProfilerFinalizer);
finalizer = std::unique_ptr<JitILProfilerFinalizer>(new JitILProfilerFinalizer);
}
static void Shutdown()
{
+1 -7
View File
@@ -58,14 +58,10 @@ private:
JitBlockCache blocks;
TrampolineCache trampolines;
// The default code buffer. We keep it around to not have to alloc/dealloc a
// large chunk of memory for each recompiled block.
PPCAnalyst::CodeBuffer code_buffer;
public:
JitILAsmRoutineManager asm_routines;
JitIL() : code_buffer(32000) {}
JitIL() {}
~JitIL() {}
// Initialization, etc
@@ -140,6 +136,4 @@ public:
void DynaRunTable63(UGeckoInstruction _inst) override;
};
void Jit(u32 em_address);
#endif // _JITIL_H
@@ -196,7 +196,7 @@ void CommonAsmRoutines::GenQuantizedStores()
PACKSSDW(XMM0, R(XMM0));
PACKUSWB(XMM0, R(XMM0));
MOVD_xmm(R(EAX), XMM0);
SafeWriteRegToReg(AX, ECX, 16, 0, QUANTIZED_REGS_TO_SAVE, SAFE_WRITE_NO_SWAP | SAFE_WRITE_NO_PROLOG | SAFE_WRITE_NO_FASTMEM);
SafeWriteRegToReg(AX, ECX, 16, 0, QUANTIZED_REGS_TO_SAVE, SAFE_LOADSTORE_NO_SWAP | SAFE_LOADSTORE_NO_PROLOG | SAFE_LOADSTORE_NO_FASTMEM);
RET();
@@ -215,7 +215,7 @@ void CommonAsmRoutines::GenQuantizedStores()
PACKSSWB(XMM0, R(XMM0));
MOVD_xmm(R(EAX), XMM0);
SafeWriteRegToReg(AX, ECX, 16, 0, QUANTIZED_REGS_TO_SAVE, SAFE_WRITE_NO_SWAP | SAFE_WRITE_NO_PROLOG | SAFE_WRITE_NO_FASTMEM);
SafeWriteRegToReg(AX, ECX, 16, 0, QUANTIZED_REGS_TO_SAVE, SAFE_LOADSTORE_NO_SWAP | SAFE_LOADSTORE_NO_PROLOG | SAFE_LOADSTORE_NO_FASTMEM);
RET();
@@ -241,7 +241,7 @@ void CommonAsmRoutines::GenQuantizedStores()
MOV(16, R(AX), M((char*)psTemp + 4));
BSWAP(32, EAX);
SafeWriteRegToReg(EAX, ECX, 32, 0, QUANTIZED_REGS_TO_SAVE, SAFE_WRITE_NO_SWAP | SAFE_WRITE_NO_PROLOG | SAFE_WRITE_NO_FASTMEM);
SafeWriteRegToReg(EAX, ECX, 32, 0, QUANTIZED_REGS_TO_SAVE, SAFE_LOADSTORE_NO_SWAP | SAFE_LOADSTORE_NO_PROLOG | SAFE_LOADSTORE_NO_FASTMEM);
RET();
@@ -261,7 +261,7 @@ void CommonAsmRoutines::GenQuantizedStores()
MOVD_xmm(R(EAX), XMM0);
BSWAP(32, EAX);
ROL(32, R(EAX), Imm8(16));
SafeWriteRegToReg(EAX, ECX, 32, 0, QUANTIZED_REGS_TO_SAVE, SAFE_WRITE_NO_SWAP | SAFE_WRITE_NO_PROLOG | SAFE_WRITE_NO_FASTMEM);
SafeWriteRegToReg(EAX, ECX, 32, 0, QUANTIZED_REGS_TO_SAVE, SAFE_LOADSTORE_NO_SWAP | SAFE_LOADSTORE_NO_PROLOG | SAFE_LOADSTORE_NO_FASTMEM);
RET();
@@ -286,7 +286,7 @@ void CommonAsmRoutines::GenQuantizedSingleStores()
// Easy!
const u8* storeSingleFloat = AlignCode4();
SafeWriteFloatToReg(XMM0, ECX, QUANTIZED_REGS_TO_SAVE, SAFE_WRITE_NO_PROLOG | SAFE_WRITE_NO_FASTMEM);
SafeWriteFloatToReg(XMM0, ECX, QUANTIZED_REGS_TO_SAVE, SAFE_LOADSTORE_NO_PROLOG | SAFE_LOADSTORE_NO_FASTMEM);
RET();
/*
if (cpu_info.bSSSE3) {
@@ -294,11 +294,11 @@ void CommonAsmRoutines::GenQuantizedSingleStores()
// TODO: SafeWriteFloat
MOVSS(M(&psTemp[0]), XMM0);
MOV(32, R(EAX), M(&psTemp[0]));
SafeWriteRegToReg(EAX, ECX, 32, 0, SAFE_WRITE_NO_SWAP | SAFE_WRITE_NO_PROLOG | SAFE_WRITE_NO_FASTMEM);
SafeWriteRegToReg(EAX, ECX, 32, 0, SAFE_LOADSTORE_NO_SWAP | SAFE_LOADSTORE_NO_PROLOG | SAFE_LOADSTORE_NO_FASTMEM);
} else {
MOVSS(M(&psTemp[0]), XMM0);
MOV(32, R(EAX), M(&psTemp[0]));
SafeWriteRegToReg(EAX, ECX, 32, 0, SAFE_WRITE_NO_PROLOG | SAFE_WRITE_NO_FASTMEM);
SafeWriteRegToReg(EAX, ECX, 32, 0, SAFE_LOADSTORE_NO_PROLOG | SAFE_LOADSTORE_NO_FASTMEM);
}*/
const u8* storeSingleU8 = AlignCode4(); // Used by MKWii
@@ -309,7 +309,7 @@ void CommonAsmRoutines::GenQuantizedSingleStores()
MAXSS(XMM0, R(XMM1));
MINSS(XMM0, M((void *)&m_255));
CVTTSS2SI(EAX, R(XMM0));
SafeWriteRegToReg(AL, ECX, 8, 0, QUANTIZED_REGS_TO_SAVE, SAFE_WRITE_NO_PROLOG | SAFE_WRITE_NO_FASTMEM);
SafeWriteRegToReg(AL, ECX, 8, 0, QUANTIZED_REGS_TO_SAVE, SAFE_LOADSTORE_NO_PROLOG | SAFE_LOADSTORE_NO_FASTMEM);
RET();
const u8* storeSingleS8 = AlignCode4();
@@ -319,7 +319,7 @@ void CommonAsmRoutines::GenQuantizedSingleStores()
MAXSS(XMM0, M((void *)&m_m128));
MINSS(XMM0, M((void *)&m_127));
CVTTSS2SI(EAX, R(XMM0));
SafeWriteRegToReg(AL, ECX, 8, 0, QUANTIZED_REGS_TO_SAVE, SAFE_WRITE_NO_PROLOG | SAFE_WRITE_NO_FASTMEM);
SafeWriteRegToReg(AL, ECX, 8, 0, QUANTIZED_REGS_TO_SAVE, SAFE_LOADSTORE_NO_PROLOG | SAFE_LOADSTORE_NO_FASTMEM);
RET();
const u8* storeSingleU16 = AlignCode4(); // Used by MKWii
@@ -330,7 +330,7 @@ void CommonAsmRoutines::GenQuantizedSingleStores()
MAXSS(XMM0, R(XMM1));
MINSS(XMM0, M((void *)&m_65535));
CVTTSS2SI(EAX, R(XMM0));
SafeWriteRegToReg(EAX, ECX, 16, 0, QUANTIZED_REGS_TO_SAVE, SAFE_WRITE_NO_PROLOG | SAFE_WRITE_NO_FASTMEM);
SafeWriteRegToReg(EAX, ECX, 16, 0, QUANTIZED_REGS_TO_SAVE, SAFE_LOADSTORE_NO_PROLOG | SAFE_LOADSTORE_NO_FASTMEM);
RET();
const u8* storeSingleS16 = AlignCode4();
@@ -340,7 +340,7 @@ void CommonAsmRoutines::GenQuantizedSingleStores()
MAXSS(XMM0, M((void *)&m_m32768));
MINSS(XMM0, M((void *)&m_32767));
CVTTSS2SI(EAX, R(XMM0));
SafeWriteRegToReg(EAX, ECX, 16, 0, QUANTIZED_REGS_TO_SAVE, SAFE_WRITE_NO_PROLOG | SAFE_WRITE_NO_FASTMEM);
SafeWriteRegToReg(EAX, ECX, 16, 0, QUANTIZED_REGS_TO_SAVE, SAFE_LOADSTORE_NO_PROLOG | SAFE_LOADSTORE_NO_FASTMEM);
RET();
singleStoreQuantized = reinterpret_cast<const u8**>(const_cast<u8*>(AlignCode16()));
@@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include <string>
#include <cinttypes>
#include "Common.h"
#include "disasm.h"
@@ -32,7 +33,7 @@ static void BackPatchError(const std::string &text, u8 *codePtr, u32 emAddress)
#endif
PanicAlert("%s\n\n"
"Error encountered accessing emulated address %08x.\n"
"Culprit instruction: \n%s\nat %#llx",
"Culprit instruction: \n%s\nat %#" PRIx64,
text.c_str(), emAddress, disbuf, code_addr);
return;
}
@@ -233,7 +234,7 @@ const u8 *Jitx86Base::BackPatch(u8 *codePtr, u32 emAddress, void *ctx_void)
XEmitter emitter(start);
const u8 *trampoline = trampolines.GetWriteTrampoline(info, registersInUse);
emitter.CALL((void *)trampoline);
emitter.NOP(codePtr + info.instructionSize - emitter.GetCodePtr());
emitter.NOP((int)(codePtr + info.instructionSize - emitter.GetCodePtr()));
return start;
}
#else
@@ -117,18 +117,20 @@ u8 *EmuCodeBlock::UnsafeLoadToReg(X64Reg reg_value, Gen::OpArg opAddress, int ac
return result;
}
void EmuCodeBlock::SafeLoadToReg(X64Reg reg_value, const Gen::OpArg & opAddress, int accessSize, s32 offset, u32 registersInUse, bool signExtend)
void EmuCodeBlock::SafeLoadToReg(X64Reg reg_value, const Gen::OpArg & opAddress, int accessSize, s32 offset, u32 registersInUse, bool signExtend, int flags)
{
if (!jit->js.memcheck)
{
registersInUse &= ~(1 << RAX | 1 << reg_value);
}
#if defined(_M_X64)
if (!Core::g_CoreStartupParameter.bMMU &&
Core::g_CoreStartupParameter.bFastmem &&
!(flags & (SAFE_LOADSTORE_NO_SWAP | SAFE_LOADSTORE_NO_FASTMEM))
#ifdef ENABLE_MEM_CHECK
if (!Core::g_CoreStartupParameter.bMMU && !Core::g_CoreStartupParameter.bEnableDebugging && Core::g_CoreStartupParameter.bFastmem)
#else
if (!Core::g_CoreStartupParameter.bMMU && Core::g_CoreStartupParameter.bFastmem)
&& !Core::g_CoreStartupParameter.bEnableDebugging
#endif
)
{
u8 *mov = UnsafeLoadToReg(reg_value, opAddress, accessSize, offset, signExtend);
@@ -282,14 +284,14 @@ void EmuCodeBlock::SafeWriteRegToReg(X64Reg reg_value, X64Reg reg_addr, int acce
#if defined(_M_X64)
if (!Core::g_CoreStartupParameter.bMMU &&
Core::g_CoreStartupParameter.bFastmem &&
!(flags & (SAFE_WRITE_NO_SWAP | SAFE_WRITE_NO_FASTMEM))
!(flags & (SAFE_LOADSTORE_NO_SWAP | SAFE_LOADSTORE_NO_FASTMEM))
#ifdef ENABLE_MEM_CHECK
&& !Core::g_CoreStartupParameter.bEnableDebugging
#endif
)
{
MOV(32, M(&PC), Imm32(jit->js.compilerPC)); // Helps external systems know which instruction triggered the write
u8 *mov = UnsafeWriteRegToReg(reg_value, reg_addr, accessSize, offset, !(flags & SAFE_WRITE_NO_SWAP));
u8 *mov = UnsafeWriteRegToReg(reg_value, reg_addr, accessSize, offset, !(flags & SAFE_LOADSTORE_NO_SWAP));
if (accessSize == 8)
{
NOP(1);
@@ -321,8 +323,8 @@ void EmuCodeBlock::SafeWriteRegToReg(X64Reg reg_value, X64Reg reg_addr, int acce
MOV(32, M(&PC), Imm32(jit->js.compilerPC)); // Helps external systems know which instruction triggered the write
TEST(32, R(reg_addr), Imm32(mem_mask));
FixupBranch fast = J_CC(CC_Z, true);
bool noProlog = flags & SAFE_WRITE_NO_PROLOG;
bool swap = !(flags & SAFE_WRITE_NO_SWAP);
bool noProlog = (0 != (flags & SAFE_LOADSTORE_NO_PROLOG));
bool swap = !(flags & SAFE_LOADSTORE_NO_SWAP);
ABI_PushRegistersAndAdjustStack(registersInUse, noProlog);
switch (accessSize)
{
@@ -28,13 +28,13 @@ public:
// these return the address of the MOV, for backpatching
u8 *UnsafeWriteRegToReg(Gen::X64Reg reg_value, Gen::X64Reg reg_addr, int accessSize, s32 offset = 0, bool swap = true);
u8 *UnsafeLoadToReg(Gen::X64Reg reg_value, Gen::OpArg opAddress, int accessSize, s32 offset, bool signExtend);
void SafeLoadToReg(Gen::X64Reg reg_value, const Gen::OpArg & opAddress, int accessSize, s32 offset, u32 registersInUse, bool signExtend);
enum SafeWriteFlags
enum SafeLoadStoreFlags
{
SAFE_WRITE_NO_SWAP = 1,
SAFE_WRITE_NO_PROLOG = 2,
SAFE_WRITE_NO_FASTMEM = 4
SAFE_LOADSTORE_NO_SWAP = 1,
SAFE_LOADSTORE_NO_PROLOG = 2,
SAFE_LOADSTORE_NO_FASTMEM = 4
};
void SafeLoadToReg(Gen::X64Reg reg_value, const Gen::OpArg & opAddress, int accessSize, s32 offset, u32 registersInUse, bool signExtend, int flags = 0);
void SafeWriteRegToReg(Gen::X64Reg reg_value, Gen::X64Reg reg_addr, int accessSize, s32 offset, u32 registersInUse, int flags = 0);
// Trashes both inputs and EAX.
@@ -118,6 +118,7 @@ Fix profiled loads/stores to work safely. On 32-bit, one solution is to
#include <algorithm>
#include <memory>
#include <cinttypes>
#include <ctime>
#include <set>
#include "IR.h"
@@ -1223,7 +1224,7 @@ struct Writer
virtual ~Writer() {}
};
static std::auto_ptr<Writer> writer;
static std::unique_ptr<Writer> writer;
static const std::string opcodeNames[] = {
"Nop", "LoadGReg", "LoadLink", "LoadCR", "LoadCarry", "LoadCTR",
@@ -1275,11 +1276,11 @@ void IRBuilder::WriteToFile(u64 codeHash) {
_assert_(sizeof(opcodeNames) / sizeof(opcodeNames[0]) == Int3 + 1);
if (!writer.get()) {
writer = std::auto_ptr<Writer>(new Writer);
writer = std::unique_ptr<Writer>(new Writer);
}
FILE* const file = writer->file.GetHandle();
fprintf(file, "\ncode hash:%016llx\n", codeHash);
fprintf(file, "\ncode hash:%016" PRIx64 "\n", codeHash);
const InstLoc lastCurReadPtr = curReadPtr;
StartForwardPass();
@@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include <algorithm>
#include <cinttypes>
#ifdef _WIN32
#include <windows.h>
@@ -171,12 +172,12 @@ namespace JitInterface
double percent = 100.0 * (double)stat.cost / (double)cost_sum;
#ifdef _WIN32
double timePercent = 100.0 * (double)block->ticCounter / (double)timecost_sum;
fprintf(f.GetHandle(), "%08x\t%s\t%llu\t%llu\t%.2lf\t%llf\t%lf\t%i\n",
fprintf(f.GetHandle(), "%08x\t%s\t%" PRIu64 "\t%" PRIu64 "\t%.2lf\t%llf\t%lf\t%i\n",
block->originalAddress, name.c_str(), stat.cost,
block->ticCounter, percent, timePercent,
(double)block->ticCounter*1000.0/(double)countsPerSec, block->codeSize);
#else
fprintf(f.GetHandle(), "%08x\t%s\t%llu\t???\t%.2lf\t???\t???\t%i\n",
fprintf(f.GetHandle(), "%08x\t%s\t%" PRIu64 "\t???\t%.2lf\t???\t???\t%i\n",
block->originalAddress, name.c_str(), stat.cost, percent, block->codeSize);
#endif
}
+36 -34
View File
@@ -4,6 +4,7 @@
#include <algorithm>
#include <vector>
#include <cinttypes>
#include "Common.h"
#include "PPCTables.h"
@@ -13,24 +14,15 @@
#include "Interpreter/Interpreter_Tables.h"
#include "JitInterface.h"
struct op_inf
{
const char *name;
int count;
bool operator < (const op_inf &o) const
{
return count > o.count;
}
};
GekkoOPInfo *m_infoTable[64];
GekkoOPInfo *m_infoTable4[1024];
GekkoOPInfo *m_infoTable19[1024];
GekkoOPInfo *m_infoTable31[1024];
GekkoOPInfo *m_infoTable59[32];
GekkoOPInfo *m_infoTable63[1024];
GekkoOPInfo *m_infoTable[64];
GekkoOPInfo *m_infoTable4[1024];
GekkoOPInfo *m_infoTable19[1024];
GekkoOPInfo *m_infoTable31[1024];
GekkoOPInfo *m_infoTable59[32];
GekkoOPInfo *m_infoTable63[1024];
GekkoOPInfo *m_allInstructions[512];
int m_numInstructions;
GekkoOPInfo *m_allInstructions[512];
int m_numInstructions;
GekkoOPInfo *GetOpInfo(UGeckoInstruction _inst)
{
@@ -181,26 +173,34 @@ void CountInstruction(UGeckoInstruction _inst)
{
GekkoOPInfo *info = GetOpInfo(_inst);
if (info)
{
info->runCount++;
}
}
void PrintInstructionRunCounts()
{
std::vector<op_inf> temp;
for (int i = 0; i < m_numInstructions; i++)
typedef std::pair<const char*, u64> OpInfo;
std::vector<OpInfo> temp;
temp.reserve(m_numInstructions);
for (int i = 0; i < m_numInstructions; ++i)
{
op_inf x;
x.name = m_allInstructions[i]->opname;
x.count = m_allInstructions[i]->runCount;
temp.push_back(x);
GekkoOPInfo *pInst = m_allInstructions[i];
temp.emplace_back(pInst->opname, pInst->runCount);
}
std::sort(temp.begin(), temp.end());
for (int i = 0; i < m_numInstructions; i++)
std::sort(temp.begin(), temp.end(),
[](const OpInfo &a, const OpInfo &b)
{
return a.second > b.second;
});
for (auto &inst : temp)
{
if (temp[i].count == 0)
if (inst.second == 0)
break;
DEBUG_LOG(POWERPC, "%s : %i", temp[i].name,temp[i].count);
//PanicAlert("%s : %i", temp[i].name,temp[i].count);
DEBUG_LOG(POWERPC, "%s : %llu", inst.first, inst.second);
//PanicAlert("%s : %llu", inst.first, inst.second);
}
}
@@ -211,20 +211,22 @@ void LogCompiledInstructions()
File::IOFile f(StringFromFormat("%sinst_log%i.txt", File::GetUserPath(D_LOGS_IDX).c_str(), time), "w");
for (int i = 0; i < m_numInstructions; i++)
{
if (m_allInstructions[i]->compileCount > 0)
GekkoOPInfo *pInst = m_allInstructions[i];
if (pInst->compileCount > 0)
{
fprintf(f.GetHandle(), "%s\t%i\t%lld\t%08x\n", m_allInstructions[i]->opname,
m_allInstructions[i]->compileCount, m_allInstructions[i]->runCount, m_allInstructions[i]->lastUse);
fprintf(f.GetHandle(), "%s\t%i\t%" PRId64 "\t%08x\n", pInst->opname,
pInst->compileCount, pInst->runCount, pInst->lastUse);
}
}
f.Open(StringFromFormat("%sinst_not%i.txt", File::GetUserPath(D_LOGS_IDX).c_str(), time), "w");
for (int i = 0; i < m_numInstructions; i++)
{
if (m_allInstructions[i]->compileCount == 0)
GekkoOPInfo *pInst = m_allInstructions[i];
if (pInst->compileCount == 0)
{
fprintf(f.GetHandle(), "%s\t%i\t%lld\n", m_allInstructions[i]->opname,
m_allInstructions[i]->compileCount, m_allInstructions[i]->runCount);
fprintf(f.GetHandle(), "%s\t%i\t%" PRId64 "\n", pInst->opname,
pInst->compileCount, pInst->runCount);
}
}
+6 -2
View File
@@ -247,7 +247,7 @@ void CompressAndDumpState(CompressAndDumpState_args save_args)
// Setting up the header
StateHeader header;
memcpy(header.gameID, SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID().c_str(), 6);
header.size = g_use_compression ? buffer_size : 0;
header.size = g_use_compression ? (u32)buffer_size : 0;
header.time = Common::Timer::GetDoubleTime();
f.WriteArray(&header, 1);
@@ -261,9 +261,13 @@ void CompressAndDumpState(CompressAndDumpState_args save_args)
lzo_uint out_len = 0;
if ((i + IN_LEN) >= buffer_size)
cur_len = buffer_size - i;
{
cur_len = (lzo_uint32)(buffer_size - i);
}
else
{
cur_len = IN_LEN;
}
if (lzo1x_1_compress(buffer_data + i, cur_len, out, &out_len, wrkmem) != LZO_E_OK)
PanicAlertT("Internal LZO Error - compression failed");