mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-24 06:51:17 +01:00
Various linux stuff - JIT does not work yet :(
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@109 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
fb7a7f9001
commit
5698cbde2f
24
SConstruct
24
SConstruct
@ -1,7 +1,11 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
ccflags = '-g -O3 -fno-strict-aliasing -fPIC -msse2 -Wall -DLOGGING -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE'
|
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
|
||||||
|
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
ccflags += ' -I/opt/local/include'
|
ccflags += ' -I/opt/local/include'
|
||||||
@ -25,15 +29,15 @@ if sys.platform == 'darwin':
|
|||||||
"Externals/Bochs_disasm",
|
"Externals/Bochs_disasm",
|
||||||
"Source/Core/Core/Src",
|
"Source/Core/Core/Src",
|
||||||
"Source/Core/DiscIO/Src",
|
"Source/Core/DiscIO/Src",
|
||||||
"Source/Core/DebuggerWX/src",
|
"Source/Core/DebuggerWX/src",
|
||||||
"Source/Core/VideoCommon/Src",
|
"Source/Core/VideoCommon/Src",
|
||||||
# "Source/Plugins/Plugin_VideoOGL/Src",
|
# "Source/Plugins/Plugin_VideoOGL/Src",
|
||||||
"Source/Plugins/Plugin_DSP_NULL/Src",
|
"Source/Plugins/Plugin_DSP_NULL/Src",
|
||||||
# "Source/Plugins/Plugin_DSP_LLE/Src",
|
# "Source/Plugins/Plugin_DSP_LLE/Src",
|
||||||
"Source/Plugins/Plugin_PadSimple/Src",
|
"Source/Plugins/Plugin_PadSimple/Src",
|
||||||
"Source/Plugins/Plugin_nJoy_SDL/Src",
|
"Source/Plugins/Plugin_nJoy_SDL/Src",
|
||||||
"Source/Core/DolphinWX/src",
|
"Source/Core/DolphinWX/src",
|
||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
dirs = ["Source/Core/Common/Src",
|
dirs = ["Source/Core/Common/Src",
|
||||||
"Externals/Bochs_disasm",
|
"Externals/Bochs_disasm",
|
||||||
|
@ -112,12 +112,12 @@ u64 MemArena::Find4GBBase()
|
|||||||
VirtualFree(base, 0, MEM_RELEASE);
|
VirtualFree(base, 0, MEM_RELEASE);
|
||||||
return((u64)base);
|
return((u64)base);
|
||||||
#else
|
#else
|
||||||
// Very precarious - mmap cannot return an error when trying to map already used pages.
|
// TODO(ector): Do correctly (yeah i know how to do it now :P)
|
||||||
// This makes the Windows approach above unusable on Linux, so we will simply pray...
|
|
||||||
return(0x2300000000ULL);
|
return(0x2300000000ULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
// This is the one that will be tricky on Unix, if I want to be nice.
|
||||||
// 32 bit
|
// 32 bit
|
||||||
// The highest thing in any 1GB section of memory space is the locked cache. We only need to fit it.
|
// The highest thing in any 1GB section of memory space is the locked cache. We only need to fit it.
|
||||||
u8* base = (u8*)VirtualAlloc(0, 0x31000000, MEM_RESERVE, PAGE_READWRITE);
|
u8* base = (u8*)VirtualAlloc(0, 0x31000000, MEM_RESERVE, PAGE_READWRITE);
|
||||||
|
@ -124,4 +124,3 @@ void UnWriteProtectMemory(void* ptr, int size, bool allowExecute)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -233,18 +233,18 @@ namespace Jit64
|
|||||||
if (js.isLastInstruction)
|
if (js.isLastInstruction)
|
||||||
{
|
{
|
||||||
MOV(32, M(&PC), Imm32(js.compilerPC));
|
MOV(32, M(&PC), Imm32(js.compilerPC));
|
||||||
MOV(32, M(&NPC), Imm32(js.compilerPC+4));
|
MOV(32, M(&NPC), Imm32(js.compilerPC + 4));
|
||||||
}
|
}
|
||||||
#ifdef _M_X64
|
#ifdef _M_X64
|
||||||
MOV(32,R(RCX), Imm32(_inst.hex));
|
MOV(32, R(XR_PARAM1), Imm32(_inst.hex));
|
||||||
CInterpreter::_interpreterInstruction instr = GetInterpreterOp(_inst);
|
CInterpreter::_interpreterInstruction instr = GetInterpreterOp(_inst);
|
||||||
CALL((void*)instr);
|
CALL((void*)instr);
|
||||||
#elif _M_IX86
|
#elif _M_IX86
|
||||||
MOV(32,R(ECX), Imm32(_inst.hex));
|
MOV(32, R(ECX), Imm32(_inst.hex));
|
||||||
PUSH(ECX);
|
PUSH(ECX);
|
||||||
CInterpreter::_interpreterInstruction instr = GetInterpreterOp(_inst);
|
CInterpreter::_interpreterInstruction instr = GetInterpreterOp(_inst);
|
||||||
CALL((void*)instr);
|
CALL((void*)instr);
|
||||||
ADD(32,R(ESP), Imm8(4));
|
ADD(32, R(ESP), Imm8(4));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,8 +257,8 @@ namespace Jit64
|
|||||||
{
|
{
|
||||||
FlushRegCaches();
|
FlushRegCaches();
|
||||||
#ifdef _M_X64
|
#ifdef _M_X64
|
||||||
MOV(32, R(ECX), Imm32(js.compilerPC));
|
MOV(32, R(XR_PARAM1), Imm32(js.compilerPC));
|
||||||
MOV(32, R(EDX), Imm32(_inst.hex));
|
MOV(32, R(XR_PARAM2), Imm32(_inst.hex));
|
||||||
#elif _M_IX86
|
#elif _M_IX86
|
||||||
PUSH(32, Imm32(_inst.hex));
|
PUSH(32, Imm32(_inst.hex));
|
||||||
PUSH(32, Imm32(js.compilerPC));
|
PUSH(32, Imm32(js.compilerPC));
|
||||||
@ -361,13 +361,14 @@ namespace Jit64
|
|||||||
SetJumpTarget(skip);
|
SetJumpTarget(skip);
|
||||||
|
|
||||||
const u8 *normalEntry = GetCodePtr();
|
const u8 *normalEntry = GetCodePtr();
|
||||||
if (ImHereDebug) CALL((void *)&ImHere); //Used to get a trace of the last few blocks before a crash, sometimes VERY useful
|
if (ImHereDebug)
|
||||||
|
CALL((void *)&ImHere); //Used to get a trace of the last few blocks before a crash, sometimes VERY useful
|
||||||
|
|
||||||
if (js.fpa.any)
|
if (js.fpa.any)
|
||||||
{
|
{
|
||||||
//This block uses FPU - needs to add FP exception bailout
|
//This block uses FPU - needs to add FP exception bailout
|
||||||
// TODO(ector): change to large J_CC(CC_Z) when verified that it still works
|
// TODO(ector): change to large J_CC(CC_Z) when verified that it still works
|
||||||
TEST(32, M(&PowerPC::ppcState.msr), Imm32(1<<13)); //Test FP bit
|
TEST(32, M(&PowerPC::ppcState.msr), Imm32(1 << 13)); //Test FP bit
|
||||||
FixupBranch b1 = J_CC(CC_NZ);
|
FixupBranch b1 = J_CC(CC_NZ);
|
||||||
MOV(32, M(&PC), Imm32(js.blockStart));
|
MOV(32, M(&PC), Imm32(js.blockStart));
|
||||||
JMP(Asm::fpException, true);
|
JMP(Asm::fpException, true);
|
||||||
@ -391,7 +392,8 @@ namespace Jit64
|
|||||||
js.compilerPC = ops[i].address;
|
js.compilerPC = ops[i].address;
|
||||||
js.op = &ops[i];
|
js.op = &ops[i];
|
||||||
js.instructionNumber = i;
|
js.instructionNumber = i;
|
||||||
if (i == (int)size - 1) js.isLastInstruction = true;
|
if (i == (int)size - 1)
|
||||||
|
js.isLastInstruction = true;
|
||||||
PPCTables::CompileInstruction(ops[i].inst);
|
PPCTables::CompileInstruction(ops[i].inst);
|
||||||
gpr.SanityCheck();
|
gpr.SanityCheck();
|
||||||
fpr.SanityCheck();
|
fpr.SanityCheck();
|
||||||
|
@ -25,6 +25,16 @@
|
|||||||
#include "../PPCAnalyst.h"
|
#include "../PPCAnalyst.h"
|
||||||
#include "JitCache.h"
|
#include "JitCache.h"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define XR_PARAM1 ECX
|
||||||
|
#define XR_PARAM2 EDX
|
||||||
|
#else
|
||||||
|
#define XR_PARAM1 RDI
|
||||||
|
#define XR_PARAM2 RSI
|
||||||
|
#define XR_PARAM3 RDX
|
||||||
|
#define XR_PARAM4 RCX
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Jit64
|
namespace Jit64
|
||||||
{
|
{
|
||||||
struct JitStats
|
struct JitStats
|
||||||
|
@ -188,6 +188,7 @@ void Generate()
|
|||||||
{
|
{
|
||||||
enterCode = AlignCode16();
|
enterCode = AlignCode16();
|
||||||
//we only want to do this once
|
//we only want to do this once
|
||||||
|
#ifdef _WIN32
|
||||||
PUSH(RBX);
|
PUSH(RBX);
|
||||||
PUSH(RSI);
|
PUSH(RSI);
|
||||||
PUSH(RDI);
|
PUSH(RDI);
|
||||||
@ -197,7 +198,14 @@ void Generate()
|
|||||||
PUSH(R15);
|
PUSH(R15);
|
||||||
//TODO: Also preserve XMM0-3?
|
//TODO: Also preserve XMM0-3?
|
||||||
SUB(64, R(RSP), Imm8(0x20));
|
SUB(64, R(RSP), Imm8(0x20));
|
||||||
//INT3();
|
#else
|
||||||
|
PUSH(RBP);
|
||||||
|
PUSH(RBX);
|
||||||
|
PUSH(R12);
|
||||||
|
PUSH(R13);
|
||||||
|
PUSH(R14);
|
||||||
|
PUSH(R15);
|
||||||
|
#endif
|
||||||
|
|
||||||
MOV(64, R(RBX), Imm64((u64)Memory::base));
|
MOV(64, R(RBX), Imm64((u64)Memory::base));
|
||||||
if ((u64)GetCodePointers() > 0x80000000ULL) {
|
if ((u64)GetCodePointers() > 0x80000000ULL) {
|
||||||
@ -233,11 +241,11 @@ void Generate()
|
|||||||
ADD(32, M(&PowerPC::ppcState.DebugCount), Imm8(1));
|
ADD(32, M(&PowerPC::ppcState.DebugCount), Imm8(1));
|
||||||
}
|
}
|
||||||
//grab from list and jump to it
|
//grab from list and jump to it
|
||||||
JMPptr(MComplex(R15,RAX,8,0));
|
JMPptr(MComplex(R15, RAX, 8, 0));
|
||||||
SetJumpTarget(notfound);
|
SetJumpTarget(notfound);
|
||||||
|
|
||||||
//Ok, no block, let's jit
|
//Ok, no block, let's jit
|
||||||
MOV(32, R(ECX), M(&PowerPC::ppcState.pc));
|
MOV(32, R(XR_PARAM1), M(&PowerPC::ppcState.pc));
|
||||||
CALL((void *)&Jit);
|
CALL((void *)&Jit);
|
||||||
JMP(dispatcherNoCheck); // no point in special casing this, not the "fast path"
|
JMP(dispatcherNoCheck); // no point in special casing this, not the "fast path"
|
||||||
|
|
||||||
@ -260,7 +268,7 @@ void Generate()
|
|||||||
CALL((void *)&CoreTiming::Advance);
|
CALL((void *)&CoreTiming::Advance);
|
||||||
|
|
||||||
testExceptions = GetCodePtr();
|
testExceptions = GetCodePtr();
|
||||||
TEST(32,M(&PowerPC::ppcState.Exceptions), Imm32(0xFFFFFFFF));
|
TEST(32, M(&PowerPC::ppcState.Exceptions), Imm32(0xFFFFFFFF));
|
||||||
FixupBranch skipExceptions = J_CC(CC_Z);
|
FixupBranch skipExceptions = J_CC(CC_Z);
|
||||||
MOV(32, R(EAX), M(&PC));
|
MOV(32, R(EAX), M(&PC));
|
||||||
MOV(32, M(&NPC), R(EAX));
|
MOV(32, M(&NPC), R(EAX));
|
||||||
@ -271,7 +279,7 @@ void Generate()
|
|||||||
|
|
||||||
TEST(32, M((void*)&PowerPC::state), Imm32(0xFFFFFFFF));
|
TEST(32, M((void*)&PowerPC::state), Imm32(0xFFFFFFFF));
|
||||||
J_CC(CC_Z, outerLoop, true);
|
J_CC(CC_Z, outerLoop, true);
|
||||||
|
#ifdef _WIN32
|
||||||
//Landing pad for drec space
|
//Landing pad for drec space
|
||||||
ADD(64, R(RSP), Imm8(0x20));
|
ADD(64, R(RSP), Imm8(0x20));
|
||||||
POP(R15);
|
POP(R15);
|
||||||
@ -280,7 +288,15 @@ void Generate()
|
|||||||
POP(R12);
|
POP(R12);
|
||||||
POP(RDI);
|
POP(RDI);
|
||||||
POP(RSI);
|
POP(RSI);
|
||||||
POP(RBX);
|
POP(RBX);
|
||||||
|
#else
|
||||||
|
PUSH(R15);
|
||||||
|
PUSH(R14);
|
||||||
|
PUSH(R13);
|
||||||
|
PUSH(R12);
|
||||||
|
PUSH(RBX);
|
||||||
|
PUSH(RBP);
|
||||||
|
#endif
|
||||||
RET();
|
RET();
|
||||||
|
|
||||||
computeRc = AlignCode16();
|
computeRc = AlignCode16();
|
||||||
@ -321,43 +337,6 @@ void Generate()
|
|||||||
}
|
}
|
||||||
MessageBox(0,(char*)xDis,"yo",0);
|
MessageBox(0,(char*)xDis,"yo",0);
|
||||||
delete [] xDis; */
|
delete [] xDis; */
|
||||||
|
|
||||||
/*
|
|
||||||
RUNTIME_FUNCTION func;
|
|
||||||
func.BeginAddress = 0;
|
|
||||||
func.EndAddress = (u32)(GetCodePtr() - enterCode);
|
|
||||||
func.UnwindData = 0;
|
|
||||||
|
|
||||||
RtlAddFunctionTable(&func, 1, (ULONGLONG)enterCode);*/
|
|
||||||
/*
|
|
||||||
//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));
|
|
||||||
|
|
||||||
MOV(32, R(R15), M(&Memory::base));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MOV(32, M(&PowerPC::ppcState.pc), R(R14));
|
|
||||||
|
|
||||||
//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);
|
|
||||||
RET();*/
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -104,8 +104,7 @@ namespace Jit64
|
|||||||
{
|
{
|
||||||
int aCount;
|
int aCount;
|
||||||
const int *aOrder = GetAllocationOrder(aCount);
|
const int *aOrder = GetAllocationOrder(aCount);
|
||||||
int i;
|
for (int i = 0; i < aCount; i++)
|
||||||
for (i = 0; i < aCount; i++)
|
|
||||||
{
|
{
|
||||||
X64Reg xr = (X64Reg)aOrder[i];
|
X64Reg xr = (X64Reg)aOrder[i];
|
||||||
if (!xlocks[xr] && xregs[xr].free)
|
if (!xlocks[xr] && xregs[xr].free)
|
||||||
@ -201,11 +200,16 @@ namespace Jit64
|
|||||||
{
|
{
|
||||||
switch (reg)
|
switch (reg)
|
||||||
{
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
case RAX: case RCX: case RDX: case R8: case R9: case R10: case R11:
|
case RAX: case RCX: case RDX: case R8: case R9: case R10: case R11:
|
||||||
#ifdef _M_IX86
|
#ifdef _M_IX86
|
||||||
case RBX:
|
case RBX:
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
// linux64
|
||||||
|
case RAX: case RCX: case RDX: case RSI: case RDI: case R9: case R10: case R11:
|
||||||
return true;
|
return true;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -250,10 +254,14 @@ namespace Jit64
|
|||||||
{
|
{
|
||||||
static const int allocationOrder[] =
|
static const int allocationOrder[] =
|
||||||
{
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
#ifdef _M_X64
|
#ifdef _M_X64
|
||||||
RSI, RDI, R12, R13, R14, R8, R9, RDX, R10, R11 //, RCX
|
RSI, RDI, R12, R13, R14, R8, R9, RDX, R10, R11 //, RCX
|
||||||
#elif _M_IX86
|
#elif _M_IX86
|
||||||
ESI, EDI, EBX, EBP, EDX //, RCX
|
ESI, EDI, EBX, EBP, EDX //, RCX
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
R12, R13, R14, R15, RDX,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
count = sizeof(allocationOrder) / sizeof(const int);
|
count = sizeof(allocationOrder) / sizeof(const int);
|
||||||
@ -266,10 +274,14 @@ namespace Jit64
|
|||||||
{
|
{
|
||||||
static const int allocationOrder[] =
|
static const int allocationOrder[] =
|
||||||
{
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
#ifdef _M_X64
|
#ifdef _M_X64
|
||||||
XMM6, XMM7, XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, XMM2, XMM3, XMM4, XMM5
|
XMM6, XMM7, XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, XMM2, XMM3, XMM4, XMM5
|
||||||
#elif _M_IX86
|
#elif _M_IX86
|
||||||
XMM2, XMM3, XMM4, XMM5, XMM6, XMM7,
|
XMM2, XMM3, XMM4, XMM5, XMM6, XMM7,
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
count = sizeof(allocationOrder) / sizeof(int);
|
count = sizeof(allocationOrder) / sizeof(int);
|
||||||
|
@ -57,9 +57,6 @@ bool BootCore(const std::string& _rFilename)
|
|||||||
// StartUp.bUseDualCore = false;
|
// StartUp.bUseDualCore = false;
|
||||||
StartUp.bUseDynarec = true;
|
StartUp.bUseDynarec = true;
|
||||||
}
|
}
|
||||||
#ifndef _WIN32
|
|
||||||
StartUp.bUseDynarec = false;//Never use Dynarec in Linux, crashes
|
|
||||||
#endif
|
|
||||||
StartUp.m_BootType = SCoreStartupParameter::BOOT_ISO;
|
StartUp.m_BootType = SCoreStartupParameter::BOOT_ISO;
|
||||||
StartUp.m_strFilename = _rFilename;
|
StartUp.m_strFilename = _rFilename;
|
||||||
StartUp.bRunCompareClient = false;
|
StartUp.bRunCompareClient = false;
|
||||||
@ -68,8 +65,9 @@ bool BootCore(const std::string& _rFilename)
|
|||||||
std::string BaseDataPath;
|
std::string BaseDataPath;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
StartUp.hInstance = wxGetInstance();
|
StartUp.hInstance = wxGetInstance();
|
||||||
#endif
|
#else
|
||||||
|
StartUp.bUseDynarec = false;
|
||||||
|
#endif
|
||||||
StartUp.AutoSetup(SCoreStartupParameter::BOOT_DEFAULT);
|
StartUp.AutoSetup(SCoreStartupParameter::BOOT_DEFAULT);
|
||||||
|
|
||||||
// Load overrides
|
// Load overrides
|
||||||
|
Loading…
x
Reference in New Issue
Block a user