mirror of https://github.com/acidanthera/audk.git
SourceLevelDebugPkg/DebugAgent: Clear/Restore EFLAGS.IF
Clear EFLAGS.IF before executing Stepping command and save original value in DEBUG_AGENT_FLAG. It could avoid pending interrupt issued during executing Stepping command. Restore EFLAGS.IF after Stepping command execution finished. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17204 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
5d51ba2631
commit
994140183f
|
@ -785,7 +785,7 @@ CommandGo (
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Exectue Stepping command.
|
Execute Stepping command.
|
||||||
|
|
||||||
@param[in] CpuContext Pointer to saved CPU context.
|
@param[in] CpuContext Pointer to saved CPU context.
|
||||||
|
|
||||||
|
@ -800,6 +800,39 @@ CommandStepping (
|
||||||
Eflags = (IA32_EFLAGS32 *) &CpuContext->Eflags;
|
Eflags = (IA32_EFLAGS32 *) &CpuContext->Eflags;
|
||||||
Eflags->Bits.TF = 1;
|
Eflags->Bits.TF = 1;
|
||||||
Eflags->Bits.RF = 1;
|
Eflags->Bits.RF = 1;
|
||||||
|
//
|
||||||
|
// Save and clear EFLAGS.IF to avoid interrupt happen when executing Stepping
|
||||||
|
//
|
||||||
|
SetDebugFlag (DEBUG_AGENT_FLAG_INTERRUPT_FLAG, Eflags->Bits.IF);
|
||||||
|
Eflags->Bits.IF = 0;
|
||||||
|
//
|
||||||
|
// Set Stepping Flag
|
||||||
|
//
|
||||||
|
SetDebugFlag (DEBUG_AGENT_FLAG_STEPPING, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Do some cleanup after Stepping command done.
|
||||||
|
|
||||||
|
@param[in] CpuContext Pointer to saved CPU context.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
CommandSteppingCleanup (
|
||||||
|
IN DEBUG_CPU_CONTEXT *CpuContext
|
||||||
|
)
|
||||||
|
{
|
||||||
|
IA32_EFLAGS32 *Eflags;
|
||||||
|
|
||||||
|
Eflags = (IA32_EFLAGS32 *) &CpuContext->Eflags;
|
||||||
|
//
|
||||||
|
// Restore EFLAGS.IF
|
||||||
|
//
|
||||||
|
Eflags->Bits.IF = GetDebugFlag (DEBUG_AGENT_FLAG_INTERRUPT_FLAG);
|
||||||
|
//
|
||||||
|
// Clear Stepping flag
|
||||||
|
//
|
||||||
|
SetDebugFlag (DEBUG_AGENT_FLAG_STEPPING, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2066,10 +2099,6 @@ CommandCommunication (
|
||||||
}
|
}
|
||||||
|
|
||||||
mDebugMpContext.BreakAtCpuIndex = (UINT32) (-1);
|
mDebugMpContext.BreakAtCpuIndex = (UINT32) (-1);
|
||||||
//
|
|
||||||
// Set Stepping Flag
|
|
||||||
//
|
|
||||||
SetDebugFlag (DEBUG_AGENT_FLAG_STEPPING, 1);
|
|
||||||
ReleaseMpSpinLock (&mDebugMpContext.DebugPortSpinLock);
|
ReleaseMpSpinLock (&mDebugMpContext.DebugPortSpinLock);
|
||||||
//
|
//
|
||||||
// Executing stepping command directly without sending ACK packet,
|
// Executing stepping command directly without sending ACK packet,
|
||||||
|
@ -2405,11 +2434,11 @@ InterruptProcess (
|
||||||
if (MultiProcessorDebugSupport()) {
|
if (MultiProcessorDebugSupport()) {
|
||||||
mDebugMpContext.BreakAtCpuIndex = ProcessorIndex;
|
mDebugMpContext.BreakAtCpuIndex = ProcessorIndex;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// Clear Stepping Flag and restore EFLAGS.IF
|
||||||
|
//
|
||||||
|
CommandSteppingCleanup (CpuContext);
|
||||||
SendAckPacket (DEBUG_COMMAND_OK);
|
SendAckPacket (DEBUG_COMMAND_OK);
|
||||||
//
|
|
||||||
// Clear Stepping Flag
|
|
||||||
//
|
|
||||||
SetDebugFlag (DEBUG_AGENT_FLAG_STEPPING, 0);
|
|
||||||
CommandCommunication (Vector, CpuContext, BreakReceived);
|
CommandCommunication (Vector, CpuContext, BreakReceived);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2582,6 +2611,10 @@ InterruptProcess (
|
||||||
if (MultiProcessorDebugSupport()) {
|
if (MultiProcessorDebugSupport()) {
|
||||||
mDebugMpContext.BreakAtCpuIndex = ProcessorIndex;
|
mDebugMpContext.BreakAtCpuIndex = ProcessorIndex;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// Clear Stepping flag and restore EFLAGS.IF
|
||||||
|
//
|
||||||
|
CommandSteppingCleanup (CpuContext);
|
||||||
SendAckPacket (DEBUG_COMMAND_OK);
|
SendAckPacket (DEBUG_COMMAND_OK);
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue