Blargh, 109 broke things, reverted most of it.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@112 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2008-07-31 06:37:47 +00:00
parent 8f1628b69c
commit d1140d999d
7 changed files with 62 additions and 62 deletions

View File

@ -112,12 +112,12 @@ u64 MemArena::Find4GBBase()
VirtualFree(base, 0, MEM_RELEASE);
return((u64)base);
#else
// TODO(ector): Do correctly (yeah i know how to do it now :P)
// Very precarious - mmap cannot return an error when trying to map already used pages.
// This makes the Windows approach above unusable on Linux, so we will simply pray...
return(0x2300000000ULL);
#endif
#else
// This is the one that will be tricky on Unix, if I want to be nice.
// 32 bit
// 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);

View File

@ -124,3 +124,4 @@ void UnWriteProtectMemory(void* ptr, int size, bool allowExecute)
#endif
}

View File

@ -233,18 +233,18 @@ namespace Jit64
if (js.isLastInstruction)
{
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
MOV(32, R(XR_PARAM1), Imm32(_inst.hex));
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));
MOV(32,R(ECX), Imm32(_inst.hex));
PUSH(ECX);
CInterpreter::_interpreterInstruction instr = GetInterpreterOp(_inst);
CALL((void*)instr);
ADD(32, R(ESP), Imm8(4));
ADD(32,R(ESP), Imm8(4));
#endif
}
@ -257,8 +257,8 @@ namespace Jit64
{
FlushRegCaches();
#ifdef _M_X64
MOV(32, R(XR_PARAM1), Imm32(js.compilerPC));
MOV(32, R(XR_PARAM2), Imm32(_inst.hex));
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));
@ -361,14 +361,13 @@ namespace Jit64
SetJumpTarget(skip);
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)
{
//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
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);
MOV(32, M(&PC), Imm32(js.blockStart));
JMP(Asm::fpException, true);
@ -392,8 +391,7 @@ namespace Jit64
js.compilerPC = ops[i].address;
js.op = &ops[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);
gpr.SanityCheck();
fpr.SanityCheck();

View File

@ -25,16 +25,6 @@
#include "../PPCAnalyst.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
{
struct JitStats

View File

@ -188,7 +188,6 @@ void Generate()
{
enterCode = AlignCode16();
//we only want to do this once
#ifdef _WIN32
PUSH(RBX);
PUSH(RSI);
PUSH(RDI);
@ -198,14 +197,7 @@ void Generate()
PUSH(R15);
//TODO: Also preserve XMM0-3?
SUB(64, R(RSP), Imm8(0x20));
#else
PUSH(RBP);
PUSH(RBX);
PUSH(R12);
PUSH(R13);
PUSH(R14);
PUSH(R15);
#endif
//INT3();
MOV(64, R(RBX), Imm64((u64)Memory::base));
if ((u64)GetCodePointers() > 0x80000000ULL) {
@ -241,11 +233,11 @@ void Generate()
ADD(32, M(&PowerPC::ppcState.DebugCount), Imm8(1));
}
//grab from list and jump to it
JMPptr(MComplex(R15, RAX, 8, 0));
JMPptr(MComplex(R15,RAX,8,0));
SetJumpTarget(notfound);
//Ok, no block, let's jit
MOV(32, R(XR_PARAM1), M(&PowerPC::ppcState.pc));
MOV(32, R(ECX), M(&PowerPC::ppcState.pc));
CALL((void *)&Jit);
JMP(dispatcherNoCheck); // no point in special casing this, not the "fast path"
@ -268,7 +260,7 @@ void Generate()
CALL((void *)&CoreTiming::Advance);
testExceptions = GetCodePtr();
TEST(32, M(&PowerPC::ppcState.Exceptions), Imm32(0xFFFFFFFF));
TEST(32,M(&PowerPC::ppcState.Exceptions), Imm32(0xFFFFFFFF));
FixupBranch skipExceptions = J_CC(CC_Z);
MOV(32, R(EAX), M(&PC));
MOV(32, M(&NPC), R(EAX));
@ -279,7 +271,7 @@ void Generate()
TEST(32, M((void*)&PowerPC::state), Imm32(0xFFFFFFFF));
J_CC(CC_Z, outerLoop, true);
#ifdef _WIN32
//Landing pad for drec space
ADD(64, R(RSP), Imm8(0x20));
POP(R15);
@ -288,15 +280,7 @@ void Generate()
POP(R12);
POP(RDI);
POP(RSI);
POP(RBX);
#else
PUSH(R15);
PUSH(R14);
PUSH(R13);
PUSH(R12);
PUSH(RBX);
PUSH(RBP);
#endif
POP(RBX);
RET();
computeRc = AlignCode16();
@ -337,6 +321,43 @@ void Generate()
}
MessageBox(0,(char*)xDis,"yo",0);
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
}

View File

@ -104,7 +104,8 @@ namespace Jit64
{
int aCount;
const int *aOrder = GetAllocationOrder(aCount);
for (int i = 0; i < aCount; i++)
int i;
for (i = 0; i < aCount; i++)
{
X64Reg xr = (X64Reg)aOrder[i];
if (!xlocks[xr] && xregs[xr].free)
@ -200,16 +201,11 @@ namespace Jit64
{
switch (reg)
{
#ifdef _WIN32
case RAX: case RCX: case RDX: case R8: case R9: case R10: case R11:
#ifdef _M_IX86
case RBX:
#endif
#else
// linux64
case RAX: case RCX: case RDX: case RSI: case RDI: case R9: case R10: case R11:
return true;
#endif
default:
return false;
}
@ -254,14 +250,10 @@ namespace Jit64
{
static const int allocationOrder[] =
{
#ifdef _WIN32
#ifdef _M_X64
RSI, RDI, R12, R13, R14, R8, R9, RDX, R10, R11 //, RCX
#elif _M_IX86
ESI, EDI, EBX, EBP, EDX //, RCX
#endif
#else
R12, R13, R14, R15, RDX,
#endif
};
count = sizeof(allocationOrder) / sizeof(const int);
@ -274,14 +266,10 @@ namespace Jit64
{
static const int allocationOrder[] =
{
#ifdef _WIN32
#ifdef _M_X64
XMM6, XMM7, XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, XMM2, XMM3, XMM4, XMM5
#elif _M_IX86
XMM2, XMM3, XMM4, XMM5, XMM6, XMM7,
#endif
#else
XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15,
#endif
};
count = sizeof(allocationOrder) / sizeof(int);

View File

@ -57,6 +57,9 @@ bool BootCore(const std::string& _rFilename)
// StartUp.bUseDualCore = false;
StartUp.bUseDynarec = true;
}
#ifndef _WIN32
StartUp.bUseDynarec = false;//Never use Dynarec in Linux, crashes
#endif
StartUp.m_BootType = SCoreStartupParameter::BOOT_ISO;
StartUp.m_strFilename = _rFilename;
StartUp.bRunCompareClient = false;
@ -65,9 +68,8 @@ bool BootCore(const std::string& _rFilename)
std::string BaseDataPath;
#ifdef _WIN32
StartUp.hInstance = wxGetInstance();
#else
StartUp.bUseDynarec = false;
#endif
#endif
StartUp.AutoSetup(SCoreStartupParameter::BOOT_DEFAULT);
// Load overrides