This commit is contained in:
kudzu_cp 2011-07-22 14:49:58 +00:00
parent ae4c857ea3
commit 01cb66caab
2 changed files with 14 additions and 14 deletions

View file

@ -108,6 +108,11 @@ namespace Cosmos.Compiler.DebugStub {
static protected DataMember32 DebugStatus;
// Nesting control for non steppable routines
static protected DataMember32 DebugSuspendLevel;
// Ptr to the push all data. It points to the "bottom" after a PushAll op.
// Walk up to find the 8 x 32 bit registers.
static protected DataMember32 DebugPushAllPtr;
// State of Interrupts on entry
static protected DataMember32 InterruptsEnabledFlag;
public DebugStub(int aComNo) {
mComNo = aComNo;
@ -116,11 +121,6 @@ namespace Cosmos.Compiler.DebugStub {
// Old method, need to convert to fields
mAsm.DataMembers.AddRange(new DataMember[]{
// Ptr to the push all data. It points to the "bottom" after a PushAll op.
// Walk up to find the 8 x 32 bit registers.
new DataMember("DebugPushAllPtr", 0),
new DataMember("InterruptsEnabledFlag", 0),
// If set non 0, on next trace a break will occur
new DataMember("DebugBreakOnNextTrace", (uint)StepTrigger.None),
// For step out and over this is used to determine where the initial request was made
@ -623,8 +623,8 @@ namespace Cosmos.Compiler.DebugStub {
public override void Assemble() {
AL = (int)DsMsgType.Registers; // Send the actual started signal
Call<WriteALToComPort>();
ESI = Memory["DebugPushAllPtr"];
ESI = DebugPushAllPtr.Value;
WriteBytesToComPort(32);
ESI = CallerESP.Address;
WriteBytesToComPort(4);
@ -912,7 +912,7 @@ namespace Cosmos.Compiler.DebugStub {
// But we need to see if IRQs are disabled.
// If IRQ disabled, we dont reenable them after our disable
// in this routine.
Memory["InterruptsEnabledFlag", 32].Compare(0);
InterruptsEnabledFlag.Value.Compare(0);
JumpIf(Flags.Equal, "DebugStub_Return");
EnableInterrupts();
Jump("DebugStub_Return");
@ -931,14 +931,14 @@ namespace Cosmos.Compiler.DebugStub {
// DS is now marked not to re-enter, so re-enable interrupts if
// they were enabled on entry
Memory["InterruptsEnabledFlag", 32].Compare(0);
InterruptsEnabledFlag.Value.Compare(0);
JumpIf(Flags.Equal, "DebugStub_NoSTI");
EnableInterrupts();
// Call secondary debug stub
Label = "DebugStub_NoSTI";
PushAll();
Memory["DebugPushAllPtr", 32] = ESP;
DebugPushAllPtr.Value = ESP;
// We just pushed all registers to the stack so we can use them
// So we get the stack pointer and add 32. This skips over the
// registers we just pushed.
@ -971,7 +971,7 @@ namespace Cosmos.Compiler.DebugStub {
Label = "DebugStub_CheckIntAndReturn";
// Re-enable interrupts if needed. This happens on normal exit, or call from above
// when there would have been a re-entry to DS.
Memory["InterruptsEnabledFlag", 32].Compare(0);
InterruptsEnabledFlag.Value.Compare(0);
JumpIf(Flags.Equal, "DebugStub_Return");
EnableInterrupts();

View file

@ -91,7 +91,7 @@ namespace Cosmos.Core.Plugs.Assemblers {
for (int j = 0; j < 256; j++) {
new CPUAll.Label("__ISR_Handler_" + j.ToString("X2"));
new CPUx86.Call { DestinationLabel = "__INTERRUPT_OCCURRED__" };
new CPUx86.Move { DestinationRef = CPUAll.ElementReference.New("InterruptsEnabledFlag"), DestinationIsIndirect = true, SourceValue = 0, Size = 32 };
new CPUx86.Move { DestinationRef = CPUAll.ElementReference.New("DebugStub_InterruptsEnabledFlag"), DestinationIsIndirect = true, SourceValue = 0, Size = 32 };
if (Array.IndexOf(xInterruptsWithParam, j) == -1) {
new CPUx86.Push { DestinationValue = 0 };
}
@ -129,7 +129,7 @@ namespace Cosmos.Core.Plugs.Assemblers {
new CPUx86.Add { DestinationReg = CPUx86.Registers.ESP, SourceValue = 8 };
new CPUAll.Label("__ISR_Handler_" + j.ToString("X2") + "_END");
new CPUx86.Move { DestinationRef = CPUAll.ElementReference.New("InterruptsEnabledFlag"), DestinationIsIndirect = true, SourceValue = 1, Size = 32 };
new CPUx86.Move { DestinationRef = CPUAll.ElementReference.New("DebugStub_InterruptsEnabledFlag"), DestinationIsIndirect = true, SourceValue = 1, Size = 32 };
new CPUx86.IRET();
}
new CPUAll.Label("__INTERRUPT_OCCURRED__");
@ -142,7 +142,7 @@ namespace Cosmos.Core.Plugs.Assemblers {
// Reenable interrupts
new CPUx86.Sti();
new CPUx86.Move { DestinationRef = CPUAll.ElementReference.New("InterruptsEnabledFlag"), DestinationIsIndirect = true, SourceValue = 1, Size = 32 };
new CPUx86.Move { DestinationRef = CPUAll.ElementReference.New("DebugStub_InterruptsEnabledFlag"), DestinationIsIndirect = true, SourceValue = 1, Size = 32 };
new CPUAll.Label(".__AFTER_ENABLE_INTERRUPTS");
}