mirror of
https://github.com/libretro/Play-.git
synced 2025-02-21 20:22:28 +00:00
CodeGen: Added basic x64 stuff.
git-svn-id: http://svn.purei.org/purei/trunk@640 b36208d7-6611-0410-8bec-b1987f11c4a2
This commit is contained in:
parent
0e1b9e5303
commit
ad6e573710
@ -115,10 +115,15 @@ void CJitter::PushCst(uint32 nValue)
|
|||||||
|
|
||||||
void CJitter::PushRef(void* pAddr)
|
void CJitter::PushRef(void* pAddr)
|
||||||
{
|
{
|
||||||
if(sizeof(pAddr) == 4)
|
size_t addrSize = sizeof(pAddr);
|
||||||
|
if(addrSize == 4)
|
||||||
{
|
{
|
||||||
m_Shadow.Push(MakeSymbol(SYM_CONSTANT, *reinterpret_cast<uint32*>(&pAddr)));
|
m_Shadow.Push(MakeSymbol(SYM_CONSTANT, *reinterpret_cast<uint32*>(&pAddr)));
|
||||||
}
|
}
|
||||||
|
else if(addrSize == 8)
|
||||||
|
{
|
||||||
|
m_Shadow.Push(MakeConstant64(*reinterpret_cast<uint64*>(&pAddr)));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(0);
|
assert(0);
|
||||||
@ -200,10 +205,21 @@ void CJitter::Call(void* pFunc, unsigned int nParamCount, bool nKeepRet)
|
|||||||
InsertStatement(paramStatement);
|
InsertStatement(paramStatement);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(sizeof(void*) == 4);
|
size_t addrSize = sizeof(pFunc);
|
||||||
|
|
||||||
STATEMENT callStatement;
|
STATEMENT callStatement;
|
||||||
callStatement.src1 = MakeSymbolRef(MakeSymbol(SYM_CONSTANT, reinterpret_cast<uint32>(pFunc)));
|
if(addrSize == 4)
|
||||||
|
{
|
||||||
|
callStatement.src1 = MakeSymbolRef(MakeSymbol(SYM_CONSTANT, reinterpret_cast<uint32>(pFunc)));
|
||||||
|
}
|
||||||
|
else if(addrSize == 8)
|
||||||
|
{
|
||||||
|
callStatement.src1 = MakeSymbolRef(MakeConstant64(reinterpret_cast<uint64>(pFunc)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
callStatement.src2 = MakeSymbolRef(MakeSymbol(SYM_CONSTANT, nParamCount));
|
callStatement.src2 = MakeSymbolRef(MakeSymbol(SYM_CONSTANT, nParamCount));
|
||||||
callStatement.op = OP_CALL;
|
callStatement.op = OP_CALL;
|
||||||
InsertStatement(callStatement);
|
InsertStatement(callStatement);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <assert.h>
|
||||||
#include "MemoryFunction.h"
|
#include "MemoryFunction.h"
|
||||||
|
|
||||||
CMemoryFunction::CMemoryFunction(const void* code, size_t size)
|
CMemoryFunction::CMemoryFunction(const void* code, size_t size)
|
||||||
@ -18,6 +19,12 @@ void CMemoryFunction::operator()(void* context)
|
|||||||
volatile const void* code = m_code;
|
volatile const void* code = m_code;
|
||||||
volatile const void* dataPtr = context;
|
volatile const void* dataPtr = context;
|
||||||
|
|
||||||
|
#ifdef AMD64
|
||||||
|
|
||||||
|
assert(0);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
push ebp
|
push ebp
|
||||||
@ -34,4 +41,7 @@ void CMemoryFunction::operator()(void* context)
|
|||||||
pop ebx
|
pop ebx
|
||||||
pop ebp
|
pop ebp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user