Пример #1
0
        internal static void WriteInfoCodeReloc(long address, bool highCq, PtcInfo ptcInfo)
        {
            lock (_lock)
            {
                // WriteInfo.
                _infosWriter.Write((long)address);                  // InfoEntry.Address
                _infosWriter.Write((bool)highCq);                   // InfoEntry.HighCq
                _infosWriter.Write((int)ptcInfo.CodeStream.Length); // InfoEntry.CodeLen
                _infosWriter.Write((int)ptcInfo.RelocEntriesCount); // InfoEntry.RelocEntriesCount

                // WriteCode.
                ptcInfo.CodeStream.WriteTo(_codesStream);

                // WriteReloc.
                ptcInfo.RelocStream.WriteTo(_relocsStream);

                // WriteUnwindInfo.
                ptcInfo.UnwindInfoStream.WriteTo(_unwindInfosStream);
            }
        }
Пример #2
0
        internal static void WriteInfoCodeRelocUnwindInfo(ulong address, ulong guestSize, Hash128 hash, bool highCq, PtcInfo ptcInfo)
        {
            lock (_lock)
            {
                InfoEntry infoEntry = new InfoEntry();

                infoEntry.Address           = address;
                infoEntry.GuestSize         = guestSize;
                infoEntry.Hash              = hash;
                infoEntry.HighCq            = highCq;
                infoEntry.Stubbed           = false;
                infoEntry.CodeLength        = ptcInfo.Code.Length;
                infoEntry.RelocEntriesCount = ptcInfo.RelocEntriesCount;

                SerializeStructure(_infosStream, infoEntry);

                WriteCode(ptcInfo.Code.AsSpan());

                // WriteReloc.
                ptcInfo.RelocStream.WriteTo(_relocsStream);

                // WriteUnwindInfo.
                ptcInfo.UnwindInfoStream.WriteTo(_unwindInfosStream);
            }
        }
Пример #3
0
        internal static void WriteInfoCodeRelocUnwindInfo(ulong address, ulong guestSize, bool highCq, PtcInfo ptcInfo)
        {
            lock (_lock)
            {
                // WriteInfo.
                _infosWriter.Write((ulong)address);                 // InfoEntry.Address
                _infosWriter.Write((ulong)guestSize);               // InfoEntry.GuestSize
                _infosWriter.Write((bool)highCq);                   // InfoEntry.HighCq
                _infosWriter.Write((bool)false);                    // InfoEntry.Stubbed
                _infosWriter.Write((int)ptcInfo.Code.Length);       // InfoEntry.CodeLength
                _infosWriter.Write((int)ptcInfo.RelocEntriesCount); // InfoEntry.RelocEntriesCount

                WriteCode(ptcInfo.Code.AsSpan());

                // WriteReloc.
                ptcInfo.RelocStream.WriteTo(_relocsStream);

                // WriteUnwindInfo.
                ptcInfo.UnwindInfoStream.WriteTo(_unwindInfosStream);
            }
        }