Update arm/arm64 to use asmjit

This commit is contained in:
zilmar 2023-04-05 10:16:21 +09:30
parent 2c40d47a34
commit 9a04293a67
8 changed files with 55 additions and 4 deletions

View File

@ -4,11 +4,15 @@
#include <Project64-core/N64System/Mips/Register.h>
#include <Project64-core/Settings/DebugSettings.h>
class CX86RecompilerOps;
class R4300iOp :
public CLogging,
protected CDebugSettings,
protected CSystemRegisters
{
friend CX86RecompilerOps;
public:
typedef void (*Func)();

View File

@ -1692,7 +1692,7 @@ void CN64System::DumpSyncErrors(CN64System * SecondCPU)
if (m_Recomp->MemoryStackPos() != TargetStackPos)
{
Error.LogF("MemoryStack = %p should be: %p\r\n", m_Recomp->MemoryStackPos(), (uint32_t)(m_MMU_VM.Rdram() + (m_Reg.m_GPR[29].W[0] & 0x1FFFFFFF)));
Error.LogF("MemoryStack = %p should be: %p\r\n", m_Recomp->MemoryStackPos(), (m_MMU_VM.Rdram() + (m_Reg.m_GPR[29].W[0] & 0x1FFFFFFF)));
}
}

View File

@ -2,10 +2,24 @@
#if defined(__aarch64__)
#include <Project64-core/N64System/Recompiler/Aarch64/Aarch64ops.h>
#include <Project64-core/N64System/Recompiler/CodeBlock.h>
CAarch64Ops::CAarch64Ops(CCodeBlock & CodeBlock) :
asmjit::a64::Assembler(&CodeBlock.CodeHolder()),
m_CodeBlock(CodeBlock)
{
}
asmjit::Error CAarch64Ops::_log(const char * data, size_t size) noexcept
{
stdstr AsmjitLog(std::string(data, size));
AsmjitLog.Trim("\n");
for (SymbolMap::const_iterator itr = m_Symbols.begin(); itr != m_Symbols.end(); itr++)
{
AsmjitLog.Replace(itr->first, itr->second);
}
m_CodeBlock.Log(" %s", AsmjitLog.c_str());
return asmjit::kErrorOk;
}
#endif

View File

@ -1,9 +1,12 @@
#pragma once
#if defined(__aarch64__)
#include <Project64-core/N64System/Recompiler/asmjit.h>
class CCodeBlock;
class CAarch64Ops
class CAarch64Ops :
public asmjit::a64::Assembler,
public asmjit::Logger
{
public:
CAarch64Ops(CCodeBlock & CodeBlock);
@ -13,6 +16,11 @@ private:
CAarch64Ops(const CAarch64Ops &);
CAarch64Ops & operator=(const CAarch64Ops &);
asmjit::Error _log(const char * data, size_t size) noexcept;
typedef std::map<std::string, std::string> SymbolMap;
SymbolMap m_Symbols;
CCodeBlock & m_CodeBlock;
};

View File

@ -1,10 +1,24 @@
#include "stdafx.h"
#if defined(__arm__) || defined(_M_ARM)
#include <Project64-core/N64System/Recompiler/Arm/ArmOps.h>
#include <Project64-core/N64System/Recompiler/CodeBlock.h>
CArmOps::CArmOps(CCodeBlock & CodeBlock) :
asmjit::a64::Assembler(&CodeBlock.CodeHolder()),
m_CodeBlock(CodeBlock)
{
}
asmjit::Error CArmOps::_log(const char * data, size_t size) noexcept
{
stdstr AsmjitLog(std::string(data, size));
AsmjitLog.Trim("\n");
for (SymbolMap::const_iterator itr = m_Symbols.begin(); itr != m_Symbols.end(); itr++)
{
AsmjitLog.Replace(itr->first, itr->second);
}
m_CodeBlock.Log(" %s", AsmjitLog.c_str());
return asmjit::kErrorOk;
}
#endif

View File

@ -1,9 +1,12 @@
#pragma once
#if defined(__arm__) || defined(_M_ARM)
#include <Project64-core/N64System/Recompiler/asmjit.h>
class CCodeBlock;
class CArmOps
class CArmOps :
public asmjit::a64::Assembler,
public asmjit::Logger
{
public:
CArmOps(CCodeBlock & CodeBlock);
@ -13,6 +16,11 @@ private:
CArmOps(const CArmOps &);
CArmOps & operator=(const CArmOps &);
asmjit::Error _log(const char * data, size_t size) noexcept;
typedef std::map<std::string, std::string> SymbolMap;
SymbolMap m_Symbols;
CCodeBlock & m_CodeBlock;
};

View File

@ -10,3 +10,6 @@
#else
#include <asmjit\asmjit.h>
#endif
#include <asmjit\a64.h>
#include <asmjit\arm.h>
#include <asmjit\arm\a64assembler.h>

View File

@ -200,7 +200,7 @@ void CX86RecompilerOps::PreCompileOpcode(void)
/*if (m_CompilePC == 0x803275F4 && m_PipelineStage == PIPELINE_STAGE_NORMAL)
{
m_Assembler.X86BreakPoint(__FILE__, __LINE__);
}
}*/
/*if (m_CompilePC >= 0x80000000 && m_CompilePC <= 0x80400000 && m_PipelineStage == PIPELINE_STAGE_NORMAL)
{