/* Returns currently detected breakpoint value based on the register DR6 B0-B3 field. If no breakpoint is detected then it returns 0. */
UINTN GetBreakpointDetected(IN EFI_SYSTEM_CONTEXT SystemContext)
/* Returns currently detected breakpoint value based on the register DR6 B0-B3 field. If no breakpoint is detected then it returns 0. */
UINTN GetBreakpointDetected(IN EFI_SYSTEM_CONTEXT SystemContext)
{
  IA32_DR6  Dr6;
  UINTN     BreakpointNumber;
  Dr6.UintN = SystemContext.SystemContextIa32->Dr6;
  if (Dr6.Bits.B0 == 1) {
    BreakpointNumber = 1;
  } else if (Dr6.Bits.B1 == 1) {
    BreakpointNumber = 2;
  } else if (Dr6.Bits.B2 == 1) {
    BreakpointNumber = 3;
  } else if (Dr6.Bits.B3 == 1) {
    BreakpointNumber = 4;
  } else {
    BreakpointNumber = 0;
  }
  return BreakpointNumber;
}