More linux...
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@122 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
814af6c7b9
commit
9a4c66e066
|
@ -38,7 +38,7 @@
|
|||
// This is purposedely not a full wrapper for virtualalloc/mmap, but it
|
||||
// provides exactly the primitive operations that Dolphin needs.
|
||||
|
||||
void* AllocateExecutableMemory(int size)
|
||||
void* AllocateExecutableMemory(int size, bool low)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
|
@ -55,7 +55,7 @@ void* AllocateExecutableMemory(int size)
|
|||
void* retval = mmap(0, size, PROT_READ | PROT_WRITE | PROT_EXEC,
|
||||
MAP_ANONYMOUS | MAP_PRIVATE
|
||||
#ifdef __x86_64__
|
||||
| MAP_32BIT
|
||||
| (low ? MAP_32BIT : 0)
|
||||
#endif
|
||||
, -1, 0); // | MAP_FIXED
|
||||
printf("mappah exe %p %i\n", retval, size);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#ifndef _MEMORYUTIL_H
|
||||
#define _MEMORYUTIL_H
|
||||
|
||||
void* AllocateExecutableMemory(int size);
|
||||
void* AllocateExecutableMemory(int size, bool low = true);
|
||||
void* AllocateMemoryPages(int size);
|
||||
void FreeMemoryPages(void* ptr, int size);
|
||||
void WriteProtectMemory(void* ptr, int size, bool executable = false);
|
||||
|
|
|
@ -313,7 +313,7 @@ namespace Gen
|
|||
s64 fn = (s64)fnptr;
|
||||
s64 c = (s64)code;
|
||||
if (myabs(fn - c) >= 0x80000000ULL) {
|
||||
PanicAlert("CALL out of range, %p, %p", fn, c);
|
||||
PanicAlert("CALL out of range (%p calls %p)", c, fn);
|
||||
}
|
||||
s32 distance = (s32)(fn - ((u64)code + 5));
|
||||
Write8(0xE8);
|
||||
|
@ -325,7 +325,8 @@ namespace Gen
|
|||
//TODO fix
|
||||
u64 jump = (code - (u8*)j8) - 1;
|
||||
|
||||
if (jump > 0x7f) _assert_msg_(DYNA_REC, 0, "j8 greater than 0x7f!!");
|
||||
if (jump > 0x7f)
|
||||
_assert_msg_(DYNA_REC, 0, "j8 greater than 0x7f!!");
|
||||
*j8 = (u8)jump;
|
||||
}
|
||||
|
||||
|
@ -1107,7 +1108,8 @@ namespace Gen
|
|||
else
|
||||
{
|
||||
// Simulate this instruction with SSE2 instructions
|
||||
MOVAPD(regOp, arg);
|
||||
if (!arg.IsSimpleReg(regOp))
|
||||
MOVAPD(regOp, arg);
|
||||
UNPCKLPD(regOp, R(regOp));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -260,13 +260,17 @@ namespace Jit64
|
|||
|
||||
bool ImHereDebug = false;
|
||||
|
||||
std::map<u32, bool> been_here;
|
||||
std::map<u32, int> been_here;
|
||||
void ImHere()
|
||||
{
|
||||
if (been_here.find(PC) != been_here.end())
|
||||
return;
|
||||
if (been_here.find(PC) != been_here.end()) {
|
||||
been_here.find(PC)->second++;
|
||||
if ((been_here.find(PC)->second) & 1023)
|
||||
return;
|
||||
}
|
||||
LOG(DYNA_REC, "I'm here - PC = %08x , LR = %08x", PC, LR);
|
||||
been_here[PC] = true;
|
||||
printf("I'm here - PC = %08x , LR = %08x", PC, LR);
|
||||
been_here[PC] = 1;
|
||||
}
|
||||
|
||||
void FlushRegCaches()
|
||||
|
|
|
@ -23,11 +23,11 @@ void BackPatchError(const std::string &text, u8 *codePtr, u32 emAddress) {
|
|||
char disbuf[256];
|
||||
memset(disbuf, 0, 256);
|
||||
#ifdef _M_IX86
|
||||
disasm.disasm32(
|
||||
disasm.disasm32
|
||||
#else
|
||||
disasm.disasm64(
|
||||
disasm.disasm64
|
||||
#endif
|
||||
0, code_addr, codePtr, disbuf);
|
||||
(0, code_addr, codePtr, disbuf);
|
||||
PanicAlert("%s\n\n"
|
||||
"Error encountered accessing emulated address %08x.\n"
|
||||
"Culprit instruction: \n%s\nat %08x%08x",
|
||||
|
@ -82,9 +82,9 @@ void BackPatch(u8 *codePtr, int accessType, u32 emAddress)
|
|||
// * Set up stack frame.
|
||||
// * Call ReadMemory32
|
||||
//LEA(32, ECX, MDisp((X64Reg)addrReg, info.displacement));
|
||||
MOV(32, R(ECX), R((X64Reg)addrReg));
|
||||
MOV(32, R(ABI_PARAM1), R((X64Reg)addrReg));
|
||||
if (info.displacement) {
|
||||
ADD(32, R(ECX), Imm32(info.displacement));
|
||||
ADD(32, R(ABI_PARAM1), Imm32(info.displacement));
|
||||
}
|
||||
switch (info.operandSize) {
|
||||
//case 1:
|
||||
|
|
|
@ -198,6 +198,7 @@ namespace Jit64
|
|||
|
||||
bool GPRRegCache::IsXRegVolatile(X64Reg reg) const
|
||||
{
|
||||
#ifdef _WIN32
|
||||
switch (reg)
|
||||
{
|
||||
case RAX: case RCX: case RDX: case R8: case R9: case R10: case R11:
|
||||
|
@ -208,6 +209,9 @@ namespace Jit64
|
|||
default:
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void RegCache::DiscardRegContentsIfCached(int preg)
|
||||
|
@ -252,7 +256,7 @@ namespace Jit64
|
|||
#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
|
||||
R12, R13, R14, R8, R9, R10, R11, RSI, RDI //, RCX
|
||||
#endif
|
||||
#elif _M_IX86
|
||||
ESI, EDI, EBX, EBP, EDX //, RCX
|
||||
|
|
|
@ -188,9 +188,9 @@ namespace Jit64
|
|||
#ifdef _M_X64
|
||||
if (!jo.noAssumeFPLoadFromMem)
|
||||
{
|
||||
MOV(32, R(EAX), MComplex(RBX, ECX, SCALE_1, offset));
|
||||
MOV(32, R(EAX), MComplex(RBX, ABI_PARAM1, SCALE_1, offset));
|
||||
//#else
|
||||
// MOV(32, R(EAX), MDisp(ECX, (u32)Memory::GetMainRAMPtr() + (u32)offset));
|
||||
// MOV(32, R(EAX), MDisp(ABI_PARAM1, (u32)Memory::GetMainRAMPtr() + (u32)offset));
|
||||
//#endif
|
||||
BSWAP(32, EAX);
|
||||
}
|
||||
|
@ -221,8 +221,8 @@ namespace Jit64
|
|||
}
|
||||
s32 offset = (s32)(s16)inst.SIMM_16;
|
||||
gpr.Lock(a);
|
||||
MOV(32, R(ECX), gpr.R(a));
|
||||
MOV(64, R(EAX), MComplex(RBX, ECX, SCALE_1, offset));
|
||||
MOV(32, R(ABI_PARAM1), gpr.R(a));
|
||||
MOV(64, R(EAX), MComplex(RBX, ABI_PARAM1, SCALE_1, offset));
|
||||
BSWAP(64,EAX);
|
||||
MOV(64, M(&temp64), R(EAX));
|
||||
fpr.Lock(d);
|
||||
|
@ -249,10 +249,10 @@ namespace Jit64
|
|||
fpr.Lock(s);
|
||||
fpr.LoadToX64(s, true, false);
|
||||
MOVSD(M(&temp64), fpr.RX(s));
|
||||
MOV(32, R(ECX), gpr.R(a));
|
||||
MOV(32, R(ABI_PARAM1), gpr.R(a));
|
||||
MOV(64, R(EAX), M(&temp64));
|
||||
BSWAP(64, EAX);
|
||||
MOV(64, MComplex(RBX, ECX, SCALE_1, offset), R(EAX));
|
||||
MOV(64, MComplex(RBX, ABI_PARAM1, SCALE_1, offset), R(EAX));
|
||||
gpr.UnlockAll();
|
||||
fpr.UnlockAll();
|
||||
}
|
||||
|
|
|
@ -52,8 +52,8 @@ static u32 GC_ALIGNED16(temp32);
|
|||
// TODO(ector): Improve 64-bit version
|
||||
void WriteDual32(u64 value, u32 address)
|
||||
{
|
||||
Memory::Write_U32((u32)(value>>32), address);
|
||||
Memory::Write_U32((u32)value, address+4);
|
||||
Memory::Write_U32((u32)(value >> 32), address);
|
||||
Memory::Write_U32((u32)value, address + 4);
|
||||
}
|
||||
|
||||
const double m_quantizeTableD[] =
|
||||
|
@ -171,7 +171,7 @@ void psq_st(UGeckoInstruction inst)
|
|||
MOVAPS(M(&temp64), XMM0);
|
||||
MOV(16, R(ABI_PARAM1), M(&temp64));
|
||||
#ifdef _M_X64
|
||||
MOV(16, MComplex(RBX, RDX, SCALE_1, 0), R(ABI_PARAM1));
|
||||
MOV(16, MComplex(RBX, ABI_PARAM2, SCALE_1, 0), R(ABI_PARAM1));
|
||||
#else
|
||||
BSWAP(32, ABI_PARAM1);
|
||||
SHR(32, R(ABI_PARAM1), Imm8(16));
|
||||
|
@ -201,7 +201,7 @@ void psq_st(UGeckoInstruction inst)
|
|||
MOV(32, R(ABI_PARAM1), M(&temp64));
|
||||
#ifdef _M_X64
|
||||
BSWAP(32, ABI_PARAM1);
|
||||
MOV(32, MComplex(RBX, RDX, SCALE_1, 0), R(ABI_PARAM1));
|
||||
MOV(32, MComplex(RBX, ABI_PARAM2, SCALE_1, 0), R(ABI_PARAM1));
|
||||
#else
|
||||
BSWAP(32, ABI_PARAM1);
|
||||
CALL(&Memory::Write_U32);
|
||||
|
@ -321,4 +321,4 @@ void psq_l(UGeckoInstruction inst)
|
|||
//u32 EA = (m_GPR[_inst.RA] + _inst.SIMM_12) : _inst.SIMM_12;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace Jit64
|
|||
|
||||
// OK, this is easy.
|
||||
gpr.Lock(d);
|
||||
gpr.LoadToX64(d,true);
|
||||
gpr.LoadToX64(d, true);
|
||||
MOV(32, M(&PowerPC::ppcState.spr[iIndex]), gpr.R(d));
|
||||
gpr.UnlockAll();
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ VertexLoader::VertexLoader()
|
|||
m_AttrDirty = 2;
|
||||
VertexLoader_Normal::Init();
|
||||
|
||||
m_compiledCode = (u8 *)AllocateExecutableMemory(COMPILED_CODE_SIZE);
|
||||
m_compiledCode = (u8 *)AllocateExecutableMemory(COMPILED_CODE_SIZE, false);
|
||||
if (m_compiledCode) {
|
||||
memset(m_compiledCode, 0, COMPILED_CODE_SIZE);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue