mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-09 07:39:26 +01:00
Cleanup, preparations for Linux/Mac JIT (not yet working)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@114 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
60ac064e0c
commit
d8fa3113ea
24
SConstruct
24
SConstruct
@ -1,11 +1,7 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
warnings = ' -Wall -Wwrite-strings -Wfloat-equal -Wshadow -Wpointer-arith -Wcast-qual -Wpacked'
|
||||
|
||||
nonactive_warnings = '-Wunreachable-code'
|
||||
|
||||
ccflags = '-g -O3 -fno-strict-aliasing -fPIC -msse2 -DLOGGING -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE' + warnings
|
||||
ccflags = '-g -O3 -fno-strict-aliasing -fPIC -msse2 -Wall -DLOGGING -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE'
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
ccflags += ' -I/opt/local/include'
|
||||
@ -29,15 +25,15 @@ if sys.platform == 'darwin':
|
||||
"Externals/Bochs_disasm",
|
||||
"Source/Core/Core/Src",
|
||||
"Source/Core/DiscIO/Src",
|
||||
"Source/Core/DebuggerWX/src",
|
||||
"Source/Core/VideoCommon/Src",
|
||||
# "Source/Plugins/Plugin_VideoOGL/Src",
|
||||
"Source/Plugins/Plugin_DSP_NULL/Src",
|
||||
# "Source/Plugins/Plugin_DSP_LLE/Src",
|
||||
"Source/Plugins/Plugin_PadSimple/Src",
|
||||
"Source/Plugins/Plugin_nJoy_SDL/Src",
|
||||
"Source/Core/DolphinWX/src",
|
||||
]
|
||||
"Source/Core/DebuggerWX/src",
|
||||
"Source/Core/VideoCommon/Src",
|
||||
# "Source/Plugins/Plugin_VideoOGL/Src",
|
||||
"Source/Plugins/Plugin_DSP_NULL/Src",
|
||||
# "Source/Plugins/Plugin_DSP_LLE/Src",
|
||||
"Source/Plugins/Plugin_PadSimple/Src",
|
||||
"Source/Plugins/Plugin_nJoy_SDL/Src",
|
||||
"Source/Core/DolphinWX/src",
|
||||
]
|
||||
else:
|
||||
dirs = ["Source/Core/Common/Src",
|
||||
"Externals/Bochs_disasm",
|
||||
|
@ -447,6 +447,14 @@
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath=".\Src\ABI.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\ABI.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\Common.cpp"
|
||||
>
|
||||
@ -559,6 +567,10 @@
|
||||
RelativePath=".\Src\PortableSockets.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\SConscript"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\stdafx.cpp"
|
||||
>
|
||||
|
111
Source/Core/Common/Src/ABI.cpp
Normal file
111
Source/Core/Common/Src/ABI.cpp
Normal file
@ -0,0 +1,111 @@
|
||||
#include "Common.h"
|
||||
#include "x64Emitter.h"
|
||||
#include "ABI.h"
|
||||
|
||||
using namespace Gen;
|
||||
|
||||
#ifdef _M_IX86 // All32
|
||||
|
||||
// Shared code between Win32 and Unix32
|
||||
// ====================================
|
||||
|
||||
void ABI_CallFunctionC(void *func, u32 param1) {
|
||||
PUSH(32, Imm32(param1));
|
||||
CALL(func);
|
||||
ADD(32, R(ESP), Imm8(4));
|
||||
}
|
||||
|
||||
void ABI_CallFunctionCC(void *func, u32 param1, u32 param2) {
|
||||
PUSH(32, Imm32(param2));
|
||||
PUSH(32, Imm32(param1));
|
||||
CALL(func);
|
||||
ADD(32, R(ESP), Imm8(8));
|
||||
}
|
||||
|
||||
// Pass a register as a paremeter.
|
||||
void ABI_CallFunctionR(void *func, X64Reg reg1) {
|
||||
PUSH(32, R(reg1));
|
||||
CALL(func);
|
||||
ADD(32, R(ESP), Imm8(4));
|
||||
}
|
||||
|
||||
void ABI_PushAllCalleeSavedRegsAndAdjustStack() {
|
||||
PUSH(EBP);
|
||||
PUSH(EBX);
|
||||
PUSH(ESI);
|
||||
PUSH(EDI);
|
||||
}
|
||||
|
||||
void ABI_PopAllCalleeSavedRegsAndAdjustStack() {
|
||||
POP(EDI);
|
||||
POP(ESI);
|
||||
POP(EBX);
|
||||
POP(EBP);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// Shared code between Win64 and Unix64
|
||||
// ====================================
|
||||
|
||||
void ABI_CallFunctionC(void *func, u32 param1) {
|
||||
MOV(32, R(ABI_PARAM1), Imm32(param1));
|
||||
CALL(func);
|
||||
}
|
||||
|
||||
void ABI_CallFunctionCC(void *func, u32 param1, u32 param2) {
|
||||
MOV(32, R(ABI_PARAM1), Imm32(param1));
|
||||
MOV(32, R(ABI_PARAM2), Imm32(param2));
|
||||
CALL(func);
|
||||
}
|
||||
|
||||
// Pass a register as a paremeter.
|
||||
void ABI_CallFunctionR(void *func, X64Reg reg1) {
|
||||
if (reg1 != ABI_PARAM1)
|
||||
MOV(32, R(ABI_PARAM1), R(reg1));
|
||||
CALL(func);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
// Win64 Specific Code
|
||||
// ====================================
|
||||
void ABI_PushAllCalleeSavedRegsAndAdjustStack() {
|
||||
//we only want to do this once
|
||||
PUSH(RBX);
|
||||
PUSH(RSI);
|
||||
PUSH(RDI);
|
||||
PUSH(RBP);
|
||||
PUSH(R12);
|
||||
PUSH(R13);
|
||||
PUSH(R14);
|
||||
PUSH(R15);
|
||||
//TODO: Also preserve XMM0-3?
|
||||
SUB(64, R(RSP), Imm8(0x20));
|
||||
}
|
||||
|
||||
void ABI_PopAllCalleeSavedRegsAndAdjustStack() {
|
||||
ADD(64, R(RSP), Imm8(0x20));
|
||||
POP(R15);
|
||||
POP(R14);
|
||||
POP(R13);
|
||||
POP(R12);
|
||||
POP(RBP);
|
||||
POP(RDI);
|
||||
POP(RSI);
|
||||
POP(RBX);
|
||||
}
|
||||
|
||||
#else
|
||||
// Unix64 Specific Code
|
||||
// ====================================
|
||||
void ABI_PushAllCalleeSavedRegsAndAdjustStack() {
|
||||
|
||||
}
|
||||
|
||||
void ABI_PopAllCalleeSavedRegsAndAdjustStack() {
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
93
Source/Core/Common/Src/ABI.h
Normal file
93
Source/Core/Common/Src/ABI.h
Normal file
@ -0,0 +1,93 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _JIT_ABI_H
|
||||
#define _JIT_ABI_H
|
||||
|
||||
#include "x64Emitter.h"
|
||||
|
||||
// x86/x64 ABI:s, and helpers to help follow them when JIT-ing code.
|
||||
// All convensions return values in EAX (+ possibly EDX).
|
||||
|
||||
// Linux 32-bit, Windows 32-bit (cdecl, System V):
|
||||
// * Caller pushes left to right
|
||||
// * Caller fixes stack after call
|
||||
// * function subtract from stack for local storage only.
|
||||
// Scratch: EAX ECX EDX
|
||||
// Callee-save: EBX ESI EDI EBP
|
||||
// Parameters: -
|
||||
|
||||
// Windows 64-bit
|
||||
// * 4-reg "fastcall" variant, very new-skool stack handling
|
||||
// * Callee moves stack pointer, to make room for shadow regs for the biggest function _it itself calls_
|
||||
// * Parameters passed in RCX, RDX, ... further parameters are MOVed into the allocated stack space.
|
||||
// Scratch: RAX RCX RDX R8 R9 R10 R11
|
||||
// Callee-save: RBX RSI RDI RBP R12 R13 R14 R15
|
||||
// Parameters: RCX RDX R8 R9, further MOV-ed
|
||||
|
||||
// Linux 64-bit
|
||||
// * 6-reg "fastcall" variant, old skool stack handling (parameters are pushed)
|
||||
// Scratch: RAX RCX RDX RSI RDI R8 R9 R10 R11
|
||||
// Callee-save: RBX RBP R12 R13 R14 R15
|
||||
// Parameters: RDI RSI RDX RCX R8 R9
|
||||
|
||||
#ifdef _M_IX86
|
||||
// 32 bit calling convention, shared by all
|
||||
|
||||
// There are no ABI_PARAM* here, since args are pushed.
|
||||
|
||||
// === 32-bit bog standard cdecl, shared between linux and windows ============================
|
||||
// MacOSX 32-bit is same as System V with a few exceptions that we probably don't care much about.
|
||||
|
||||
#else
|
||||
// 64 bit calling convention
|
||||
|
||||
#ifdef _WIN32
|
||||
// === 64-bit Windows - the really exotic calling convention ==================================
|
||||
|
||||
#define ABI_PARAM1 RCX
|
||||
#define ABI_PARAM2 RDX
|
||||
#define ABI_PARAM3 R8
|
||||
#define ABI_PARAM4 R9
|
||||
|
||||
#else
|
||||
// === 64-bit Unix (hopefully MacOSX too) =====================================================
|
||||
|
||||
#define ABI_PARAM1 RDI
|
||||
#define ABI_PARAM2 RSI
|
||||
#define ABI_PARAM3 RDX
|
||||
#define ABI_PARAM4 RCX
|
||||
#define ABI_PARAM5 R8
|
||||
#define ABI_PARAM6 R9
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// Utility functions
|
||||
// These only support u32 parameters, but that's enough for a lot of uses.
|
||||
// These will destroy the 1 or 2 first "parameter regs".
|
||||
void ABI_CallFunctionC(void *func, u32 param1);
|
||||
void ABI_CallFunctionCC(void *func, u32 param1, u32 param2);
|
||||
|
||||
// Pass a register as a paremeter.
|
||||
void ABI_CallFunctionR(void *func, Gen::X64Reg reg1);
|
||||
|
||||
void ABI_PushAllCalleeSavedRegsAndAdjustStack();
|
||||
void ABI_PopAllCalleeSavedRegsAndAdjustStack();
|
||||
|
||||
#endif // _JIT_ABI_H
|
@ -1,6 +1,7 @@
|
||||
Import('env')
|
||||
|
||||
files = ["Common.cpp",
|
||||
files = ["ABI.cpp",
|
||||
"Common.cpp",
|
||||
"CPUDetect.cpp",
|
||||
"DynamicLibrary.cpp",
|
||||
"Hash.cpp",
|
||||
|
@ -305,7 +305,7 @@ namespace Gen
|
||||
|
||||
void XCHG_AHAL();
|
||||
void BSWAP(int bits, X64Reg reg);
|
||||
void MOVSX(int dbits, int sbits, X64Reg dest, OpArg src); //auto uses MOVSXD if necessary
|
||||
void MOVSX(int dbits, int sbits, X64Reg dest, OpArg src); //automatically uses MOVSXD if necessary
|
||||
void MOVZX(int dbits, int sbits, X64Reg dest, OpArg src);
|
||||
|
||||
enum SSECompare
|
||||
@ -320,13 +320,11 @@ namespace Gen
|
||||
ORD,
|
||||
};
|
||||
|
||||
|
||||
//SSE2
|
||||
// WARNING - These two take 11-13 cycles and are VectorPath! (AMD64)
|
||||
void STMXCSR(OpArg memloc);
|
||||
void LDMXCSR(OpArg memloc);
|
||||
|
||||
//Regular SSE instructions
|
||||
// Regular SSE/SSE2 instructions
|
||||
void ADDSS(X64Reg regOp, OpArg arg);
|
||||
void ADDSD(X64Reg regOp, OpArg arg);
|
||||
void SUBSS(X64Reg regOp, OpArg arg);
|
||||
@ -492,7 +490,6 @@ namespace Gen
|
||||
|
||||
void PMOVMSKB(X64Reg dest, OpArg arg);
|
||||
|
||||
|
||||
namespace Util
|
||||
{
|
||||
// Sets up a __cdecl function.
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Version="8.00"
|
||||
Name="Core"
|
||||
ProjectGUID="{F0B874CB-4476-4199-9315-8343D05AE684}"
|
||||
RootNamespace="Core"
|
||||
@ -891,6 +891,14 @@
|
||||
RelativePath=".\Src\PowerPC\Jit64\Jit_SystemRegisters.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\PowerPC\Jit64\JitABI.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\PowerPC\Jit64\JitABI.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\PowerPC\Jit64\JitAsm.cpp"
|
||||
>
|
||||
|
@ -14,18 +14,18 @@
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
#include "Common.h"
|
||||
#include "x64Emitter.h"
|
||||
#include "ABI.h"
|
||||
#include "../../HLE/HLE.h"
|
||||
#include "../PowerPC.h"
|
||||
#include "../../CoreTiming.h"
|
||||
#include "../PowerPC.h"
|
||||
#include "../PPCTables.h"
|
||||
#include "../PPCAnalyst.h"
|
||||
#include "x64Emitter.h"
|
||||
#include "../../HW/Memmap.h"
|
||||
#include "JitCache.h"
|
||||
|
||||
#include "JitAsm.h"
|
||||
#include "Jit.h"
|
||||
|
||||
#include "JitAsm.h"
|
||||
#include "JitCache.h"
|
||||
#include "JitRegCache.h"
|
||||
|
||||
using namespace Gen;
|
||||
@ -235,17 +235,8 @@ namespace Jit64
|
||||
MOV(32, M(&PC), Imm32(js.compilerPC));
|
||||
MOV(32, M(&NPC), Imm32(js.compilerPC+4));
|
||||
}
|
||||
#ifdef _M_X64
|
||||
MOV(32,R(RCX), Imm32(_inst.hex));
|
||||
CInterpreter::_interpreterInstruction instr = GetInterpreterOp(_inst);
|
||||
CALL((void*)instr);
|
||||
#elif _M_IX86
|
||||
MOV(32,R(ECX), Imm32(_inst.hex));
|
||||
PUSH(ECX);
|
||||
CInterpreter::_interpreterInstruction instr = GetInterpreterOp(_inst);
|
||||
CALL((void*)instr);
|
||||
ADD(32,R(ESP), Imm8(4));
|
||||
#endif
|
||||
ABI_CallFunctionC((void*)instr, _inst.hex);
|
||||
}
|
||||
|
||||
void Default(UGeckoInstruction _inst)
|
||||
@ -256,24 +247,14 @@ namespace Jit64
|
||||
void HLEFunction(UGeckoInstruction _inst)
|
||||
{
|
||||
FlushRegCaches();
|
||||
#ifdef _M_X64
|
||||
MOV(32, R(ECX), Imm32(js.compilerPC));
|
||||
MOV(32, R(EDX), Imm32(_inst.hex));
|
||||
#elif _M_IX86
|
||||
PUSH(32, Imm32(_inst.hex));
|
||||
PUSH(32, Imm32(js.compilerPC));
|
||||
#endif
|
||||
CALL((void *)&HLE::Execute);
|
||||
#ifdef _M_IX86
|
||||
ADD(32, R(ESP), Imm8(8));
|
||||
#endif
|
||||
ABI_CallFunctionCC((void*)&HLE::Execute, js.compilerPC, _inst.hex);
|
||||
MOV(32, R(EAX), M(&NPC));
|
||||
WriteExitDestInEAX(0);
|
||||
}
|
||||
|
||||
void DoNothing(UGeckoInstruction _inst)
|
||||
{
|
||||
|
||||
// Yup, just don't do anything.
|
||||
}
|
||||
|
||||
bool ImHereDebug = false;
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "../../CoreTiming.h"
|
||||
#include "MemoryUtil.h"
|
||||
|
||||
#include "ABI.h"
|
||||
#include "Jit.h"
|
||||
#include "JitCache.h"
|
||||
|
||||
@ -187,16 +188,9 @@ void Generate()
|
||||
void Generate()
|
||||
{
|
||||
enterCode = AlignCode16();
|
||||
//we only want to do this once
|
||||
PUSH(RBX);
|
||||
PUSH(RSI);
|
||||
PUSH(RDI);
|
||||
PUSH(R12);
|
||||
PUSH(R13);
|
||||
PUSH(R14);
|
||||
PUSH(R15);
|
||||
//TODO: Also preserve XMM0-3?
|
||||
SUB(64, R(RSP), Imm8(0x20));
|
||||
|
||||
ABI_PushAllCalleeSavedRegsAndAdjustStack();
|
||||
|
||||
//INT3();
|
||||
|
||||
MOV(64, R(RBX), Imm64((u64)Memory::base));
|
||||
@ -237,7 +231,7 @@ void Generate()
|
||||
SetJumpTarget(notfound);
|
||||
|
||||
//Ok, no block, let's jit
|
||||
MOV(32, R(ECX), M(&PowerPC::ppcState.pc));
|
||||
MOV(32, R(ABI_PARAM1), M(&PowerPC::ppcState.pc));
|
||||
CALL((void *)&Jit);
|
||||
JMP(dispatcherNoCheck); // no point in special casing this, not the "fast path"
|
||||
|
||||
@ -273,14 +267,7 @@ void Generate()
|
||||
J_CC(CC_Z, outerLoop, true);
|
||||
|
||||
//Landing pad for drec space
|
||||
ADD(64, R(RSP), Imm8(0x20));
|
||||
POP(R15);
|
||||
POP(R14);
|
||||
POP(R13);
|
||||
POP(R12);
|
||||
POP(RDI);
|
||||
POP(RSI);
|
||||
POP(RBX);
|
||||
ABI_PopAllCalleeSavedRegsAndAdjustStack();
|
||||
RET();
|
||||
|
||||
computeRc = AlignCode16();
|
||||
|
@ -30,7 +30,6 @@ namespace Jit64
|
||||
{
|
||||
GPRRegCache gpr;
|
||||
FPURegCache fpr;
|
||||
|
||||
|
||||
void RegCache::Start(PPCAnalyst::BlockRegStats &stats)
|
||||
{
|
||||
@ -245,13 +244,16 @@ namespace Jit64
|
||||
RegCache::Start(stats);
|
||||
}
|
||||
|
||||
|
||||
const int *GPRRegCache::GetAllocationOrder(int &count)
|
||||
{
|
||||
static const int allocationOrder[] =
|
||||
{
|
||||
#ifdef _M_X64
|
||||
#ifdef _WIN32
|
||||
RSI, RDI, R12, R13, R14, R8, R9, RDX, R10, R11 //, RCX
|
||||
#else
|
||||
R12, R13, R14, R8, R9, RDX, R10, R11, RSI, RDI //, RCX
|
||||
#endif
|
||||
#elif _M_IX86
|
||||
ESI, EDI, EBX, EBP, EDX //, RCX
|
||||
#endif
|
||||
@ -260,8 +262,6 @@ namespace Jit64
|
||||
return allocationOrder;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const int *FPURegCache::GetAllocationOrder(int &count)
|
||||
{
|
||||
static const int allocationOrder[] =
|
||||
|
@ -30,7 +30,7 @@ namespace Jit64
|
||||
{
|
||||
typedef u32 (*Operation)(u32 a, u32 b);
|
||||
u32 Add(u32 a, u32 b) {return a+b;}
|
||||
u32 Or(u32 a, u32 b) {return a|b;}
|
||||
u32 Or (u32 a, u32 b) {return a|b;}
|
||||
u32 And(u32 a, u32 b) {return a&b;}
|
||||
u32 Xor(u32 a, u32 b) {return a^b;}
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "../../HW/Memmap.h"
|
||||
#include "../PPCTables.h"
|
||||
#include "x64Emitter.h"
|
||||
#include "ABI.h"
|
||||
|
||||
#include "Jit.h"
|
||||
#include "JitCache.h"
|
||||
@ -46,47 +47,22 @@ namespace Jit64
|
||||
static u64 GC_ALIGNED16(temp64);
|
||||
static u32 GC_ALIGNED16(temp32);
|
||||
|
||||
#ifdef _M_X64
|
||||
void SafeLoadECXtoEAX(int accessSize, s32 offset)
|
||||
void SafeLoadRegToEAX(X64Reg reg, int accessSize, s32 offset)
|
||||
{
|
||||
if (offset)
|
||||
ADD(32, R(ECX), Imm32((u32)offset));
|
||||
TEST(32, R(ECX), Imm32(0x0C000000));
|
||||
FixupBranch argh = J_CC(CC_NZ);
|
||||
if (accessSize != 32)
|
||||
XOR(32, R(EAX), R(EAX));
|
||||
MOV(accessSize, R(EAX), MComplex(RBX, ECX, SCALE_1, 0));
|
||||
if (accessSize == 32)
|
||||
BSWAP(32, EAX);
|
||||
else if (accessSize == 16)
|
||||
{
|
||||
BSWAP(32, EAX);
|
||||
SHR(32, R(EAX), Imm8(16));
|
||||
}
|
||||
FixupBranch arg2 = J();
|
||||
SetJumpTarget(argh);
|
||||
switch (accessSize)
|
||||
{
|
||||
case 32: CALL((void *)&Memory::Read_U32); break;
|
||||
case 16: CALL((void *)&Memory::Read_U16);break;
|
||||
case 8: CALL((void *)&Memory::Read_U8);break;
|
||||
}
|
||||
SetJumpTarget(arg2);
|
||||
}
|
||||
#elif _M_IX86
|
||||
void SafeLoadECXtoEAX(int accessSize, s32 offset)
|
||||
{
|
||||
if (offset)
|
||||
ADD(32, R(ECX), Imm32((u32)offset));
|
||||
TEST(32, R(ECX), Imm32(0x0C000000));
|
||||
ADD(32, R(reg), Imm32((u32)offset));
|
||||
TEST(32, R(reg), Imm32(0x0C000000));
|
||||
FixupBranch argh = J_CC(CC_NZ);
|
||||
if (accessSize != 32)
|
||||
XOR(32, R(EAX), R(EAX));
|
||||
#ifdef _M_IX86
|
||||
AND(32, R(ECX), Imm32(Memory::MEMVIEW32_MASK));
|
||||
|
||||
MOV(accessSize, R(EAX), MDisp(ECX, (u32)Memory::base));
|
||||
#else
|
||||
MOV(accessSize, R(EAX), MComplex(RBX, reg, SCALE_1, 0));
|
||||
#endif
|
||||
if (accessSize == 32)
|
||||
BSWAP(32,EAX);
|
||||
BSWAP(32, EAX);
|
||||
else if (accessSize == 16)
|
||||
{
|
||||
BSWAP(32, EAX);
|
||||
@ -94,17 +70,14 @@ namespace Jit64
|
||||
}
|
||||
FixupBranch arg2 = J();
|
||||
SetJumpTarget(argh);
|
||||
PUSH(ECX);
|
||||
switch (accessSize)
|
||||
{
|
||||
case 32: CALL(&Memory::Read_U32); break;
|
||||
case 16: CALL(&Memory::Read_U16); break;
|
||||
case 8: CALL(&Memory::Read_U8); break;
|
||||
case 32: ABI_CallFunctionR((void *)&Memory::Read_U32, ECX); break;
|
||||
case 16: ABI_CallFunctionR((void *)&Memory::Read_U16, ECX); break;
|
||||
case 8: ABI_CallFunctionR((void *)&Memory::Read_U8, ECX); break;
|
||||
}
|
||||
ADD(32, R(ESP), Imm8(4));
|
||||
SetJumpTarget(arg2);
|
||||
}
|
||||
#endif
|
||||
|
||||
void lbzx(UGeckoInstruction inst)
|
||||
{
|
||||
@ -117,7 +90,7 @@ namespace Jit64
|
||||
MOV(32, R(ECX), gpr.R(b));
|
||||
if (a)
|
||||
ADD(32, R(ECX), gpr.R(a));
|
||||
SafeLoadECXtoEAX(8, 0);
|
||||
SafeLoadRegToEAX(ECX, 8, 0);
|
||||
MOV(32, gpr.R(d), R(EAX));
|
||||
gpr.UnlockAll();
|
||||
}
|
||||
@ -133,26 +106,15 @@ namespace Jit64
|
||||
|
||||
if (!Core::GetStartupParameter().bUseDualCore &&
|
||||
inst.OPCD == 32 &&
|
||||
(inst.hex & 0xFFFF0000)==0x800D0000 &&
|
||||
Memory::ReadUnchecked_U32(js.compilerPC+4)==0x28000000 &&
|
||||
Memory::ReadUnchecked_U32(js.compilerPC+8)==0x4182fff8)
|
||||
(inst.hex & 0xFFFF0000) == 0x800D0000 &&
|
||||
Memory::ReadUnchecked_U32(js.compilerPC+4) == 0x28000000 &&
|
||||
Memory::ReadUnchecked_U32(js.compilerPC+8) == 0x4182fff8)
|
||||
{
|
||||
//PowerPC::downcount -= PowerPC::OnIdle(uAddress);
|
||||
gpr.Flush(FLUSH_ALL);
|
||||
fpr.Flush(FLUSH_ALL);
|
||||
#ifdef _M_IX86
|
||||
MOV(32, R(ECX), Imm32(PowerPC::ppcState.gpr[a] + (s32)(s16)inst.SIMM_16));
|
||||
PUSH(ECX);
|
||||
CALL((void *)&PowerPC::OnIdle);
|
||||
ADD(32, R(ESP), Imm32(4));
|
||||
#elif defined(_M_X64)
|
||||
//INT3();
|
||||
MOV(32, R(ECX), Imm32(PowerPC::ppcState.gpr[a] + (s32)(s16)inst.SIMM_16));
|
||||
CALL((void *)&PowerPC::OnIdle);
|
||||
#endif
|
||||
MOV(32,M(&PowerPC::ppcState.pc), Imm32(js.compilerPC+12));
|
||||
ABI_CallFunctionC((void *)&PowerPC::OnIdle, PowerPC::ppcState.gpr[a] + (s32)(s16)inst.SIMM_16);
|
||||
MOV(32, M(&PowerPC::ppcState.pc), Imm32(js.compilerPC + 12));
|
||||
JMP(Asm::testExceptions, true);
|
||||
|
||||
js.compilerPC += 8;
|
||||
return;
|
||||
}
|
||||
@ -182,7 +144,7 @@ namespace Jit64
|
||||
gpr.Flush(FLUSH_VOLATILE);
|
||||
gpr.Lock(d, a);
|
||||
MOV(32, R(ECX), gpr.R(a));
|
||||
SafeLoadECXtoEAX(accessSize, offset);
|
||||
SafeLoadRegToEAX(ECX, accessSize, offset);
|
||||
gpr.LoadToX64(d, false, true);
|
||||
MOV(32, gpr.R(d), R(EAX));
|
||||
gpr.UnlockAll();
|
||||
@ -235,7 +197,7 @@ namespace Jit64
|
||||
else
|
||||
#endif
|
||||
{
|
||||
SafeLoadECXtoEAX(32, offset);
|
||||
SafeLoadRegToEAX(ECX, 32, offset);
|
||||
}
|
||||
|
||||
MOV(32, M(&temp32), R(EAX));
|
||||
|
@ -253,6 +253,4 @@ namespace Jit64
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user