Skip to content

Instantly share code, notes, and snippets.

@toptensoftware
Created October 11, 2016 01:19
Show Gist options
  • Select an option

  • Save toptensoftware/67e63c8f2eb3a3ddd7b3389a82e37def to your computer and use it in GitHub Desktop.

Select an option

Save toptensoftware/67e63c8f2eb3a3ddd7b3389a82e37def to your computer and use it in GitHub Desktop.
Applying Relocations
public override void Link(Machine machine)
{
for (int i = 0; i < _neFile.Segments.Count; i++)
{
// Get the segment
var seg = segments[i];
// Get access to the byte array backing it
var data = machine.GlobalHeap.GetBuffer(seg.globalHandle);
// Apply all relocations
for (int r=0; r<seg.relocations.Length; r++)
{
// What happens here depends on the kind of relocation
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment