summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorhrydgard <hrydgard@gmail.com>2008-08-13 22:28:36 +0000
committerhrydgard <hrydgard@gmail.com>2008-08-13 22:28:36 +0000
commit96ca347bdcc833fe0aa175175850580149f4f784 (patch)
treec12134914a427b5fb3340bdd9876ec9797da0c18 /Source/Core
parente4792fafaf04e5285ca469cfac7d2c6860280305 (diff)
Fix sign extension bug from hardware reads. Mainly seems to affect homebrew apps.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@193 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Src/Boot/Boot_DOL.cpp4
-rw-r--r--Source/Core/Core/Src/PowerPC/Jit64/Jit_Branch.cpp17
-rw-r--r--Source/Core/Core/Src/PowerPC/Jit64/Jit_Util.cpp3
3 files changed, 17 insertions, 7 deletions
diff --git a/Source/Core/Core/Src/Boot/Boot_DOL.cpp b/Source/Core/Core/Src/Boot/Boot_DOL.cpp
index 0c53dc3297..2982a7348f 100644
--- a/Source/Core/Core/Src/Boot/Boot_DOL.cpp
+++ b/Source/Core/Core/Src/Boot/Boot_DOL.cpp
@@ -33,7 +33,7 @@ CDolLoader::CDolLoader(const char* _szFilename) : m_bInit(false)
p[i] = Common::swap32(p[i]);
// load all text (code) sections
- for(int i=0; i<DOL_NUM_TEXT; i++)
+ for(int i = 0; i < DOL_NUM_TEXT; i++)
{
if(m_dolheader.textOffset[i] != 0)
{
@@ -50,7 +50,7 @@ CDolLoader::CDolLoader(const char* _szFilename) : m_bInit(false)
}
// load all data sections
- for(int i=0; i<DOL_NUM_DATA; i++)
+ for(int i = 0; i < DOL_NUM_DATA; i++)
{
if(m_dolheader.dataOffset[i] != 0)
{
diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Branch.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Branch.cpp
index 4755e7433e..5a56f84270 100644
--- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Branch.cpp
+++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Branch.cpp
@@ -15,8 +15,10 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "Common.h"
+#include "Thunk.h"
#include "../PowerPC.h"
+#include "../../CoreTiming.h"
#include "../PPCTables.h"
#include "x64Emitter.h"
@@ -85,7 +87,12 @@ namespace Jit64
if (inst.LK)
AND(32, M(&CR), Imm32(~(0xFF000000)));
#endif
-
+ //if (destination == js.compilerPC)
+ //{
+ //PanicAlert("Idle loop detected at %08x", destination);
+ // CALL(ProtectFunction(&CoreTiming::Idle, 0));
+ // JMP(Asm::testExceptions, true);
+ //}
WriteExit(destination, 0);
}
else {
@@ -106,10 +113,10 @@ namespace Jit64
CCFlags branch;
- const bool only_counter_check = ((inst.BO >> 4) & 1);
- const bool only_condition_check = ((inst.BO >> 2) & 1);
- if (only_condition_check && only_counter_check)
- PanicAlert("Bizarre bcx encountered. Likely bad or corrupt code.");
+ const bool only_counter_check = (inst.BO & 16) ? true : false;
+ const bool only_condition_check = (inst.BO & 4) ? true : false;
+ //if (only_condition_check && only_counter_check)
+ // PanicAlert("Bizarre bcx encountered. Likely bad or corrupt code.");
bool doFullTest = (inst.BO & 16) == 0 && (inst.BO & 4) == 0;
bool ctrDecremented = false;
diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Util.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Util.cpp
index 21987b6a55..7c152c6bd9 100644
--- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Util.cpp
+++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Util.cpp
@@ -74,6 +74,9 @@ void SafeLoadRegToEAX(X64Reg reg, int accessSize, s32 offset, bool signExtend)
case 16: ABI_CallFunctionR(ProtectFunction((void *)&Memory::Read_U16, 1), reg); break;
case 8: ABI_CallFunctionR(ProtectFunction((void *)&Memory::Read_U8, 1), reg); break;
}
+ if (signExtend && accessSize < 32) {
+ MOVSX(32, accessSize, EAX, R(EAX));
+ }
SetJumpTarget(arg2);
}