public override void Emit(x86Stream strm) { EmittedAddress = (uint)strm.Position; Emitted = true; bool movedInStream = false; // Patch the instructions that have already been // emitted, the rest will use our address without // patching. foreach (var instr in PreMarkingReferencedInstructions) { foreach (PatchableLocationDescription pldesc in instr.PatchableLocations) { if (pldesc.TargetLabel == this) { movedInStream = true; strm.Position = pldesc.PatchLocation; if (pldesc.Relative) { #warning Need to support relative patches throw new Exception("This isn't currently supported! :("); } else { strm.WriteAddressLiteral(EmittedAddress); } } } } if (movedInStream) { strm.Position = EmittedAddress; } }
public override void Emit(x86Stream strm) { if (PopSize == 0) { // No pop if (Segment == x86Segment.CS) { // Near return strm.WriteByte(0xC3); } else { // Far return strm.WriteByte(0xCB); } } else { // pop if (Segment == x86Segment.CS) { // Near return strm.WriteByte(0xC2); strm.WriteImm16(PopSize); } else { // Far return strm.WriteByte(0xCA); strm.WriteImm16(PopSize); } } }
public override void Emit(Stream strm) { x86Stream emissionStream = new x86Stream(strm); for(int i = 0; i < Instructions.Count; i++) { Instructions[i].Emit(emissionStream); } }
public override void Emit(x86Stream strm) { strm.WriteByte(0x8B); strm.WriteMem(0, 0); this.PatchableLocations.Add( new PatchableLocationDescription() { TargetLabel = target, PatchLocation = (uint)strm.Position - 4, } ); }
public override void Emit(x86Stream strm) { strm.WriteByte(0x90); }
public abstract void Emit(x86Stream strm);