mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 20:39:01 +00:00
122 lines
6.4 KiB
C#
122 lines
6.4 KiB
C#
using System;
|
|
using System.Linq;
|
|
using Cosmos.Assembler;
|
|
using Cosmos.Assembler.x86;
|
|
|
|
namespace Cosmos.Debug.DebugStub {
|
|
public class CmdSend : Cosmos.Assembler.Code {
|
|
|
|
public CmdSend(Assembler.Assembler aAssembler) : base(aAssembler) {}
|
|
|
|
public override void Assemble() {
|
|
new LiteralAssemblerCode("DebugStub_SendRegisters:");
|
|
new LiteralAssemblerCode("Mov AL, DebugStub_Const_Ds2Vs_Registers");
|
|
new LiteralAssemblerCode("Call DebugStub_ComWriteAL");
|
|
new LiteralAssemblerCode("Mov ESI, [DebugStub_PushAllPtr]");
|
|
new LiteralAssemblerCode("Mov ECX, 32");
|
|
new LiteralAssemblerCode("Call DebugStub_ComWriteX");
|
|
new LiteralAssemblerCode("Mov ESI, DebugStub_CallerESP");
|
|
new LiteralAssemblerCode("Call DebugStub_ComWrite32");
|
|
new LiteralAssemblerCode("Mov ESI, DebugStub_CallerEIP");
|
|
new LiteralAssemblerCode("Call DebugStub_ComWrite32");
|
|
new LiteralAssemblerCode("DebugStub_SendRegisters_Exit:");
|
|
new LiteralAssemblerCode("Ret");
|
|
new LiteralAssemblerCode("DebugStub_SendFrame:");
|
|
new LiteralAssemblerCode("Mov AL, DebugStub_Const_Ds2Vs_Frame");
|
|
new LiteralAssemblerCode("Call DebugStub_ComWriteAL");
|
|
new LiteralAssemblerCode("Mov EAX, 32");
|
|
new LiteralAssemblerCode("Call DebugStub_ComWriteAX");
|
|
new LiteralAssemblerCode("Mov ESI, [DebugStub_CallerEBP]");
|
|
new LiteralAssemblerCode("Add ESI, 8");
|
|
new LiteralAssemblerCode("Mov ECX, 32");
|
|
new LiteralAssemblerCode("Call DebugStub_ComWriteX");
|
|
new LiteralAssemblerCode("DebugStub_SendFrame_Exit:");
|
|
new LiteralAssemblerCode("Ret");
|
|
new LiteralAssemblerCode("DebugStub_SendStack:");
|
|
new LiteralAssemblerCode("Mov AL, DebugStub_Const_Ds2Vs_Stack");
|
|
new LiteralAssemblerCode("Call DebugStub_ComWriteAL");
|
|
new LiteralAssemblerCode("Mov ESI, [DebugStub_CallerESP]");
|
|
new LiteralAssemblerCode("Mov EAX, [DebugStub_CallerEBP]");
|
|
new LiteralAssemblerCode("Sub EAX, ESI");
|
|
new LiteralAssemblerCode("Call DebugStub_ComWriteAX");
|
|
new LiteralAssemblerCode("Mov ESI, [DebugStub_CallerESP]");
|
|
new LiteralAssemblerCode("DebugStub_SendStack_SendByte:");
|
|
new LiteralAssemblerCode("Cmp ESI, [DebugStub_CallerEBP]");
|
|
new LiteralAssemblerCode("JE DebugStub_SendStack_Exit");
|
|
new LiteralAssemblerCode("Call DebugStub_ComWrite8");
|
|
new LiteralAssemblerCode("Jmp DebugStub_SendStack_SendByte");
|
|
new LiteralAssemblerCode("DebugStub_SendStack_Exit:");
|
|
new LiteralAssemblerCode("Ret");
|
|
new LiteralAssemblerCode("DebugStub_SendMethodContext2:");
|
|
new LiteralAssemblerCode("Mov AL, DebugStub_Const_Ds2Vs_MethodContext");
|
|
new LiteralAssemblerCode("Call DebugStub_ComWriteAL");
|
|
new LiteralAssemblerCode("Call DebugStub_ComReadEAX");
|
|
new LiteralAssemblerCode("Mov ECX, EAX");
|
|
new LiteralAssemblerCode("Call DebugStub_ComReadEAX");
|
|
new LiteralAssemblerCode("Mov ESI, [DebugStub_CallerEBP]");
|
|
new LiteralAssemblerCode("Add ESI, EAX");
|
|
new LiteralAssemblerCode("DebugStub_SendMethodContext2_SendByte:");
|
|
new LiteralAssemblerCode("Cmp ECX, 0");
|
|
new LiteralAssemblerCode("JE DebugStub_SendMethodContext2_AfterSendByte");
|
|
new LiteralAssemblerCode("Call DebugStub_ComWrite8");
|
|
new LiteralAssemblerCode("Dec ECX");
|
|
new LiteralAssemblerCode("Jmp DebugStub_SendMethodContext2_SendByte");
|
|
new LiteralAssemblerCode("DebugStub_SendMethodContext2_AfterSendByte:");
|
|
new LiteralAssemblerCode("DebugStub_SendMethodContext2_Exit:");
|
|
new LiteralAssemblerCode("Ret");
|
|
new LiteralAssemblerCode("DebugStub_SendMemory2:");
|
|
new LiteralAssemblerCode("Call DebugStub_ComReadEAX");
|
|
new LiteralAssemblerCode("Mov ECX, EAX");
|
|
new LiteralAssemblerCode("Mov AL, DebugStub_Const_Ds2Vs_MemoryData");
|
|
new LiteralAssemblerCode("Call DebugStub_ComWriteAL");
|
|
new LiteralAssemblerCode("Call DebugStub_ComReadEAX");
|
|
new LiteralAssemblerCode("Mov ESI, EAX");
|
|
new LiteralAssemblerCode("DebugStub_SendMemory2_SendByte:");
|
|
new LiteralAssemblerCode("Cmp ECX, 0");
|
|
new LiteralAssemblerCode("JE DebugStub_SendMemory2_AfterSendByte");
|
|
new LiteralAssemblerCode("Call DebugStub_ComWrite8");
|
|
new LiteralAssemblerCode("Dec ECX");
|
|
new LiteralAssemblerCode("Jmp DebugStub_SendMemory2_SendByte");
|
|
new LiteralAssemblerCode("DebugStub_SendMemory2_AfterSendByte:");
|
|
new LiteralAssemblerCode("DebugStub_SendMemory2_Exit:");
|
|
new LiteralAssemblerCode("Ret");
|
|
new LiteralAssemblerCode("DebugStub_SendTrace:");
|
|
new LiteralAssemblerCode("Cmp dword [DebugStub_DebugStatus], DebugStub_Const_Status_Run");
|
|
new LiteralAssemblerCode("JE DebugStub_SendTrace_Normal");
|
|
new LiteralAssemblerCode("Mov AL, DebugStub_Const_Ds2Vs_BreakPoint");
|
|
new LiteralAssemblerCode("Jmp DebugStub_SendTrace_Type");
|
|
new LiteralAssemblerCode("DebugStub_SendTrace_Normal:");
|
|
new LiteralAssemblerCode("Mov AL, DebugStub_Const_Ds2Vs_TracePoint");
|
|
new LiteralAssemblerCode("DebugStub_SendTrace_Type:");
|
|
new LiteralAssemblerCode("Call DebugStub_ComWriteAL");
|
|
new LiteralAssemblerCode("Mov ESI, DebugStub_CallerEIP");
|
|
new LiteralAssemblerCode("Call DebugStub_ComWrite32");
|
|
new LiteralAssemblerCode("DebugStub_SendTrace_Exit:");
|
|
new LiteralAssemblerCode("Ret");
|
|
new LiteralAssemblerCode("DebugStub_SendText:");
|
|
new LiteralAssemblerCode("Mov AL, DebugStub_Const_Ds2Vs_Message");
|
|
new LiteralAssemblerCode("Call DebugStub_ComWriteAL");
|
|
new LiteralAssemblerCode("Mov ESI, EBP");
|
|
new LiteralAssemblerCode("Add ESI, 12");
|
|
new LiteralAssemblerCode("Mov ECX, [ESI + 0]");
|
|
new LiteralAssemblerCode("Call DebugStub_ComWrite16");
|
|
new LiteralAssemblerCode("Mov ESI, [EBP + 8]");
|
|
new LiteralAssemblerCode("DebugStub_SendText_WriteChar:");
|
|
new LiteralAssemblerCode("Cmp ECX, 0");
|
|
new LiteralAssemblerCode("JE DebugStub_SendText_Exit");
|
|
new LiteralAssemblerCode("Call DebugStub_ComWrite8");
|
|
new LiteralAssemblerCode("Dec ECX");
|
|
new LiteralAssemblerCode("Inc ESI");
|
|
new LiteralAssemblerCode("Jmp DebugStub_SendText_WriteChar");
|
|
new LiteralAssemblerCode("DebugStub_SendText_Exit:");
|
|
new LiteralAssemblerCode("Ret");
|
|
new LiteralAssemblerCode("DebugStub_SendPtr:");
|
|
new LiteralAssemblerCode("Mov AL, DebugStub_Const_Ds2Vs_Pointer");
|
|
new LiteralAssemblerCode("Call DebugStub_ComWriteAL");
|
|
new LiteralAssemblerCode("Mov ESI, [EBP + 8]");
|
|
new LiteralAssemblerCode("Call DebugStub_ComWrite32");
|
|
new LiteralAssemblerCode("DebugStub_SendPtr_Exit:");
|
|
new LiteralAssemblerCode("Ret");
|
|
}
|
|
}
|
|
}
|