mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2024-12-23 18:35:47 +00:00
b5c215111d
* Added support for offline invalidation, via PPTC, of low cq translations replaced by high cq translations; both on a single run and between runs. Added invalidation of .cache files in the event of reuse on a different user operating system. Added .info and .cache files invalidation in case of a failed stream decompression. Nits. * InternalVersion = 1712; * Nits. * Address comment. * Get rid of BinaryFormatter. Nits. * Move Ptc.LoadTranslations(). Nits. * Nits. * Fixed corner cases (in case backup copies have to be used). Added save logs. * Not core fixes. * Complement to the previous commit. Added load logs. Removed BinaryFormatter leftovers. * Add LoadTranslations log. * Nits. * Removed the search and management of LowCq overlapping functions. * Final increment of .info and .cache flags. * Nit. * GetIndirectFunctionAddress(): Validate that writing actually takes place in dynamic table memory range (and not elsewhere). * Fix Ptc.UpdateInfo() due to rebase. * Nit for retrigger Checks. * Nit for retrigger Checks.
68 lines
2.1 KiB
C#
68 lines
2.1 KiB
C#
using ARMeilleure.CodeGen.Unwinding;
|
|
using System;
|
|
using System.IO;
|
|
|
|
namespace ARMeilleure.Translation.PTC
|
|
{
|
|
class PtcInfo : IDisposable
|
|
{
|
|
private readonly BinaryWriter _relocWriter;
|
|
private readonly BinaryWriter _unwindInfoWriter;
|
|
|
|
public MemoryStream CodeStream { get; }
|
|
public MemoryStream RelocStream { get; }
|
|
public MemoryStream UnwindInfoStream { get; }
|
|
|
|
public int RelocEntriesCount { get; private set; }
|
|
|
|
public PtcInfo()
|
|
{
|
|
CodeStream = new MemoryStream();
|
|
RelocStream = new MemoryStream();
|
|
UnwindInfoStream = new MemoryStream();
|
|
|
|
_relocWriter = new BinaryWriter(RelocStream, EncodingCache.UTF8NoBOM, true);
|
|
_unwindInfoWriter = new BinaryWriter(UnwindInfoStream, EncodingCache.UTF8NoBOM, true);
|
|
|
|
RelocEntriesCount = 0;
|
|
}
|
|
|
|
public void WriteCode(MemoryStream codeStream)
|
|
{
|
|
codeStream.WriteTo(CodeStream);
|
|
}
|
|
|
|
public void WriteRelocEntry(RelocEntry relocEntry)
|
|
{
|
|
_relocWriter.Write((int)relocEntry.Position);
|
|
_relocWriter.Write((int)relocEntry.Index);
|
|
|
|
RelocEntriesCount++;
|
|
}
|
|
|
|
public void WriteUnwindInfo(UnwindInfo unwindInfo)
|
|
{
|
|
_unwindInfoWriter.Write((int)unwindInfo.PushEntries.Length);
|
|
|
|
foreach (UnwindPushEntry unwindPushEntry in unwindInfo.PushEntries)
|
|
{
|
|
_unwindInfoWriter.Write((int)unwindPushEntry.PseudoOp);
|
|
_unwindInfoWriter.Write((int)unwindPushEntry.PrologOffset);
|
|
_unwindInfoWriter.Write((int)unwindPushEntry.RegIndex);
|
|
_unwindInfoWriter.Write((int)unwindPushEntry.StackOffsetOrAllocSize);
|
|
}
|
|
|
|
_unwindInfoWriter.Write((int)unwindInfo.PrologSize);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
_relocWriter.Dispose();
|
|
_unwindInfoWriter.Dispose();
|
|
|
|
CodeStream.Dispose();
|
|
RelocStream.Dispose();
|
|
UnwindInfoStream.Dispose();
|
|
}
|
|
}
|
|
}
|