Skip to content

Commit

Permalink
Add kernel panic method to debugstub.
Browse files Browse the repository at this point in the history
  • Loading branch information
mterwoord committed Jun 25, 2016
1 parent 6e5d762 commit c083c8f
Show file tree
Hide file tree
Showing 14 changed files with 471 additions and 395 deletions.
5 changes: 5 additions & 0 deletions Tests/Cosmos.TestRunner.Core/Engine.Running.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ private void InitializeDebugConnector(DebugConnector debugConnector)
debugConnector.CmdComplexNumber += f => OutputHandler.LogMessage("Number from kernel: 0x" + f.ToString("X8").ToUpper());
debugConnector.CmdComplexLongNumber += d => OutputHandler.LogMessage("Number from kernel: 0x" + d.ToString("X16").ToUpper());
debugConnector.CmdMessageBox = s => OutputHandler.LogMessage("MessageBox from kernel: " + s);
debugConnector.CmdKernelPanic = n =>
{
OutputHandler.LogMessage("Kernel panic! Nummer = " + n);
// todo: add core dump here, call stack.
};
debugConnector.CmdTrace = t => { };
debugConnector.CmdBreak = t => { };
debugConnector.CmdStackCorruptionOccurred = a =>
Expand Down
1 change: 1 addition & 0 deletions source/Cosmos.Common/Cosmos.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
<Compile Include="Enums.cs" />
<Compile Include="Extensions\ByteConverter.cs" />
<Compile Include="Extensions\ToHexString.cs" />
<Compile Include="KernelPanicTypes.cs" />
<Compile Include="NumberHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RingAttribute.cs" />
Expand Down
8 changes: 8 additions & 0 deletions source/Cosmos.Common/KernelPanicTypes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Cosmos.Common
{
public static class KernelPanicTypes
{
public static readonly uint VMT_MethodNotFound = 0x1;
public static readonly uint VMT_MethodFoundButAddressInvalid = 2;
}
}
1 change: 1 addition & 0 deletions source/Cosmos.Debug.Common/Consts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public static class Ds2Vs
public const byte ComplexLongNumber = 21;
public const byte StackOverflowOccurred = 22;
public const byte InterruptOccurred = 23;
public const byte KernelPanic = 24;
}

// Messages from Host (VS) to Guest (Cosmos)
Expand Down
6 changes: 6 additions & 0 deletions source/Cosmos.Debug.Common/DebugConnector.Receiving.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ protected void PacketSimpleNumber(byte[] aPacket)
WaitForMessage();
}

protected void PacketKernelPanic(byte[] aPacket)
{
CmdKernelPanic?.Invoke(GetUInt32(aPacket, 0));
WaitForMessage();
}

protected void PacketSimpleLongNumber(byte[] aPacket)
{
CmdSimpleLongNumber?.Invoke(GetUInt64(aPacket, 0));
Expand Down
6 changes: 6 additions & 0 deletions source/Cosmos.Debug.Common/DebugConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public abstract partial class DebugConnector : IDisposable
public Action<UInt32> CmdInterruptOccurred;
public Action<UInt32> CmdNullReferenceOccurred;
public Action<uint> CmdSimpleNumber;
public Action<uint> CmdKernelPanic;
public Action<ulong> CmdSimpleLongNumber;
public Action<float> CmdComplexNumber;
public Action<double> CmdComplexLongNumber;
Expand Down Expand Up @@ -262,6 +263,11 @@ protected void PacketMsg(byte[] aPacket)
Next(4, PacketSimpleNumber);
break;

case Ds2Vs.KernelPanic:
DebugLog("DC Recv: KernelPanic");
Next(4, PacketKernelPanic);
break;

case Ds2Vs.SimpleLongNumber:
DebugLog("DC Recv: SimpleLongNumber");
Next(8, PacketSimpleLongNumber);
Expand Down
Loading

0 comments on commit c083c8f

Please sign in to comment.