Cosmos/source2/Compiler/Cosmos.Compiler.DebugStub/TracerEntry.cs
kudzu_cp 69312b510f
2012-07-11 17:36:39 +00:00

30 lines
1.1 KiB
C#

using System;
using System.Linq;
using Cosmos.Assembler;
using Cosmos.Assembler.x86;
namespace Cosmos.Debug.DebugStub {
public class TracerEntry : Cosmos.Assembler.Code {
public TracerEntry(Assembler.Assembler aAssembler) : base(aAssembler) {}
public override void Assemble() {
new LiteralAssemblerCode("DebugStub_TracerEntry:");
new LiteralAssemblerCode("Mov [DebugStub_CallerEBP], EBP");
new LiteralAssemblerCode("Add ESP, 12");
new LiteralAssemblerCode("Mov [DebugStub_CallerESP], ESP");
new LiteralAssemblerCode("Sub ESP, 12");
new LiteralAssemblerCode("Pushad");
new LiteralAssemblerCode("Mov [DebugStub_PushAllPtr], ESP");
new LiteralAssemblerCode("Mov EBP, ESP");
new LiteralAssemblerCode("Add EBP, 32");
new LiteralAssemblerCode("Mov EAX, [EBP + 0]");
new LiteralAssemblerCode("Dec EAX");
new LiteralAssemblerCode("Mov [DebugStub_CallerEIP], EAX");
new LiteralAssemblerCode("Call DebugStub_Executing");
new LiteralAssemblerCode("Popad");
new LiteralAssemblerCode("DebugStub_TracerEntry_Exit:");
new LiteralAssemblerCode("IRet");
}
}
}