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
This commit is contained in:
hrydgard 2008-08-13 22:28:36 +00:00
parent e4792fafaf
commit 96ca347bdc
3 changed files with 17 additions and 7 deletions

View File

@ -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)
{

View File

@ -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;

View File

@ -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);
}