public void AddPatch(LinkRequest linkRequest) { lock (_lock) { LinkRequests.Add(linkRequest); } }
private void ApplyPatch(LinkRequest linkRequest) { ulong value = 0; if (linkRequest.LinkType == LinkType.Size) { value = linkRequest.ReferenceSymbol.Size; } else { value = linkRequest.ReferenceSymbol.VirtualAddress + (ulong)linkRequest.ReferenceOffset; if (linkRequest.LinkType == LinkType.AbsoluteAddress) { // FIXME: Need a .reloc section with a relocation entry if the module is moved in virtual memory // the runtime loader must patch this link request, we'll fail it until we can do relocations. //throw new NotSupportedException(@".reloc section not supported."); } else { // Change the absolute into a relative offset value = value - (linkRequest.PatchSymbol.VirtualAddress + (ulong)linkRequest.PatchOffset); } } linkRequest.PatchSymbol.ApplyPatch( linkRequest.PatchOffset, value, GetPatchTypeSize(linkRequest.PatchType), Endianness ); }
public void Link(LinkType linkType, PatchType patchType, LinkerSymbol patchSymbol, int patchOffset, int relativeBase, LinkerSymbol referenceSymbol, int referenceOffset) { lock (mylock) { var linkRequest = new LinkRequest(linkType, patchType, patchSymbol, patchOffset, relativeBase, referenceSymbol, referenceOffset); LinkRequests.Add(linkRequest); } }
private void ApplyPatch(LinkRequest linkRequest) { ulong value = 0; if (linkRequest.LinkType == LinkType.Size) { value = linkRequest.ReferenceSymbol.Size; } else { ulong targetAddress = linkRequest.ReferenceSymbol.VirtualAddress + (ulong)linkRequest.ReferenceOffset; if (linkRequest.LinkType == LinkType.AbsoluteAddress) { // FIXME: Need a .reloc section with a relocation entry if the module is moved in virtual memory // the runtime loader must patch this link request, we'll fail it until we can do relocations. //throw new NotSupportedException(@".reloc section not supported."); } else { // Change the absolute into a relative offset targetAddress = targetAddress - (linkRequest.PatchSymbol.VirtualAddress + (ulong)linkRequest.PatchOffset); } targetAddress = targetAddress + (ulong)linkRequest.RelativeBase; value = Patch.GetResult(linkRequest.PatchType.Patches, (ulong)targetAddress); } ulong mask = Patch.GetFinalMask(linkRequest.PatchType.Patches); linkRequest.PatchSymbol.ApplyPatch( linkRequest.PatchOffset, value, mask, linkRequest.PatchType.Size, Endianness ); }
private void ApplyPatch(LinkRequest linkRequest) { ulong value = 0; if (linkRequest.LinkType == LinkType.Size) { value = linkRequest.ReferenceSymbol.Size; } else { ulong targetAddress = linkRequest.ReferenceSymbol.VirtualAddress + (ulong)linkRequest.ReferenceOffset; if (linkRequest.LinkType == LinkType.AbsoluteAddress) { // FIXME: Need a .reloc section with a relocation entry if the module is moved in virtual memory // the runtime loader must patch this link request, we'll fail it until we can do relocations. //throw new NotSupportedException(@".reloc section not supported."); } else { // Change the absolute into a relative offset targetAddress = targetAddress - (linkRequest.PatchSymbol.VirtualAddress + (ulong)linkRequest.PatchOffset); } targetAddress = targetAddress + (ulong)linkRequest.RelativeBase; value = Patch.GetResult(linkRequest.PatchType.Patches, (ulong)targetAddress); } ulong mask = Patch.GetFinalMask(linkRequest.PatchType.Patches); linkRequest.PatchSymbol.ApplyPatch( linkRequest.PatchOffset, value, mask, linkRequest.PatchType.Size, Endianness ); }
public void Link(LinkType linkType, PatchType patchType, LinkerSymbol patchSymbol, int patchOffset, int relativeBase, LinkerSymbol referenceSymbol, int referenceOffset) { lock (mylock) { var linkRequest = new LinkRequest(linkType, patchType, patchSymbol, patchOffset, relativeBase, referenceSymbol, referenceOffset); //LinkRequests.Add(linkRequest); patchSymbol.AddPatch(linkRequest); } }
public void AddPatch(LinkRequest linkRequest) { lock(this) { LinkRequests.Add(linkRequest); } }
private void ApplyPatch(LinkRequest linkRequest) { ulong value = 0; if (linkRequest.LinkType == LinkType.Size) { value = linkRequest.ReferenceSymbol.Size; } else { value = linkRequest.ReferenceSymbol.VirtualAddress + (ulong)linkRequest.ReferenceOffset; if (linkRequest.LinkType == LinkType.AbsoluteAddress) { // FIXME: Need a .reloc section with a relocation entry if the module is moved in virtual memory // the runtime loader must patch this link request, we'll fail it until we can do relocations. //throw new NotSupportedException(@".reloc section not supported."); } else { // Change the absolute into a relative offset value = value - (linkRequest.PatchSymbol.VirtualAddress + (ulong)linkRequest.PatchOffset); } } linkRequest.PatchSymbol.ApplyPatch( linkRequest.PatchOffset, value, GetPatchTypeSize(linkRequest.PatchType), Endianness ); }