ReactOS  0.4.15-dev-1618-g9c8ed68
kd64.h File Reference

Go to the source code of this file.

Classes

struct  _BREAKPOINT_ENTRY
 

Macros

#define KD_DEFAULT_LOG_BUFFER_SIZE   0x1000
 
#define KD_BREAKPOINT_MAX   32
 
#define KD_HIGHEST_USER_BREAKPOINT_ADDRESS   (PVOID)0x60000000
 
#define KD_BREAKPOINT_ACTIVE   0x01
 
#define KD_BREAKPOINT_PENDING   0x02
 
#define KD_BREAKPOINT_SUSPENDED   0x04
 
#define KD_BREAKPOINT_EXPIRED   0x08
 
#define MAX_KD_COMPONENT_TABLE_ENTRIES   (DPFLTR_ENDOFTABLE_ID + 1)
 

Typedefs

typedef struct _BREAKPOINT_ENTRY BREAKPOINT_ENTRY
 
typedef struct _BREAKPOINT_ENTRYPBREAKPOINT_ENTRY
 
typedef BOOLEAN(NTAPIPKDEBUG_ROUTINE) (IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame, IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT Context, IN KPROCESSOR_MODE PreviousMode, IN BOOLEAN SecondChance)
 
typedef BOOLEAN(NTAPIPKDEBUG_SWITCH_ROUTINE) (IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT Context, IN BOOLEAN SecondChance)
 

Functions

BOOLEAN NTAPI KdInitSystem (ULONG Reserved, PLOADER_PARAMETER_BLOCK LoaderBlock)
 
VOID NTAPI KdUpdateDataBlock (VOID)
 
BOOLEAN NTAPI KdIsThisAKdTrap (IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT Context, IN KPROCESSOR_MODE PreviousMode)
 
BOOLEAN NTAPI KdpSwitchProcessor (IN PEXCEPTION_RECORD ExceptionRecord, IN OUT PCONTEXT ContextRecord, IN BOOLEAN SecondChanceException)
 
VOID NTAPI KdpTimeSlipWork (IN PVOID Context)
 
VOID NTAPI KdpTimeSlipDpcRoutine (IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
 
BOOLEAN NTAPI KdpStub (IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame, IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT ContextRecord, IN KPROCESSOR_MODE PreviousMode, IN BOOLEAN SecondChanceException)
 
BOOLEAN NTAPI KdpTrap (IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame, IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT ContextRecord, IN KPROCESSOR_MODE PreviousMode, IN BOOLEAN SecondChanceException)
 
VOID NTAPI KdpPortLock (VOID)
 
VOID NTAPI KdpPortUnlock (VOID)
 
BOOLEAN NTAPI KdpPollBreakInWithPortLock (VOID)
 
BOOLEAN NTAPI KdEnterDebugger (IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame)
 
VOID NTAPI KdExitDebugger (IN BOOLEAN Enable)
 
NTSTATUS NTAPI KdEnableDebuggerWithLock (IN BOOLEAN NeedLock)
 
NTSTATUS NTAPI KdDisableDebuggerWithLock (IN BOOLEAN NeedLock)
 
NTSTATUS NTAPI KdpPrint (_In_ ULONG ComponentId, _In_ ULONG Level, _In_reads_bytes_(Length) PCHAR String, _In_ USHORT Length, _In_ KPROCESSOR_MODE PreviousMode, _In_ PKTRAP_FRAME TrapFrame, _In_ PKEXCEPTION_FRAME ExceptionFrame, _Out_ PBOOLEAN Handled)
 
USHORT NTAPI KdpPrompt (_In_reads_bytes_(PromptLength) PCHAR PromptString, _In_ USHORT PromptLength, _Out_writes_bytes_(MaximumResponseLength) PCHAR ResponseString, _In_ USHORT MaximumResponseLength, _In_ KPROCESSOR_MODE PreviousMode, _In_ PKTRAP_FRAME TrapFrame, _In_ PKEXCEPTION_FRAME ExceptionFrame)
 
VOID NTAPI KdpSymbol (IN PSTRING DllPath, IN PKD_SYMBOLS_INFO SymbolInfo, IN BOOLEAN Unload, IN KPROCESSOR_MODE PreviousMode, IN PCONTEXT ContextRecord, IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame)
 
VOID NTAPI KdpCommandString (IN PSTRING NameString, IN PSTRING CommandString, IN KPROCESSOR_MODE PreviousMode, IN PCONTEXT ContextRecord, IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame)
 
VOID NTAPI KdpReportLoadSymbolsStateChange (IN PSTRING PathName, IN PKD_SYMBOLS_INFO SymbolInfo, IN BOOLEAN Unload, IN OUT PCONTEXT Context)
 
VOID NTAPI KdpReportCommandStringStateChange (IN PSTRING NameString, IN PSTRING CommandString, IN OUT PCONTEXT Context)
 
BOOLEAN NTAPI KdpReportExceptionStateChange (IN PEXCEPTION_RECORD ExceptionRecord, IN OUT PCONTEXT Context, IN BOOLEAN SecondChanceException)
 
ULONG NTAPI KdpAddBreakpoint (IN PVOID Address)
 
VOID NTAPI KdSetOwedBreakpoints (VOID)
 
BOOLEAN NTAPI KdpDeleteBreakpoint (IN ULONG BpEntry)
 
BOOLEAN NTAPI KdpDeleteBreakpointRange (IN PVOID Base, IN PVOID Limit)
 
VOID NTAPI KdpSuspendBreakPoint (IN ULONG BpEntry)
 
VOID NTAPI KdpRestoreAllBreakpoints (VOID)
 
VOID NTAPI KdpSuspendAllBreakPoints (VOID)
 
NTSTATUS NTAPI KdpAllowDisable (VOID)
 
NTSTATUS NTAPI KdpCopyMemoryChunks (_In_ ULONG64 Address, _In_ PVOID Buffer, _In_ ULONG TotalSize, _In_ ULONG ChunkSize, _In_ ULONG Flags, _Out_opt_ PULONG ActualSize)
 
VOID NTAPI KdpMoveMemory (_In_ PVOID Destination, _In_ PVOID Source, _In_ SIZE_T Length)
 
VOID NTAPI KdpZeroMemory (_In_ PVOID Destination, _In_ SIZE_T Length)
 
VOID NTAPI KdpSysGetVersion (IN PDBGKD_GET_VERSION64 Version)
 
VOID NTAPI KdpGetStateChange (IN PDBGKD_MANIPULATE_STATE64 State, IN PCONTEXT Context)
 
VOID NTAPI KdpSetContextState (IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange, IN PCONTEXT Context)
 
NTSTATUS NTAPI KdpSysReadMsr (IN ULONG Msr, OUT PLARGE_INTEGER MsrValue)
 
NTSTATUS NTAPI KdpSysWriteMsr (IN ULONG Msr, IN PLARGE_INTEGER MsrValue)
 
NTSTATUS NTAPI KdpSysReadBusData (IN ULONG BusDataType, IN ULONG BusNumber, IN ULONG SlotNumber, IN ULONG Offset, IN PVOID Buffer, IN ULONG Length, OUT PULONG ActualLength)
 
NTSTATUS NTAPI KdpSysWriteBusData (IN ULONG BusDataType, IN ULONG BusNumber, IN ULONG SlotNumber, IN ULONG Offset, IN PVOID Buffer, IN ULONG Length, OUT PULONG ActualLength)
 
NTSTATUS NTAPI KdpSysReadControlSpace (IN ULONG Processor, IN ULONG64 BaseAddress, IN PVOID Buffer, IN ULONG Length, OUT PULONG ActualLength)
 
NTSTATUS NTAPI KdpSysWriteControlSpace (IN ULONG Processor, IN ULONG64 BaseAddress, IN PVOID Buffer, IN ULONG Length, OUT PULONG ActualLength)
 
NTSTATUS NTAPI KdpSysReadIoSpace (IN ULONG InterfaceType, IN ULONG BusNumber, IN ULONG AddressSpace, IN ULONG64 IoAddress, IN PVOID DataValue, IN ULONG DataSize, OUT PULONG ActualDataSize)
 
NTSTATUS NTAPI KdpSysWriteIoSpace (IN ULONG InterfaceType, IN ULONG BusNumber, IN ULONG AddressSpace, IN ULONG64 IoAddress, IN PVOID DataValue, IN ULONG DataSize, OUT PULONG ActualDataSize)
 
NTSTATUS NTAPI KdpSysCheckLowMemory (IN ULONG Flags)
 
VOID __cdecl KdpDprintf (_In_ PCHAR Format,...)
 

Variables

DBGKD_GET_VERSION64 KdVersionBlock
 
KDDEBUGGER_DATA64 KdDebuggerDataBlock
 
LIST_ENTRY KdpDebuggerDataListHead
 
KSPIN_LOCK KdpDataSpinLock
 
LARGE_INTEGER KdPerformanceCounterRate
 
LARGE_INTEGER KdTimerStart
 
ULONG KdDisableCount
 
KD_CONTEXT KdpContext
 
PKDEBUG_ROUTINE KiDebugRoutine
 
PKDEBUG_SWITCH_ROUTINE KiDebugSwitchRoutine
 
BOOLEAN KdBreakAfterSymbolLoad
 
BOOLEAN KdPitchDebugger
 
BOOLEAN KdAutoEnableOnEvent
 
BOOLEAN KdBlockEnable
 
BOOLEAN KdIgnoreUmExceptions
 
BOOLEAN KdPreviouslyEnabled
 
BOOLEAN KdpDebuggerStructuresInitialized
 
BOOLEAN KdEnteredDebugger
 
KDPC KdpTimeSlipDpc
 
KTIMER KdpTimeSlipTimer
 
WORK_QUEUE_ITEM KdpTimeSlipWorkItem
 
LONG KdpTimeSlipPending
 
PKEVENT KdpTimeSlipEvent
 
KSPIN_LOCK KdpTimeSlipEventLock
 
BOOLEAN KdpPortLocked
 
BOOLEAN KdpControlCPressed
 
BOOLEAN KdpContextSent
 
KSPIN_LOCK KdpDebuggerLock
 
LARGE_INTEGER KdTimerStop
 
LARGE_INTEGER KdTimerDifference
 
CHAR KdpMessageBuffer [0x1000]
 
CHAR KdpPathBuffer [0x1000]
 
CHAR KdPrintDefaultCircularBuffer [KD_DEFAULT_LOG_BUFFER_SIZE]
 
BREAKPOINT_ENTRY KdpBreakpointTable [KD_BREAKPOINT_MAX]
 
KD_BREAKPOINT_TYPE KdpBreakpointInstruction
 
BOOLEAN KdpOweBreakpoint
 
BOOLEAN BreakpointsSuspended
 
ULONG KdpNumInternalBreakpoints
 
ULONG_PTR KdpCurrentSymbolStart
 
ULONG_PTR KdpCurrentSymbolEnd
 
ULONG TraceDataBuffer [40]
 
ULONG TraceDataBufferPosition
 
ULONG KdComponentTableSize
 
PULONG KdComponentTable [MAX_KD_COMPONENT_TABLE_ENTRIES]
 
ULONG Kd_WIN2000_Mask
 
ULONG Kd_SYSTEM_Mask
 
ULONG Kd_SMSS_Mask
 
ULONG Kd_SETUP_Mask
 
ULONG Kd_NTFS_Mask
 
ULONG Kd_FSTUB_Mask
 
ULONG Kd_CRASHDUMP_Mask
 
ULONG Kd_CDAUDIO_Mask
 
ULONG Kd_CDROM_Mask
 
ULONG Kd_CLASSPNP_Mask
 
ULONG Kd_DISK_Mask
 
ULONG Kd_REDBOOK_Mask
 
ULONG Kd_STORPROP_Mask
 
ULONG Kd_SCSIPORT_Mask
 
ULONG Kd_SCSIMINIPORT_Mask
 
ULONG Kd_CONFIG_Mask
 
ULONG Kd_I8042PRT_Mask
 
ULONG Kd_SERMOUSE_Mask
 
ULONG Kd_LSERMOUS_Mask
 
ULONG Kd_KBDHID_Mask
 
ULONG Kd_MOUHID_Mask
 
ULONG Kd_KBDCLASS_Mask
 
ULONG Kd_MOUCLASS_Mask
 
ULONG Kd_TWOTRACK_Mask
 
ULONG Kd_WMILIB_Mask
 
ULONG Kd_ACPI_Mask
 
ULONG Kd_AMLI_Mask
 
ULONG Kd_HALIA64_Mask
 
ULONG Kd_VIDEO_Mask
 
ULONG Kd_SVCHOST_Mask
 
ULONG Kd_VIDEOPRT_Mask
 
ULONG Kd_TCPIP_Mask
 
ULONG Kd_DMSYNTH_Mask
 
ULONG Kd_NTOSPNP_Mask
 
ULONG Kd_FASTFAT_Mask
 
ULONG Kd_SAMSS_Mask
 
ULONG Kd_PNPMGR_Mask
 
ULONG Kd_NETAPI_Mask
 
ULONG Kd_SCSERVER_Mask
 
ULONG Kd_SCCLIENT_Mask
 
ULONG Kd_SERIAL_Mask
 
ULONG Kd_SERENUM_Mask
 
ULONG Kd_UHCD_Mask
 
ULONG Kd_RPCPROXY_Mask
 
ULONG Kd_AUTOCHK_Mask
 
ULONG Kd_DCOMSS_Mask
 
ULONG Kd_UNIMODEM_Mask
 
ULONG Kd_SIS_Mask
 
ULONG Kd_FLTMGR_Mask
 
ULONG Kd_WMICORE_Mask
 
ULONG Kd_BURNENG_Mask
 
ULONG Kd_IMAPI_Mask
 
ULONG Kd_SXS_Mask
 
ULONG Kd_FUSION_Mask
 
ULONG Kd_IDLETASK_Mask
 
ULONG Kd_SOFTPCI_Mask
 
ULONG Kd_TAPE_Mask
 
ULONG Kd_MCHGR_Mask
 
ULONG Kd_IDEP_Mask
 
ULONG Kd_PCIIDE_Mask
 
ULONG Kd_FLOPPY_Mask
 
ULONG Kd_FDC_Mask
 
ULONG Kd_TERMSRV_Mask
 
ULONG Kd_W32TIME_Mask
 
ULONG Kd_PREFETCHER_Mask
 
ULONG Kd_RSFILTER_Mask
 
ULONG Kd_FCPORT_Mask
 
ULONG Kd_PCI_Mask
 
ULONG Kd_DMIO_Mask
 
ULONG Kd_DMCONFIG_Mask
 
ULONG Kd_DMADMIN_Mask
 
ULONG Kd_WSOCKTRANSPORT_Mask
 
ULONG Kd_VSS_Mask
 
ULONG Kd_PNPMEM_Mask
 
ULONG Kd_PROCESSOR_Mask
 
ULONG Kd_DMSERVER_Mask
 
ULONG Kd_SR_Mask
 
ULONG Kd_INFINIBAND_Mask
 
ULONG Kd_IHVDRIVER_Mask
 
ULONG Kd_IHVVIDEO_Mask
 
ULONG Kd_IHVAUDIO_Mask
 
ULONG Kd_IHVNETWORK_Mask
 
ULONG Kd_IHVSTREAMING_Mask
 
ULONG Kd_IHVBUS_Mask
 
ULONG Kd_HPS_Mask
 
ULONG Kd_RTLTHREADPOOL_Mask
 
ULONG Kd_LDR_Mask
 
ULONG Kd_TCPIP6_Mask
 
ULONG Kd_ISAPNP_Mask
 
ULONG Kd_SHPC_Mask
 
ULONG Kd_STORPORT_Mask
 
ULONG Kd_STORMINIPORT_Mask
 
ULONG Kd_PRINTSPOOLER_Mask
 
ULONG Kd_VSSDYNDISK_Mask
 
ULONG Kd_VERIFIER_Mask
 
ULONG Kd_VDS_Mask
 
ULONG Kd_VDSBAS_Mask
 
ULONG Kd_VDSDYN_Mask
 
ULONG Kd_VDSDYNDR_Mask
 
ULONG Kd_VDSLDR_Mask
 
ULONG Kd_VDSUTIL_Mask
 
ULONG Kd_DFRGIFC_Mask
 
ULONG Kd_DEFAULT_Mask
 
ULONG Kd_MM_Mask
 
ULONG Kd_DFSC_Mask
 
ULONG Kd_WOW64_Mask
 
ULONG Kd_ALPC_Mask
 
ULONG Kd_WDI_Mask
 
ULONG Kd_PERFLIB_Mask
 
ULONG Kd_KTM_Mask
 
ULONG Kd_IOSTRESS_Mask
 
ULONG Kd_HEAP_Mask
 
ULONG Kd_WHEA_Mask
 
ULONG Kd_USERGDI_Mask
 
ULONG Kd_MMCSS_Mask
 
ULONG Kd_TPM_Mask
 
ULONG Kd_THREADORDER_Mask
 
ULONG Kd_ENVIRON_Mask
 
ULONG Kd_EMS_Mask
 
ULONG Kd_WDT_Mask
 
ULONG Kd_FVEVOL_Mask
 
ULONG Kd_NDIS_Mask
 
ULONG Kd_NVCTRACE_Mask
 
ULONG Kd_LUAFV_Mask
 
ULONG Kd_APPCOMPAT_Mask
 
ULONG Kd_USBSTOR_Mask
 
ULONG Kd_SBP2PORT_Mask
 
ULONG Kd_COVERAGE_Mask
 
ULONG Kd_CACHEMGR_Mask
 
ULONG Kd_MOUNTMGR_Mask
 
ULONG Kd_CFR_Mask
 
ULONG Kd_TXF_Mask
 
ULONG Kd_KSECDD_Mask
 
ULONG Kd_FLTREGRESS_Mask
 
ULONG Kd_MPIO_Mask
 
ULONG Kd_MSDSM_Mask
 
ULONG Kd_UDFS_Mask
 
ULONG Kd_PSHED_Mask
 
ULONG Kd_STORVSP_Mask
 
ULONG Kd_LSASS_Mask
 
ULONG Kd_SSPICLI_Mask
 
ULONG Kd_CNG_Mask
 
ULONG Kd_EXFAT_Mask
 
ULONG Kd_FILETRACE_Mask
 
ULONG Kd_XSAVE_Mask
 
ULONG Kd_SE_Mask
 
ULONG Kd_DRIVEEXTENDER_Mask
 
ULONG Kd_POWER_Mask
 
ULONG Kd_CRASHDUMPXHCI_Mask
 
ULONG Kd_GPIO_Mask
 
ULONG Kd_REFS_Mask
 
ULONG Kd_WER_Mask
 
ULONG Kd_CAPIMG_Mask
 
ULONG Kd_VPCI_Mask
 
ULONG Kd_STORAGECLASSMEMORY_Mask
 
ULONG Kd_FSLIB_Mask
 

Macro Definition Documentation

◆ KD_BREAKPOINT_ACTIVE

#define KD_BREAKPOINT_ACTIVE   0x01

Definition at line 40 of file kd64.h.

◆ KD_BREAKPOINT_EXPIRED

#define KD_BREAKPOINT_EXPIRED   0x08

Definition at line 43 of file kd64.h.

◆ KD_BREAKPOINT_MAX

#define KD_BREAKPOINT_MAX   32

Definition at line 23 of file kd64.h.

◆ KD_BREAKPOINT_PENDING

#define KD_BREAKPOINT_PENDING   0x02

Definition at line 41 of file kd64.h.

◆ KD_BREAKPOINT_SUSPENDED

#define KD_BREAKPOINT_SUSPENDED   0x04

Definition at line 42 of file kd64.h.

◆ KD_DEFAULT_LOG_BUFFER_SIZE

#define KD_DEFAULT_LOG_BUFFER_SIZE   0x1000

Definition at line 17 of file kd64.h.

◆ KD_HIGHEST_USER_BREAKPOINT_ADDRESS

#define KD_HIGHEST_USER_BREAKPOINT_ADDRESS   (PVOID)0x60000000

Definition at line 35 of file kd64.h.

◆ MAX_KD_COMPONENT_TABLE_ENTRIES

#define MAX_KD_COMPONENT_TABLE_ENTRIES   (DPFLTR_ENDOFTABLE_ID + 1)

Definition at line 564 of file kd64.h.

Typedef Documentation

◆ BREAKPOINT_ENTRY

◆ PBREAKPOINT_ENTRY

◆ PKDEBUG_ROUTINE

typedef BOOLEAN(NTAPI * PKDEBUG_ROUTINE) (IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame, IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT Context, IN KPROCESSOR_MODE PreviousMode, IN BOOLEAN SecondChance)

Definition at line 61 of file kd64.h.

◆ PKDEBUG_SWITCH_ROUTINE

typedef BOOLEAN(NTAPI * PKDEBUG_SWITCH_ROUTINE) (IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT Context, IN BOOLEAN SecondChance)

Definition at line 72 of file kd64.h.

Function Documentation

◆ KdDisableDebuggerWithLock()

NTSTATUS NTAPI KdDisableDebuggerWithLock ( IN BOOLEAN  NeedLock)

Definition at line 2035 of file kdapi.c.

2036 {
2037  KIRQL OldIrql;
2038  NTSTATUS Status;
2039 
2040 #if defined(__GNUC__)
2041  /* Make gcc happy */
2043 #endif
2044 
2045  /*
2046  * If enabling the debugger is blocked
2047  * then there is nothing to disable (duh)
2048  */
2049  if (KdBlockEnable)
2050  {
2051  /* Fail */
2052  return STATUS_ACCESS_DENIED;
2053  }
2054 
2055  /* Check if we need to acquire the lock */
2056  if (NeedLock)
2057  {
2058  /* Lock the port */
2060  KdpPortLock();
2061  }
2062 
2063  /* Check if we're not disabled */
2064  if (!KdDisableCount)
2065  {
2066  /* Check if the debugger was never actually initialized */
2067  if (!(KdDebuggerEnabled) && !(KdPitchDebugger))
2068  {
2069  /* It wasn't, so don't re-enable it later */
2071  }
2072  else
2073  {
2074  /* It was, so we will re-enable it later */
2076  }
2077 
2078  /* Check if we were called from the exported API and are enabled */
2079  if ((NeedLock) && (KdPreviouslyEnabled))
2080  {
2081  /* Check if it is safe to disable the debugger */
2082  Status = KdpAllowDisable();
2083  if (!NT_SUCCESS(Status))
2084  {
2085  /* Release the lock and fail */
2087  KdpPortUnlock();
2088  return Status;
2089  }
2090  }
2091 
2092  /* Only disable the debugger if it is enabled */
2093  if (KdDebuggerEnabled)
2094  {
2095  /*
2096  * Disable the debugger; suspend breakpoints
2097  * and reset the debug stub
2098  */
2101 
2102  /* We are disabled now */
2104  SharedUserData->KdDebuggerEnabled = FALSE;
2105  }
2106  }
2107 
2108  /* Increment the disable count */
2109  KdDisableCount++;
2110 
2111  /* Check if we had locked the port before */
2112  if (NeedLock)
2113  {
2114  /* Yes, now unlock it */
2116  KdpPortUnlock();
2117  }
2118 
2119  /* We're done */
2120  return STATUS_SUCCESS;
2121 }
BOOLEAN KdDebuggerEnabled
Definition: kddata.c:83
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
PKDEBUG_ROUTINE KiDebugRoutine
Definition: kddata.c:74
#define TRUE
Definition: types.h:120
BOOLEAN NTAPI KdpStub(IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame, IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT ContextRecord, IN KPROCESSOR_MODE PreviousMode, IN BOOLEAN SecondChanceException)
Definition: kdtrap.c:266
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN KdPreviouslyEnabled
Definition: kddata.c:87
BOOLEAN KdPitchDebugger
Definition: kddata.c:81
BOOLEAN KdBlockEnable
Definition: kddata.c:85
NTSTATUS NTAPI KdpAllowDisable(VOID)
Definition: kdx64.c:364
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define FALSE
Definition: types.h:117
VOID NTAPI KdpPortUnlock(VOID)
Definition: kdlock.c:27
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
VOID NTAPI KdpSuspendAllBreakPoints(VOID)
Definition: kdbreak.c:407
#define SharedUserData
ULONG KdDisableCount
Definition: kddata.c:90
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
VOID NTAPI KdpPortLock(VOID)
Definition: kdlock.c:19
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by KdDisableDebugger(), and KdInitSystem().

◆ KdEnableDebuggerWithLock()

NTSTATUS NTAPI KdEnableDebuggerWithLock ( IN BOOLEAN  NeedLock)

Definition at line 1959 of file kdapi.c.

1960 {
1961  KIRQL OldIrql;
1962 
1963 #if defined(__GNUC__)
1964  /* Make gcc happy */
1966 #endif
1967 
1968  /* Check if enabling the debugger is blocked */
1969  if (KdBlockEnable)
1970  {
1971  /* It is, fail the enable */
1972  return STATUS_ACCESS_DENIED;
1973  }
1974 
1975  /* Check if we need to acquire the lock */
1976  if (NeedLock)
1977  {
1978  /* Lock the port */
1980  KdpPortLock();
1981  }
1982 
1983  /* Check if we're not disabled */
1984  if (!KdDisableCount)
1985  {
1986  /* Check if we had locked the port before */
1987  if (NeedLock)
1988  {
1989  /* Do the unlock */
1991  KdpPortUnlock();
1992 
1993  /* Fail: We're already enabled */
1994  return STATUS_INVALID_PARAMETER;
1995  }
1996  else
1997  {
1998  /*
1999  * This can only happen if we are called from a bugcheck
2000  * and were never initialized, so initialize the debugger now.
2001  */
2002  KdInitSystem(0, NULL);
2003 
2004  /* Return success since we initialized */
2005  return STATUS_SUCCESS;
2006  }
2007  }
2008 
2009  /* Decrease the disable count */
2010  if (!(--KdDisableCount))
2011  {
2012  /* We're now enabled again! Were we enabled before, too? */
2013  if (KdPreviouslyEnabled)
2014  {
2015  /* Reinitialize the Debugger */
2016  KdInitSystem(0, NULL);
2018  }
2019  }
2020 
2021  /* Check if we had locked the port before */
2022  if (NeedLock)
2023  {
2024  /* Yes, now unlock it */
2026  KdpPortUnlock();
2027  }
2028 
2029  /* We're done */
2030  return STATUS_SUCCESS;
2031 }
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
BOOLEAN KdPreviouslyEnabled
Definition: kddata.c:87
BOOLEAN KdBlockEnable
Definition: kddata.c:85
UCHAR KIRQL
Definition: env_spec_w32.h:591
VOID NTAPI KdpPortUnlock(VOID)
Definition: kdlock.c:27
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
ULONG KdDisableCount
Definition: kddata.c:90
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
BOOLEAN NTAPI KdInitSystem(ULONG Reserved, PLOADER_PARAMETER_BLOCK LoaderBlock)
#define NULL
Definition: types.h:112
VOID NTAPI KdpPortLock(VOID)
Definition: kdlock.c:19
#define STATUS_SUCCESS
Definition: shellext.h:65
VOID NTAPI KdpRestoreAllBreakpoints(VOID)
Definition: kdbreak.c:368

Referenced by KdEnableDebugger(), and KeBugCheckWithTf().

◆ KdEnterDebugger()

BOOLEAN NTAPI KdEnterDebugger ( IN PKTRAP_FRAME  TrapFrame,
IN PKEXCEPTION_FRAME  ExceptionFrame 
)

Definition at line 1871 of file kdapi.c.

1873 {
1874  BOOLEAN Enable;
1875 
1876  /* Check if we have a trap frame */
1877  if (TrapFrame)
1878  {
1879  /* Calculate the time difference for the enter */
1883  }
1884  else
1885  {
1886  /* No trap frame, so can't calculate */
1887  KdTimerStop.QuadPart = 0;
1888  }
1889 
1890  /* Save the current IRQL */
1891  KeGetCurrentPrcb()->DebuggerSavedIRQL = KeGetCurrentIrql();
1892 
1893  /* Freeze all CPUs */
1894  Enable = KeFreezeExecution(TrapFrame, ExceptionFrame);
1895 
1896  /* Lock the port, save the state and set debugger entered */
1898  KdSave(FALSE);
1900 
1901  /* Check freeze flag */
1902  if (KiFreezeFlag & 1)
1903  {
1904  /* Print out errror */
1905  KdpDprintf("FreezeLock was jammed! Backup SpinLock was used!\n");
1906  }
1907 
1908  /* Check processor state */
1909  if (KiFreezeFlag & 2)
1910  {
1911  /* Print out errror */
1912  KdpDprintf("Some processors not frozen in debugger!\n");
1913  }
1914 
1915  /* Make sure we acquired the port */
1916  if (!KdpPortLocked) KdpDprintf("Port lock was not acquired!\n");
1917 
1918  /* Return if interrupts needs to be re-enabled */
1919  return Enable;
1920 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define TRUE
Definition: types.h:120
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1075
KSPIN_LOCK KdpDebuggerLock
Definition: kddata.c:67
LARGE_INTEGER KdTimerDifference
Definition: kddata.c:122
LARGE_INTEGER KdTimerStart
Definition: kd64.h:548
LARGE_INTEGER NTAPI KdpQueryPerformanceCounter(IN PKTRAP_FRAME TrapFrame)
Definition: kdapi.c:1854
#define FALSE
Definition: types.h:117
BOOLEAN KdEnteredDebugger
Definition: kddata.c:89
BOOLEAN NTAPI KeFreezeExecution(IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame)
Definition: freeze.c:26
unsigned char BOOLEAN
ULONG KiFreezeFlag
Definition: cpu.c:38
LARGE_INTEGER KdTimerStop
Definition: kddata.c:122
BOOLEAN KdpPortLocked
Definition: kddata.c:66
NTSTATUS NTAPI KdSave(IN BOOLEAN SleepTransition)
Definition: kdcom.c:113
BOOLEAN FASTCALL KeTryToAcquireSpinLockAtDpcLevel(IN OUT PKSPIN_LOCK SpinLock)
Definition: spinlock.c:303
#define KdpDprintf(...)
Definition: mmdbg.c:19
LONGLONG QuadPart
Definition: typedefs.h:114

Referenced by KdpCommandString(), KdpPrint(), KdpPrompt(), KdpReport(), KdpSymbol(), KdRefreshDebuggerNotPresent(), and KdSetOwedBreakpoints().

◆ KdExitDebugger()

VOID NTAPI KdExitDebugger ( IN BOOLEAN  Enable)

Definition at line 1924 of file kdapi.c.

1925 {
1926  ULONG TimeSlip;
1927 
1928  /* Restore the state and unlock the port */
1929  KdRestore(FALSE);
1931 
1932  /* Unfreeze the CPUs */
1934 
1935  /* Compare time with the one from KdEnterDebugger */
1936  if (!KdTimerStop.QuadPart)
1937  {
1938  /* We didn't get a trap frame earlier in so never got the time */
1940  }
1941  else
1942  {
1943  /* Query the timer */
1945  }
1946 
1947  /* Check if a Time Slip was on queue */
1949  if (TimeSlip == 1)
1950  {
1951  /* Queue a DPC for the time slip */
1953  KeInsertQueueDpc(&KdpTimeSlipDpc, NULL, NULL); // FIXME: this can trigger context switches!
1954  }
1955 }
LARGE_INTEGER NTAPI KeQueryPerformanceCounter(IN PLARGE_INTEGER PerformanceFreq)
Definition: timer.c:138
VOID NTAPI KeThawExecution(IN BOOLEAN Enable)
Definition: freeze.c:46
BOOLEAN NTAPI KeInsertQueueDpc(IN PKDPC Dpc, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: dpc.c:724
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
NTSTATUS NTAPI KdRestore(IN BOOLEAN SleepTransition)
Definition: kdcom.c:121
LONG KdpTimeSlipPending
Definition: kddata.c:119
LARGE_INTEGER KdTimerStart
Definition: kd64.h:548
#define FALSE
Definition: types.h:117
VOID NTAPI KdpPortUnlock(VOID)
Definition: kdlock.c:27
LARGE_INTEGER KdTimerStop
Definition: kddata.c:122
KDPC KdpTimeSlipDpc
Definition: kddata.c:116
#define InterlockedIncrement
Definition: armddk.h:53
#define NULL
Definition: types.h:112
BOOLEAN KdpPortLocked
Definition: kddata.c:66
unsigned int ULONG
Definition: retypes.h:1
LONGLONG QuadPart
Definition: typedefs.h:114

Referenced by KdpCommandString(), KdpPrint(), KdpPrompt(), KdpReport(), KdpSymbol(), KdRefreshDebuggerNotPresent(), and KdSetOwedBreakpoints().

◆ KdInitSystem()

◆ KdIsThisAKdTrap()

BOOLEAN NTAPI KdIsThisAKdTrap ( IN PEXCEPTION_RECORD  ExceptionRecord,
IN PCONTEXT  Context,
IN KPROCESSOR_MODE  PreviousMode 
)

Definition at line 317 of file kdtrap.c.

320 {
321 #ifdef _WINKD_
322  /*
323  * Determine if this is a valid debug service call and make sure that
324  * it isn't a software breakpoint
325  */
326  if ((ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT) &&
327  (ExceptionRecord->NumberParameters > 0) &&
328  (ExceptionRecord->ExceptionInformation[0] != BREAKPOINT_BREAK))
329  {
330  /* Then we have to handle it */
331  return TRUE;
332  }
333  else
334  {
335  /* We don't have to handle it */
336  return FALSE;
337  }
338 #else
339  /* KDBG has its own mechanism for ignoring user mode exceptions */
340  return FALSE;
341 #endif
342 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define STATUS_BREAKPOINT
Definition: ntstatus.h:184
#define BREAKPOINT_BREAK
Definition: kdtypes.h:50

Referenced by KiDispatchException().

◆ KdpAddBreakpoint()

ULONG NTAPI KdpAddBreakpoint ( IN PVOID  Address)

Definition at line 20 of file kdbreak.c.

21 {
22  KD_BREAKPOINT_TYPE Content;
23  ULONG i;
25 
26  /* Check whether we are not setting a breakpoint twice */
27  for (i = 0; i < KD_BREAKPOINT_MAX; i++)
28  {
29  /* Check if the breakpoint is valid */
32  {
33  /* Were we not able to remove it earlier? */
35  {
36  /* Just re-use it! */
38  return i + 1;
39  }
40  else
41  {
42  /* Fail */
43  return 0;
44  }
45  }
46  }
47 
48  /* Find a free entry */
49  for (i = 0; i < KD_BREAKPOINT_MAX; i++)
50  {
51  if (KdpBreakpointTable[i].Flags == 0)
52  break;
53  }
54 
55  /* Fail if no free entry was found */
56  if (i == KD_BREAKPOINT_MAX) return 0;
57 
58  /* Save the breakpoint */
60 
61  /* If we are setting the breakpoint in user space, save the active process context */
63  KdpBreakpointTable[i].DirectoryTableBase = KeGetCurrentThread()->ApcState.Process->DirectoryTableBase[0];
64 
65  /* Try to save the old instruction */
67  &Content,
69  0,
71  NULL);
72  if (NT_SUCCESS(Status))
73  {
74  /* Memory accessible, set the breakpoint */
75  KdpBreakpointTable[i].Content = Content;
77 
78  /* Write the breakpoint */
82  0,
84  NULL);
85  if (!NT_SUCCESS(Status))
86  {
87  /* This should never happen */
88  KdpDprintf("Unable to write breakpoint to address 0x%p\n", Address);
89  }
90  }
91  else
92  {
93  /* Memory is inaccessible now, setting breakpoint is deferred */
94  KdpDprintf("Failed to set breakpoint at address 0x%p, adding deferred breakpoint.\n", Address);
97  }
98 
99  /* Return the breakpoint handle */
100  return i + 1;
101 }
NTSTATUS NTAPI KdpCopyMemoryChunks(_In_ ULONG64 Address, _In_ PVOID Buffer, _In_ ULONG TotalSize, _In_ ULONG ChunkSize, _In_ ULONG Flags, _Out_opt_ PULONG ActualSize)
Definition: kdapi.c:50
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
uint32_t ULONG_PTR
Definition: typedefs.h:65
ULONG_PTR DirectoryTableBase
Definition: kd64.h:51
BOOLEAN KdpOweBreakpoint
Definition: kddata.c:98
static WCHAR Address[46]
Definition: ping.c:68
#define MMDBG_COPY_WRITE
Definition: mm.h:53
ULONG Flags
Definition: kd64.h:50
Status
Definition: gdiplustypes.h:24
#define KD_BREAKPOINT_PENDING
Definition: kd64.h:41
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define KD_HIGHEST_USER_BREAKPOINT_ADDRESS
Definition: kd64.h:35
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
KD_BREAKPOINT_TYPE Content
Definition: kd64.h:53
KD_BREAKPOINT_TYPE KdpBreakpointInstruction
Definition: kddata.c:97
#define KD_BREAKPOINT_MAX
Definition: kd64.h:23
#define KD_BREAKPOINT_TYPE
Definition: ke.h:117
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define MMDBG_COPY_UNSAFE
Definition: mm.h:55
BREAKPOINT_ENTRY KdpBreakpointTable[KD_BREAKPOINT_MAX]
Definition: kddata.c:96
#define NULL
Definition: types.h:112
PVOID Address
Definition: kd64.h:52
unsigned int ULONG
Definition: retypes.h:1
#define KD_BREAKPOINT_SIZE
Definition: ke.h:118
#define KeGetCurrentThread
Definition: hal.h:44
#define KD_BREAKPOINT_EXPIRED
Definition: kd64.h:43
#define KdpDprintf(...)
Definition: mmdbg.c:19
#define KD_BREAKPOINT_ACTIVE
Definition: kd64.h:40

Referenced by KdpWriteBreakpoint().

◆ KdpAllowDisable()

NTSTATUS NTAPI KdpAllowDisable ( VOID  )

Definition at line 364 of file kdx64.c.

365 {
367  return STATUS_ACCESS_DENIED;
368 }
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define UNIMPLEMENTED_DBGBREAK(...)
Definition: debug.h:57

Referenced by KdDisableDebuggerWithLock().

◆ KdpCommandString()

VOID NTAPI KdpCommandString ( IN PSTRING  NameString,
IN PSTRING  CommandString,
IN KPROCESSOR_MODE  PreviousMode,
IN PCONTEXT  ContextRecord,
IN PKTRAP_FRAME  TrapFrame,
IN PKEXCEPTION_FRAME  ExceptionFrame 
)

Definition at line 137 of file kdprint.c.

143 {
144  BOOLEAN Enable;
145  PKPRCB Prcb = KeGetCurrentPrcb();
146 
147  /* Check if we need to do anything */
148  if ((PreviousMode != KernelMode) || (KdDebuggerNotPresent)) return;
149 
150  /* Enter the debugger */
151  Enable = KdEnterDebugger(TrapFrame, ExceptionFrame);
152 
153  /* Save the CPU Control State and save the context */
157  sizeof(CONTEXT));
158 
159  /* Send the command string to the debugger */
161  CommandString,
163 
164  /* Restore the processor state */
167  sizeof(CONTEXT));
169 
170  /* Exit the debugger and return */
172 }
VOID NTAPI KdpMoveMemory(_In_ PVOID Destination, _In_ PVOID Source, _In_ SIZE_T Length)
Definition: kdapi.c:22
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1075
VOID NTAPI KdExitDebugger(IN BOOLEAN Enable)
Definition: kdapi.c:1924
BOOLEAN KdDebuggerNotPresent
Definition: kddata.c:82
CONTEXT ContextFrame
Definition: ketypes.h:531
unsigned char BOOLEAN
VOID NTAPI KiRestoreProcessorControlState(IN PKPROCESSOR_STATE ProcessorState)
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
KPROCESSOR_STATE ProcessorState
Definition: ketypes.h:579
_IRQL_requires_same_ _In_ PVOID _Inout_ struct _CONTEXT * ContextRecord
Definition: ntbasedef.h:655
VOID NTAPI KiSaveProcessorControlState(OUT PKPROCESSOR_STATE ProcessorState)
Definition: cpu.c:375
BOOLEAN NTAPI KdEnterDebugger(IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame)
Definition: kdapi.c:1871
VOID NTAPI KdpReportCommandStringStateChange(IN PSTRING NameString, IN PSTRING CommandString, IN OUT PCONTEXT Context)
Definition: kdapi.c:1653

Referenced by KdpTrap().

◆ KdpCopyMemoryChunks()

NTSTATUS NTAPI KdpCopyMemoryChunks ( _In_ ULONG64  Address,
_In_ PVOID  Buffer,
_In_ ULONG  TotalSize,
_In_ ULONG  ChunkSize,
_In_ ULONG  Flags,
_Out_opt_ PULONG  ActualSize 
)

Definition at line 50 of file kdapi.c.

57 {
59  ULONG RemainingLength, CopyChunk;
60 
61  /* Check if we didn't get a chunk size or if it is too big */
62  if (ChunkSize == 0)
63  {
64  /* Default to 4 byte chunks */
65  ChunkSize = 4;
66  }
67  else if (ChunkSize > MMDBG_COPY_MAX_SIZE)
68  {
69  /* Normalize to maximum size */
71  }
72 
73  /* Copy the whole range in aligned chunks */
74  RemainingLength = TotalSize;
75  CopyChunk = 1;
76  while (RemainingLength > 0)
77  {
78  /*
79  * Determine the best chunk size for this round.
80  * The ideal size is aligned, isn't larger than the
81  * the remaining length and respects the chunk limit.
82  */
83  while (((CopyChunk * 2) <= RemainingLength) &&
84  (CopyChunk < ChunkSize) &&
85  ((Address & ((CopyChunk * 2) - 1)) == 0))
86  {
87  /* Increase it */
88  CopyChunk *= 2;
89  }
90 
91  /*
92  * The chunk size can be larger than the remaining size if this
93  * isn't the first round, so check if we need to shrink it back.
94  */
95  while (CopyChunk > RemainingLength)
96  {
97  /* Shrink it */
98  CopyChunk /= 2;
99  }
100 
101  /* Do the copy */
102  Status = MmDbgCopyMemory(Address, Buffer, CopyChunk, Flags);
103  if (!NT_SUCCESS(Status))
104  {
105  /* Copy failed, break out */
106  break;
107  }
108 
109  /* Update pointers and length for the next run */
110  Address = Address + CopyChunk;
111  Buffer = (PVOID)((ULONG_PTR)Buffer + CopyChunk);
112  RemainingLength = RemainingLength - CopyChunk;
113  }
114 
115  /* We may have modified executable code, flush the instruction cache */
116  KeSweepICache((PVOID)(ULONG_PTR)Address, TotalSize);
117 
118  /*
119  * Return the size we managed to copy and return
120  * success if we could copy the whole range.
121  */
122  if (ActualSize) *ActualSize = TotalSize - RemainingLength;
123  return RemainingLength == 0 ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL;
124 }
LONG NTSTATUS
Definition: precomp.h:26
uint32_t ULONG_PTR
Definition: typedefs.h:65
_Inout_ PUCHAR _In_ PUCHAR _Out_ PUCHAR _Out_ PULONG ChunkSize
Definition: rtlfuncs.h:2276
static WCHAR Address[46]
Definition: ping.c:68
Definition: bufpool.h:45
void * PVOID
Definition: retypes.h:9
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
NTSTATUS NTAPI MmDbgCopyMemory(IN ULONG64 Address, IN PVOID Buffer, IN ULONG Size, IN ULONG Flags)
Definition: mmdbg.c:124
#define MMDBG_COPY_MAX_SIZE
Definition: mm.h:63
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_SUCCESS
Definition: shellext.h:65
FORCEINLINE VOID KeSweepICache(IN PVOID BaseAddress, IN SIZE_T FlushSize)
Definition: ke.h:217

Referenced by KdbpSafeReadMemory(), KdbpSafeWriteMemory(), KdpAddBreakpoint(), KdpLowRestoreBreakpoint(), KdpLowWriteContent(), KdpReadPhysicalMemory(), KdpReadVirtualMemory(), KdpReportCommandStringStateChange(), KdpReportLoadSymbolsStateChange(), KdpSetCommonState(), KdpSysReadControlSpace(), KdpSysWriteControlSpace(), KdpWritePhysicalMemory(), KdpWriteVirtualMemory(), and KdSetOwedBreakpoints().

◆ KdpDeleteBreakpoint()

BOOLEAN NTAPI KdpDeleteBreakpoint ( IN ULONG  BpEntry)

Definition at line 311 of file kdbreak.c.

312 {
313  ULONG BpIndex = BpEntry - 1;
314 
315  /* Check for invalid breakpoint entry */
316  if (!BpEntry || (BpEntry > KD_BREAKPOINT_MAX)) return FALSE;
317 
318  /* If the specified breakpoint table entry is not valid, then return FALSE. */
319  if (!KdpBreakpointTable[BpIndex].Flags) return FALSE;
320 
321  /* Check if the breakpoint is suspended */
323  {
324  /* Check if breakpoint is not being deleted */
326  {
327  /* Invalidate it and return success */
328  KdpBreakpointTable[BpIndex].Flags = 0;
329  return TRUE;
330  }
331  }
332 
333  /* Restore original data, then invalidate it and return success */
334  if (KdpLowWriteContent(BpIndex)) KdpBreakpointTable[BpIndex].Flags = 0;
335  return TRUE;
336 }
#define TRUE
Definition: types.h:120
#define KD_BREAKPOINT_SUSPENDED
Definition: kd64.h:42
#define FALSE
Definition: types.h:117
BOOLEAN NTAPI KdpLowWriteContent(IN ULONG BpIndex)
Definition: kdbreak.c:226
ULONG Flags
Definition: kd64.h:50
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define KD_BREAKPOINT_MAX
Definition: kd64.h:23
BREAKPOINT_ENTRY KdpBreakpointTable[KD_BREAKPOINT_MAX]
Definition: kddata.c:96
unsigned int ULONG
Definition: retypes.h:1
#define KD_BREAKPOINT_EXPIRED
Definition: kd64.h:43

Referenced by KdpDeleteBreakpointRange(), and KdpRestoreBreakpoint().

◆ KdpDeleteBreakpointRange()

BOOLEAN NTAPI KdpDeleteBreakpointRange ( IN PVOID  Base,
IN PVOID  Limit 
)

Definition at line 340 of file kdbreak.c.

342 {
343  ULONG BpIndex;
344  BOOLEAN DeletedBreakpoints;
345 
346  /* Assume no breakpoints will be deleted */
347  DeletedBreakpoints = FALSE;
348 
349  /* Loop the breakpoint table */
350  for (BpIndex = 0; BpIndex < KD_BREAKPOINT_MAX; BpIndex++)
351  {
352  /* Make sure that the breakpoint is active and matches the range. */
353  if ((KdpBreakpointTable[BpIndex].Flags & KD_BREAKPOINT_ACTIVE) &&
354  ((KdpBreakpointTable[BpIndex].Address >= Base) &&
355  (KdpBreakpointTable[BpIndex].Address <= Limit)))
356  {
357  /* Delete it, and remember if we succeeded at least once */
358  if (KdpDeleteBreakpoint(BpIndex + 1)) DeletedBreakpoints = TRUE;
359  }
360  }
361 
362  /* Return whether we deleted anything */
363  return DeletedBreakpoints;
364 }
#define TRUE
Definition: types.h:120
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2373
BOOLEAN NTAPI KdpDeleteBreakpoint(IN ULONG BpEntry)
Definition: kdbreak.c:311
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
static WCHAR Address[46]
Definition: ping.c:68
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define KD_BREAKPOINT_MAX
Definition: kd64.h:23
BREAKPOINT_ENTRY KdpBreakpointTable[KD_BREAKPOINT_MAX]
Definition: kddata.c:96
unsigned int ULONG
Definition: retypes.h:1
_In_ LONG _In_ LONG Limit
Definition: kefuncs.h:315
#define KD_BREAKPOINT_ACTIVE
Definition: kd64.h:40

Referenced by KdpSetCommonState().

◆ KdpDprintf()

VOID __cdecl KdpDprintf ( _In_ PCHAR  Format,
  ... 
)

Definition at line 441 of file kdprint.c.

444 {
445  STRING String;
446  USHORT Length;
447  va_list ap;
448  CHAR Buffer[100];
449 
450  /* Format the string */
451  va_start(ap, Format);
453  sizeof(Buffer),
454  Format,
455  ap);
456  va_end(ap);
457 
458  /* Set it up */
459  String.Buffer = Buffer;
460  String.Length = String.MaximumLength = Length;
461 
462  /* Send it to the debugger directly */
464 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
char CHAR
Definition: xmlstorage.h:175
BOOLEAN NTAPI KdpPrintString(_In_ PSTRING Output)
Definition: kdprint.c:22
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2430
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
Definition: bufpool.h:45
va_start(ap, x)
std::wstring STRING
Definition: fontsub.cpp:33
unsigned short USHORT
Definition: pedump.c:61
#define _vsnprintf
Definition: xmlstorage.h:202
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char * Format
Definition: acpixf.h:1216

◆ KdpGetStateChange()

VOID NTAPI KdpGetStateChange ( IN PDBGKD_MANIPULATE_STATE64  State,
IN PCONTEXT  Context 
)

Definition at line 22 of file kdx64.c.

24 {
25  PKPRCB Prcb;
26  ULONG i;
27 
28  /* Check for success */
29  if (NT_SUCCESS(State->u.Continue2.ContinueStatus))
30  {
31  /* Check if we're tracing */
32  if (State->u.Continue2.ControlSet.TraceFlag)
33  {
34  /* Enable TF */
35  Context->EFlags |= EFLAGS_TF;
36  }
37  else
38  {
39  /* Remove it */
40  Context->EFlags &= ~EFLAGS_TF;
41  }
42 
43  /* Loop all processors */
44  for (i = 0; i < KeNumberProcessors; i++)
45  {
46  /* Get the PRCB and update DR7 and DR6 */
47  Prcb = KiProcessorBlock[i];
49  State->u.Continue2.ControlSet.Dr7;
51  }
52 
53  /* Check if we have new symbol information */
54  if (State->u.Continue2.ControlSet.CurrentSymbolStart != 1)
55  {
56  /* Update it */
58  State->u.Continue2.ControlSet.CurrentSymbolStart;
59  KdpCurrentSymbolEnd= State->u.Continue2.ControlSet.CurrentSymbolEnd;
60  }
61  }
62 }
ULONG64 KernelDr7
Definition: ketypes.h:505
KSPECIAL_REGISTERS SpecialRegisters
Definition: ketypes.h:530
ULONG_PTR KdpCurrentSymbolEnd
Definition: kddata.c:105
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
KPROCESSOR_STATE ProcessorState
Definition: ketypes.h:579
ULONG_PTR KdpCurrentSymbolStart
Definition: kddata.c:105
#define EFLAGS_TF
Definition: ketypes.h:125
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
PKPRCB KiProcessorBlock[]
Definition: krnlinit.c:32
unsigned int ULONG
Definition: retypes.h:1
ULONG64 KernelDr6
Definition: ketypes.h:504

Referenced by KdpSendWaitContinue().

◆ KdpMoveMemory()

VOID NTAPI KdpMoveMemory ( _In_ PVOID  Destination,
_In_ PVOID  Source,
_In_ SIZE_T  Length 
)

Definition at line 22 of file kdapi.c.

26 {
27  PCHAR DestinationBytes, SourceBytes;
28 
29  /* Copy the buffers 1 byte at a time */
30  DestinationBytes = Destination;
31  SourceBytes = Source;
32  while (Length--) *DestinationBytes++ = *SourceBytes++;
33 }
signed char * PCHAR
Definition: retypes.h:7
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2937
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167

Referenced by KdpCommandString(), KdpGetContext(), KdpGetContextEx(), KdpPrintFromUser(), KdpPrintString(), KdpPrompt(), KdpPromptString(), KdpReport(), KdpReportExceptionStateChange(), KdpSetContext(), KdpSetContextEx(), KdpSymbol(), and KdpSysGetVersion().

◆ KdpPollBreakInWithPortLock()

BOOLEAN NTAPI KdpPollBreakInWithPortLock ( VOID  )

Definition at line 35 of file kdlock.c.

36 {
37  BOOLEAN DoBreak = FALSE;
38 
39  /* First make sure that KD is enabled */
41  {
42  /* Check if a CTRL-C is in the queue */
44  {
45  /* Set it and prepare for break */
46  DoBreak = TRUE;
48  }
49  else
50  {
51  /* Now get a packet */
53  NULL,
54  NULL,
55  NULL,
57  {
58  /* Successful breakin */
59  DoBreak = TRUE;
60  }
61  }
62  }
63 
64  /* Tell the caller to do a break */
65  return DoBreak;
66 }
BOOLEAN KdDebuggerEnabled
Definition: kddata.c:83
#define KdPacketReceived
Definition: kddll.h:5
#define TRUE
Definition: types.h:120
KDP_STATUS NTAPI KdReceivePacket(IN ULONG PacketType, OUT PSTRING MessageHeader, OUT PSTRING MessageData, OUT PULONG DataLength, IN OUT PKD_CONTEXT KdContext)
Definition: kddll.c:80
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
KD_CONTEXT KdpContext
Definition: kddata.c:65
BOOLEAN KdpControlCPending
Definition: windbgkd.h:227
#define NULL
Definition: types.h:112
#define PACKET_TYPE_KD_POLL_BREAKIN
Definition: windbgkd.h:49

Referenced by KdpPrintString().

◆ KdpPortLock()

VOID NTAPI KdpPortLock ( VOID  )

Definition at line 19 of file kdlock.c.

20 {
21  /* Acquire the lock */
23 }
KSPIN_LOCK KdpDebuggerLock
Definition: kddata.c:67
VOID FASTCALL KiAcquireSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: ntoskrnl.c:28

Referenced by KdDisableDebuggerWithLock(), and KdEnableDebuggerWithLock().

◆ KdpPortUnlock()

VOID NTAPI KdpPortUnlock ( VOID  )

Definition at line 27 of file kdlock.c.

28 {
29  /* Release the lock */
31 }
KSPIN_LOCK KdpDebuggerLock
Definition: kddata.c:67
VOID FASTCALL KiReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: ntoskrnl.c:35

Referenced by KdDisableDebuggerWithLock(), KdEnableDebuggerWithLock(), KdExitDebugger(), and KdPollBreakIn().

◆ KdpPrint()

NTSTATUS NTAPI KdpPrint ( _In_ ULONG  ComponentId,
_In_ ULONG  Level,
_In_reads_bytes_(Length) PCHAR  String,
_In_ USHORT  Length,
_In_ KPROCESSOR_MODE  PreviousMode,
_In_ PKTRAP_FRAME  TrapFrame,
_In_ PKEXCEPTION_FRAME  ExceptionFrame,
_Out_ PBOOLEAN  Handled 
)

Definition at line 358 of file kdprint.c.

367 {
369  BOOLEAN Enable;
370  STRING OutputString;
371 
373  {
374  /* Mask validation failed */
375  *Handled = TRUE;
376  return STATUS_SUCCESS;
377  }
378 
379  /* Assume failure */
380  *Handled = FALSE;
381 
382  /* Normalize the length */
384 
385  /* Check if we need to verify the string */
386  if (PreviousMode != KernelMode)
387  {
388  /* This case requires a 512 byte stack buffer.
389  * We don't want to use that much stack in the kernel case, but we
390  * can't use _alloca due to PSEH. So the buffer exists in this
391  * helper function instead.
392  */
394  Level,
395  String,
396  Length,
397  PreviousMode,
398  TrapFrame,
399  ExceptionFrame,
400  Handled);
401  }
402 
403  /* Setup the output string */
404  OutputString.Buffer = String;
405  OutputString.Length = OutputString.MaximumLength = Length;
406 
407  /* Log the print */
408  //KdLogDbgPrint(&OutputString);
409 
410  /* Check for a debugger */
412  {
413  /* Fail */
414  *Handled = TRUE;
416  }
417 
418  /* Enter the debugger */
419  Enable = KdEnterDebugger(TrapFrame, ExceptionFrame);
420 
421  /* Print the string */
422  if (KdpPrintString(&OutputString))
423  {
424  /* User pressed CTRL-C, breakpoint on return */
426  }
427  else
428  {
429  /* String was printed */
431  }
432 
433  /* Exit the debugger and return */
435  *Handled = TRUE;
436  return Status;
437 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char UINT32 ComponentId
Definition: acpixf.h:1274
VOID NTAPI KdExitDebugger(IN BOOLEAN Enable)
Definition: kdapi.c:1924
BOOLEAN NTAPI KdpPrintString(_In_ PSTRING Output)
Definition: kdprint.c:22
BOOLEAN KdDebuggerNotPresent
Definition: kddata.c:82
NTSTATUS NTAPI NtQueryDebugFilterState(_In_ ULONG ComponentId, _In_ ULONG Level)
Definition: kdapi.c:2352
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2430
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
#define STATUS_BREAKPOINT
Definition: ntstatus.h:184
#define STATUS_DEVICE_NOT_CONNECTED
Definition: udferr_usr.h:160
Status
Definition: gdiplustypes.h:24
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
#define KD_PRINT_MAX_BYTES
Definition: kdprint.c:16
_In_ BOOLEAN Handled
Definition: ketypes.h:337
std::wstring STRING
Definition: fontsub.cpp:33
#define min(a, b)
Definition: monoChain.cc:55
static NTSTATUS NTAPI KdpPrintFromUser(_In_ ULONG ComponentId, _In_ ULONG Level, _In_reads_bytes_(Length) PCHAR String, _In_ USHORT Length, _In_ KPROCESSOR_MODE PreviousMode, _In_ PKTRAP_FRAME TrapFrame, _In_ PKEXCEPTION_FRAME ExceptionFrame, _Out_ PBOOLEAN Handled)
Definition: kdprint.c:315
BOOLEAN NTAPI KdEnterDebugger(IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame)
Definition: kdapi.c:1871
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by KdpPrintFromUser(), and KdpTrap().

◆ KdpPrompt()

USHORT NTAPI KdpPrompt ( _In_reads_bytes_(PromptLength) PCHAR  PromptString,
_In_ USHORT  PromptLength,
_Out_writes_bytes_(MaximumResponseLength) PCHAR  ResponseString,
_In_ USHORT  MaximumResponseLength,
_In_ KPROCESSOR_MODE  PreviousMode,
_In_ PKTRAP_FRAME  TrapFrame,
_In_ PKEXCEPTION_FRAME  ExceptionFrame 
)

Definition at line 217 of file kdprint.c.

225 {
226  STRING PromptBuffer, ResponseBuffer;
227  BOOLEAN Enable, Resend;
228  PCHAR SafeResponseString;
229  CHAR CapturedPrompt[KD_PRINT_MAX_BYTES];
230  CHAR SafeResponseBuffer[KD_PRINT_MAX_BYTES];
231 
232  /* Normalize the lengths */
233  PromptLength = min(PromptLength,
234  sizeof(CapturedPrompt));
236  sizeof(SafeResponseBuffer));
237 
238  /* Check if we need to verify the string */
239  if (PreviousMode != KernelMode)
240  {
241  /* Handle user-mode buffers safely */
242  _SEH2_TRY
243  {
244  /* Probe and capture the prompt */
245  ProbeForRead(PromptString, PromptLength, 1);
246  KdpMoveMemory(CapturedPrompt, PromptString, PromptLength);
247  PromptString = CapturedPrompt;
248 
249  /* Probe and make room for the response */
250  ProbeForWrite(ResponseString, MaximumResponseLength, 1);
251  SafeResponseString = SafeResponseBuffer;
252  }
254  {
255  /* Bad string pointer, bail out */
256  _SEH2_YIELD(return 0);
257  }
258  _SEH2_END;
259  }
260  else
261  {
262  SafeResponseString = ResponseString;
263  }
264 
265  /* Setup the prompt and response buffers */
266  PromptBuffer.Buffer = PromptString;
267  PromptBuffer.Length = PromptBuffer.MaximumLength = PromptLength;
268  ResponseBuffer.Buffer = SafeResponseString;
269  ResponseBuffer.Length = 0;
270  ResponseBuffer.MaximumLength = MaximumResponseLength;
271 
272  /* Log the print */
273  //KdLogDbgPrint(&PromptBuffer);
274 
275  /* Enter the debugger */
276  Enable = KdEnterDebugger(TrapFrame, ExceptionFrame);
277 
278  /* Enter prompt loop */
279  do
280  {
281  /* Send the prompt and receive the response */
282  Resend = KdpPromptString(&PromptBuffer, &ResponseBuffer);
283 
284  /* Loop while we need to resend */
285  } while (Resend);
286 
287  /* Exit the debugger */
289 
290  /* Copy back the response if required */
291  if (PreviousMode != KernelMode)
292  {
293  _SEH2_TRY
294  {
295  /* Safely copy back the response to user mode */
296  KdpMoveMemory(ResponseString,
297  ResponseBuffer.Buffer,
298  ResponseBuffer.Length);
299  }
301  {
302  /* String became invalid after we exited, fail */
303  _SEH2_YIELD(return 0);
304  }
305  _SEH2_END;
306  }
307 
308  /* Return the number of characters received */
309  return ResponseBuffer.Length;
310 }
signed char * PCHAR
Definition: retypes.h:7
VOID NTAPI KdpMoveMemory(_In_ PVOID Destination, _In_ PVOID Source, _In_ SIZE_T Length)
Definition: kdapi.c:22
char CHAR
Definition: xmlstorage.h:175
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
BOOLEAN NTAPI KdpPromptString(_In_ PSTRING PromptString, _In_ PSTRING ResponseString)
Definition: kdprint.c:63
VOID NTAPI KdExitDebugger(IN BOOLEAN Enable)
Definition: kdapi.c:1924
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
_SEH2_TRY
Definition: create.c:4226
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
unsigned char BOOLEAN
_In_ ULONG MaximumResponseLength
Definition: kdfuncs.h:11
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define KD_PRINT_MAX_BYTES
Definition: kdprint.c:16
std::wstring STRING
Definition: fontsub.cpp:33
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
_SEH2_END
Definition: create.c:4400
#define min(a, b)
Definition: monoChain.cc:55
BOOLEAN NTAPI KdEnterDebugger(IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame)
Definition: kdapi.c:1871
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6

Referenced by KdpTrap().

◆ KdpReportCommandStringStateChange()

VOID NTAPI KdpReportCommandStringStateChange ( IN PSTRING  NameString,
IN PSTRING  CommandString,
IN OUT PCONTEXT  Context 
)

Definition at line 1653 of file kdapi.c.

1656 {
1657  STRING Header, Data;
1658  DBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange;
1659  ULONG Length, ActualLength, TotalLength;
1661 
1662  /* Start wait loop */
1663  do
1664  {
1665  /* Build the architecture common parts of the message */
1667  Context,
1668  &WaitStateChange);
1669 
1670  /* Set the context */
1671  KdpSetContextState(&WaitStateChange, Context);
1672 
1673  /* Clear the command string structure */
1674  KdpZeroMemory(&WaitStateChange.u.CommandString,
1675  sizeof(DBGKD_COMMAND_STRING));
1676 
1677  /* Normalize name string to max */
1678  Length = min(128 - 1, NameString->Length);
1679 
1680  /* Copy it to the message buffer */
1681  KdpCopyMemoryChunks((ULONG_PTR)NameString->Buffer,
1683  Length,
1684  0,
1686  &ActualLength);
1687 
1688  /* Null terminate and calculate the total length */
1689  TotalLength = ActualLength;
1691 
1692  /* Check if the command string is too long */
1693  Length = CommandString->Length;
1694  if (Length > (PACKET_MAX_SIZE -
1696  {
1697  /* Use maximum possible size */
1698  Length = (PACKET_MAX_SIZE -
1700  }
1701 
1702  /* Copy it to the message buffer */
1703  KdpCopyMemoryChunks((ULONG_PTR)CommandString->Buffer,
1705  Length,
1706  0,
1708  &ActualLength);
1709 
1710  /* Null terminate and calculate the total length */
1711  TotalLength += ActualLength;
1713 
1714  /* Now set up the header and the data */
1715  Header.Length = sizeof(DBGKD_ANY_WAIT_STATE_CHANGE);
1716  Header.Buffer = (PCHAR)&WaitStateChange;
1717  Data.Length = (USHORT)TotalLength;
1718  Data.Buffer = KdpMessageBuffer;
1719 
1720  /* Send State Change packet and wait for a reply */
1722  &Header,
1723  &Data,
1724  Context);
1725  } while (Status == ContinueProcessorReselected);
1726 }
NTSTATUS NTAPI KdpCopyMemoryChunks(_In_ ULONG64 Address, _In_ PVOID Buffer, _In_ ULONG TotalSize, _In_ ULONG ChunkSize, _In_ ULONG Flags, _Out_opt_ PULONG ActualSize)
Definition: kdapi.c:50
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG _In_opt_ PVOID Data
Definition: wdfdevice.h:4527
union _DBGKD_ANY_WAIT_STATE_CHANGE::@3514 u
enum _KCONTINUE_STATUS KCONTINUE_STATUS
_In_ ULONG TotalLength
Definition: usbdlib.h:158
#define PACKET_MAX_SIZE
Definition: windbgkd.h:18
KCONTINUE_STATUS NTAPI KdpSendWaitContinue(IN ULONG PacketType, IN PSTRING SendHeader, IN PSTRING SendData OPTIONAL, IN OUT PCONTEXT Context)
Definition: kdapi.c:1260
CHAR KdpMessageBuffer[0x1000]
Definition: kddata.c:127
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define ANSI_NULL
Definition: Header.h:8
#define PCHAR
Definition: match.c:90
Status
Definition: gdiplustypes.h:24
#define DbgKdCommandStringStateChange
Definition: windbgkd.h:61
DBGKD_COMMAND_STRING CommandString
Definition: windbgkd.h:490
VOID NTAPI KdpSetCommonState(IN ULONG NewState, IN PCONTEXT Context, IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange)
Definition: kdapi.c:381
struct _DBGKD_ANY_WAIT_STATE_CHANGE DBGKD_ANY_WAIT_STATE_CHANGE
std::wstring STRING
Definition: fontsub.cpp:33
#define PACKET_TYPE_KD_STATE_CHANGE64
Definition: windbgkd.h:48
unsigned short USHORT
Definition: pedump.c:61
VOID NTAPI KdpSetContextState(IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange, IN PCONTEXT Context)
Definition: kdx64.c:66
#define MMDBG_COPY_UNSAFE
Definition: mm.h:55
#define min(a, b)
Definition: monoChain.cc:55
unsigned int ULONG
Definition: retypes.h:1
VOID NTAPI KdpZeroMemory(_In_ PVOID Destination, _In_ SIZE_T Length)
Definition: kdapi.c:37

Referenced by KdpCommandString().

◆ KdpReportExceptionStateChange()

BOOLEAN NTAPI KdpReportExceptionStateChange ( IN PEXCEPTION_RECORD  ExceptionRecord,
IN OUT PCONTEXT  Context,
IN BOOLEAN  SecondChanceException 
)

Definition at line 1730 of file kdapi.c.

1733 {
1734  STRING Header, Data;
1735  DBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange;
1737 
1738  /* Start report loop */
1739  do
1740  {
1741  /* Build the architecture common parts of the message */
1743 
1744 #if !defined(_WIN64)
1745 
1746  /* Convert it and copy it over */
1747  ExceptionRecord32To64((PEXCEPTION_RECORD32)ExceptionRecord,
1748  &WaitStateChange.u.Exception.ExceptionRecord);
1749 
1750 #else
1751 
1752  /* Just copy it directly, no need to convert */
1753  KdpMoveMemory(&WaitStateChange.u.Exception.ExceptionRecord,
1754  ExceptionRecord,
1755  sizeof(EXCEPTION_RECORD));
1756 
1757 #endif
1758 
1759  /* Set the First Chance flag */
1760  WaitStateChange.u.Exception.FirstChance = !SecondChanceException;
1761 
1762  /* Now finish creating the structure */
1763  KdpSetContextState(&WaitStateChange, Context);
1764 
1765  /* Setup the actual header to send to KD */
1766  Header.Length = sizeof(DBGKD_ANY_WAIT_STATE_CHANGE);
1767  Header.Buffer = (PCHAR)&WaitStateChange;
1768 
1769  /* Setup the trace data */
1770  DumpTraceData(&Data);
1771 
1772  /* Send State Change packet and wait for a reply */
1774  &Header,
1775  &Data,
1776  Context);
1777  } while (Status == ContinueProcessorReselected);
1778 
1779  /* Return */
1780  return Status;
1781 }
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG _In_opt_ PVOID Data
Definition: wdfdevice.h:4527
union _DBGKD_ANY_WAIT_STATE_CHANGE::@3514 u
enum _KCONTINUE_STATUS KCONTINUE_STATUS
VOID NTAPI DumpTraceData(IN PSTRING TraceData)
Definition: kdapi.c:366
#define DbgKdExceptionStateChange
Definition: windbgkd.h:59
KCONTINUE_STATUS NTAPI KdpSendWaitContinue(IN ULONG PacketType, IN PSTRING SendHeader, IN PSTRING SendData OPTIONAL, IN OUT PCONTEXT Context)
Definition: kdapi.c:1260
Definition: Header.h:8
static __inline VOID NTAPI ExceptionRecord32To64(IN PEXCEPTION_RECORD32 Ex32, OUT PEXCEPTION_RECORD64 Ex64)
Definition: windbgkd.h:897
#define PCHAR
Definition: match.c:90
Status
Definition: gdiplustypes.h:24
VOID NTAPI KdpSetCommonState(IN ULONG NewState, IN PCONTEXT Context, IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange)
Definition: kdapi.c:381
VOID NTAPI KdpMoveMemory(_In_ PVOID Destination, _In_ PVOID Source, _In_ SIZE_T Length)
Definition: kdapi.c:22
struct _DBGKD_ANY_WAIT_STATE_CHANGE DBGKD_ANY_WAIT_STATE_CHANGE
std::wstring STRING
Definition: fontsub.cpp:33
EXCEPTION_RECORD64 ExceptionRecord
Definition: windbgkd.h:303
#define PACKET_TYPE_KD_STATE_CHANGE64
Definition: windbgkd.h:48
VOID NTAPI KdpSetContextState(IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange, IN PCONTEXT Context)
Definition: kdx64.c:66
DBGKM_EXCEPTION64 Exception
Definition: windbgkd.h:488

Referenced by KdpReport(), and KdpSwitchProcessor().

◆ KdpReportLoadSymbolsStateChange()

VOID NTAPI KdpReportLoadSymbolsStateChange ( IN PSTRING  PathName,
IN PKD_SYMBOLS_INFO  SymbolInfo,
IN BOOLEAN  Unload,
IN OUT PCONTEXT  Context 
)

Definition at line 1581 of file kdapi.c.

1585 {
1586  PSTRING ExtraData;
1587  STRING Data, Header;
1588  DBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange;
1589  ULONG PathNameLength;
1591 
1592  /* Start wait loop */
1593  do
1594  {
1595  /* Build the architecture common parts of the message */
1597  Context,
1598  &WaitStateChange);
1599 
1600  /* Now finish creating the structure */
1601  KdpSetContextState(&WaitStateChange, Context);
1602 
1603  /* Fill out load data */
1604  WaitStateChange.u.LoadSymbols.UnloadSymbols = Unload;
1605  WaitStateChange.u.LoadSymbols.BaseOfDll = (ULONG64)(LONG_PTR)SymbolInfo->BaseOfDll;
1606  WaitStateChange.u.LoadSymbols.ProcessId = SymbolInfo->ProcessId;
1607  WaitStateChange.u.LoadSymbols.CheckSum = SymbolInfo->CheckSum;
1608  WaitStateChange.u.LoadSymbols.SizeOfImage = SymbolInfo->SizeOfImage;
1609 
1610  /* Check if we have a path name */
1611  if (PathName)
1612  {
1613  /* Copy it to the path buffer */
1614  KdpCopyMemoryChunks((ULONG_PTR)PathName->Buffer,
1615  KdpPathBuffer,
1616  PathName->Length,
1617  0,
1619  &PathNameLength);
1620 
1621  /* Null terminate */
1622  KdpPathBuffer[PathNameLength++] = ANSI_NULL;
1623 
1624  /* Set the path length */
1625  WaitStateChange.u.LoadSymbols.PathNameLength = PathNameLength;
1626 
1627  /* Set up the data */
1628  Data.Buffer = KdpPathBuffer;
1629  Data.Length = (USHORT)PathNameLength;
1630  ExtraData = &Data;
1631  }
1632  else
1633  {
1634  /* No name */
1635  WaitStateChange.u.LoadSymbols.PathNameLength = 0;
1636  ExtraData = NULL;
1637  }
1638 
1639  /* Setup the header */
1640  Header.Length = sizeof(DBGKD_ANY_WAIT_STATE_CHANGE);
1641  Header.Buffer = (PCHAR)&WaitStateChange;
1642 
1643  /* Send the packet */
1645  &Header,
1646  ExtraData,
1647  Context);
1648  } while (Status == ContinueProcessorReselected);
1649 }
NTSTATUS NTAPI KdpCopyMemoryChunks(_In_ ULONG64 Address, _In_ PVOID Buffer, _In_ ULONG TotalSize, _In_ ULONG ChunkSize, _In_ ULONG Flags, _Out_opt_ PULONG ActualSize)
Definition: kdapi.c:50
VOID NTAPI Unload(PDRIVER_OBJECT DriverObject)
Definition: csqtest.c:160
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG _In_opt_ PVOID Data
Definition: wdfdevice.h:4527
union _DBGKD_ANY_WAIT_STATE_CHANGE::@3514 u
enum _KCONTINUE_STATUS KCONTINUE_STATUS
KCONTINUE_STATUS NTAPI KdpSendWaitContinue(IN ULONG PacketType, IN PSTRING SendHeader, IN PSTRING SendData OPTIONAL, IN OUT PCONTEXT Context)
Definition: kdapi.c:1260
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define ANSI_NULL
CHAR KdpPathBuffer[0x1000]
Definition: kddata.c:128
Definition: Header.h:8
DBGKD_LOAD_SYMBOLS64 LoadSymbols
Definition: windbgkd.h:489
#define PCHAR
Definition: match.c:90
Status
Definition: gdiplustypes.h:24
VOID NTAPI KdpSetCommonState(IN ULONG NewState, IN PCONTEXT Context, IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange)
Definition: kdapi.c:381
#define DbgKdLoadSymbolsStateChange
Definition: windbgkd.h:60
struct _DBGKD_ANY_WAIT_STATE_CHANGE DBGKD_ANY_WAIT_STATE_CHANGE
std::wstring STRING
Definition: fontsub.cpp:33
unsigned __int64 ULONG64
Definition: imports.h:198
#define PACKET_TYPE_KD_STATE_CHANGE64
Definition: windbgkd.h:48
unsigned short USHORT
Definition: pedump.c:61
VOID NTAPI KdpSetContextState(IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange, IN PCONTEXT Context)
Definition: kdx64.c:66
#define MMDBG_COPY_UNSAFE
Definition: mm.h:55
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1

Referenced by KdpSymbol().

◆ KdpRestoreAllBreakpoints()

VOID NTAPI KdpRestoreAllBreakpoints ( VOID  )

Definition at line 368 of file kdbreak.c.

369 {
370  ULONG BpIndex;
371 
372  /* No more suspended Breakpoints */
374 
375  /* Loop the breakpoints */
376  for (BpIndex = 0; BpIndex < KD_BREAKPOINT_MAX; BpIndex++)
377  {
378  /* Check if they are valid, suspended breakpoints */
379  if ((KdpBreakpointTable[BpIndex].Flags & KD_BREAKPOINT_ACTIVE) &&
381  {
382  /* Unsuspend them */
384  KdpLowRestoreBreakpoint(BpIndex);
385  }
386  }
387 }
#define KD_BREAKPOINT_SUSPENDED
Definition: kd64.h:42
BOOLEAN BreakpointsSuspended
Definition: kddata.c:99
#define FALSE
Definition: types.h:117
ULONG Flags
Definition: kd64.h:50
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
BOOLEAN NTAPI KdpLowRestoreBreakpoint(IN ULONG BpIndex)
Definition: kdbreak.c:268
#define KD_BREAKPOINT_MAX
Definition: kd64.h:23
BREAKPOINT_ENTRY KdpBreakpointTable[KD_BREAKPOINT_MAX]
Definition: kddata.c:96
unsigned int ULONG
Definition: retypes.h:1
#define KD_BREAKPOINT_ACTIVE
Definition: kd64.h:40

Referenced by KdEnableDebuggerWithLock().

◆ KdpSetContextState()

VOID NTAPI KdpSetContextState ( IN PDBGKD_ANY_WAIT_STATE_CHANGE  WaitStateChange,
IN PCONTEXT  Context 
)

Definition at line 66 of file kdx64.c.

68 {
69  PKPRCB Prcb = KeGetCurrentPrcb();
70 
71  /* Copy i386 specific debug registers */
72  WaitStateChange->ControlReport.Dr6 = Prcb->ProcessorState.SpecialRegisters.
73  KernelDr6;
74  WaitStateChange->ControlReport.Dr7 = Prcb->ProcessorState.SpecialRegisters.
75  KernelDr7;
76 
77  /* Copy i386 specific segments */
78  WaitStateChange->ControlReport.SegCs = (USHORT)Context->SegCs;
79  WaitStateChange->ControlReport.SegDs = (USHORT)Context->SegDs;
80  WaitStateChange->ControlReport.SegEs = (USHORT)Context->SegEs;
81  WaitStateChange->ControlReport.SegFs = (USHORT)Context->SegFs;
82 
83  /* Copy EFlags */
84  WaitStateChange->ControlReport.EFlags = Context->EFlags;
85 
86  /* Set Report Flags */
87  WaitStateChange->ControlReport.ReportFlags = REPORT_INCLUDES_SEGS;
88  if (WaitStateChange->ControlReport.SegCs == KGDT64_R0_CODE)
89  {
90  WaitStateChange->ControlReport.ReportFlags |= REPORT_STANDARD_CS;
91  }
92 }
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1075
KSPECIAL_REGISTERS SpecialRegisters
Definition: ketypes.h:530
#define REPORT_STANDARD_CS
Definition: windbgkd.h:148
#define KGDT64_R0_CODE
Definition: ketypes.h:72
KPROCESSOR_STATE ProcessorState
Definition: ketypes.h:579
#define REPORT_INCLUDES_SEGS
Definition: windbgkd.h:147
unsigned short USHORT
Definition: pedump.c:61

Referenced by KdpReportCommandStringStateChange(), KdpReportExceptionStateChange(), and KdpReportLoadSymbolsStateChange().

◆ KdpStub()

BOOLEAN NTAPI KdpStub ( IN PKTRAP_FRAME  TrapFrame,
IN PKEXCEPTION_FRAME  ExceptionFrame,
IN PEXCEPTION_RECORD  ExceptionRecord,
IN PCONTEXT  ContextRecord,
IN KPROCESSOR_MODE  PreviousMode,
IN BOOLEAN  SecondChanceException 
)

Definition at line 266 of file kdtrap.c.

272 {
273  ULONG_PTR ExceptionCommand;
274 
275  /* Check if this was a breakpoint due to DbgPrint or Load/UnloadSymbols */
276  ExceptionCommand = ExceptionRecord->ExceptionInformation[0];
277  if ((ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT) &&
278  (ExceptionRecord->NumberParameters > 0) &&
279  ((ExceptionCommand == BREAKPOINT_LOAD_SYMBOLS) ||
280  (ExceptionCommand == BREAKPOINT_UNLOAD_SYMBOLS) ||
281  (ExceptionCommand == BREAKPOINT_COMMAND_STRING) ||
282  (ExceptionCommand == BREAKPOINT_PRINT)))
283  {
284  /* This we can handle: simply bump the Program Counter */
287  return TRUE;
288  }
289  else if (KdPitchDebugger)
290  {
291  /* There's no debugger, fail. */
292  return FALSE;
293  }
294  else if ((KdAutoEnableOnEvent) &&
296  !(KdDebuggerEnabled) &&
299  {
300  /* Debugging was Auto-Enabled. We can now send this to KD. */
301  return KdpTrap(TrapFrame,
302  ExceptionFrame,
303  ExceptionRecord,
305  PreviousMode,
306  SecondChanceException);
307  }
308  else
309  {
310  /* FIXME: All we can do in this case is trace this exception */
311  return FALSE;
312  }
313 }
BOOLEAN KdDebuggerEnabled
Definition: kddata.c:83
BOOLEAN NTAPI KdpTrap(IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame, IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT ContextRecord, IN KPROCESSOR_MODE PreviousMode, IN BOOLEAN SecondChanceException)
Definition: kdtrap.c:135
#define TRUE
Definition: types.h:120
BOOLEAN KdAutoEnableOnEvent
Definition: kddata.c:84
BOOLEAN KdPreviouslyEnabled
Definition: kddata.c:87
BOOLEAN KdPitchDebugger
Definition: kddata.c:81
uint32_t ULONG_PTR
Definition: typedefs.h:65
NTSTATUS NTAPI KdEnableDebugger(VOID)
Definition: kdapi.c:2130
#define FALSE
Definition: types.h:117
#define BREAKPOINT_UNLOAD_SYMBOLS
Definition: kdtypes.h:54
#define STATUS_BREAKPOINT
Definition: ntstatus.h:184
#define KeGetContextPc(Context)
Definition: ke.h:124
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_IRQL_requires_same_ _In_ PVOID _Inout_ struct _CONTEXT * ContextRecord
Definition: ntbasedef.h:655
#define BREAKPOINT_PRINT
Definition: kdtypes.h:51
#define BREAKPOINT_LOAD_SYMBOLS
Definition: kdtypes.h:53
#define BREAKPOINT_COMMAND_STRING
Definition: kdtypes.h:55
#define KD_BREAKPOINT_SIZE
Definition: ke.h:118
#define KeSetContextPc(Context, ProgramCounter)
Definition: ke.h:127

Referenced by KdDisableDebuggerWithLock(), and KdInitSystem().

◆ KdpSuspendAllBreakPoints()

VOID NTAPI KdpSuspendAllBreakPoints ( VOID  )

Definition at line 407 of file kdbreak.c.

408 {
409  ULONG BpEntry;
410 
411  /* Breakpoints are suspended */
413 
414  /* Loop every breakpoint */
415  for (BpEntry = 1; BpEntry <= KD_BREAKPOINT_MAX; BpEntry++)
416  {
417  /* Suspend it */
418  KdpSuspendBreakPoint(BpEntry);
419  }
420 }
#define TRUE
Definition: types.h:120
BOOLEAN BreakpointsSuspended
Definition: kddata.c:99
#define KD_BREAKPOINT_MAX
Definition: kd64.h:23
VOID NTAPI KdpSuspendBreakPoint(IN ULONG BpEntry)
Definition: kdbreak.c:391
unsigned int ULONG
Definition: retypes.h:1

Referenced by KdDisableDebuggerWithLock().

◆ KdpSuspendBreakPoint()

VOID NTAPI KdpSuspendBreakPoint ( IN ULONG  BpEntry)

Definition at line 391 of file kdbreak.c.

392 {
393  ULONG BpIndex = BpEntry - 1;
394 
395  /* Check if this is a valid, unsuspended breakpoint */
396  if ((KdpBreakpointTable[BpIndex].Flags & KD_BREAKPOINT_ACTIVE) &&
398  {
399  /* Suspend it */
401  KdpLowWriteContent(BpIndex);
402  }
403 }
#define KD_BREAKPOINT_SUSPENDED
Definition: kd64.h:42
BOOLEAN NTAPI KdpLowWriteContent(IN ULONG BpIndex)
Definition: kdbreak.c:226
ULONG Flags
Definition: kd64.h:50
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
BREAKPOINT_ENTRY KdpBreakpointTable[KD_BREAKPOINT_MAX]
Definition: kddata.c:96
unsigned int ULONG
Definition: retypes.h:1
#define KD_BREAKPOINT_ACTIVE
Definition: kd64.h:40

Referenced by KdpSuspendAllBreakPoints().

◆ KdpSwitchProcessor()

BOOLEAN NTAPI KdpSwitchProcessor ( IN PEXCEPTION_RECORD  ExceptionRecord,
IN OUT PCONTEXT  ContextRecord,
IN BOOLEAN  SecondChanceException 
)

Definition at line 1833 of file kdapi.c.

1836 {
1837  BOOLEAN Status;
1838 
1839  /* Save the port data */
1840  KdSave(FALSE);
1841 
1842  /* Report a state change */
1843  Status = KdpReportExceptionStateChange(ExceptionRecord,
1844  ContextRecord,
1845  SecondChanceException);
1846 
1847  /* Restore the port data and return */
1848  KdRestore(FALSE);
1849  return Status;
1850 }
NTSTATUS NTAPI KdRestore(IN BOOLEAN SleepTransition)
Definition: kdcom.c:121
BOOLEAN NTAPI KdpReportExceptionStateChange(IN PEXCEPTION_RECORD ExceptionRecord, IN OUT PCONTEXT Context, IN BOOLEAN SecondChanceException)
Definition: kdapi.c:1730
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
Status
Definition: gdiplustypes.h:24
_IRQL_requires_same_ _In_ PVOID _Inout_ struct _CONTEXT * ContextRecord
Definition: ntbasedef.h:655
NTSTATUS NTAPI KdSave(IN BOOLEAN SleepTransition)
Definition: kdcom.c:113

Referenced by KdInitSystem().

◆ KdpSymbol()

VOID NTAPI KdpSymbol ( IN PSTRING  DllPath,
IN PKD_SYMBOLS_INFO  SymbolInfo,
IN BOOLEAN  Unload,
IN KPROCESSOR_MODE  PreviousMode,
IN PCONTEXT  ContextRecord,
IN PKTRAP_FRAME  TrapFrame,
IN PKEXCEPTION_FRAME  ExceptionFrame 
)

Definition at line 176 of file kdprint.c.

183 {
184  BOOLEAN Enable;
185  PKPRCB Prcb = KeGetCurrentPrcb();
186 
187  /* Check if we need to do anything */
188  if ((PreviousMode != KernelMode) || (KdDebuggerNotPresent)) return;
189 
190  /* Enter the debugger */
191  Enable = KdEnterDebugger(TrapFrame, ExceptionFrame);
192 
193  /* Save the CPU Control State and save the context */
197  sizeof(CONTEXT));
198 
199  /* Report the new state */
201  SymbolInfo,
202  Unload,
204 
205  /* Restore the processor state */
208  sizeof(CONTEXT));
210 
211  /* Exit the debugger and return */
213 }
VOID NTAPI Unload(PDRIVER_OBJECT DriverObject)
Definition: csqtest.c:160
VOID NTAPI KdpMoveMemory(_In_ PVOID Destination, _In_ PVOID Source, _In_ SIZE_T Length)
Definition: kdapi.c:22
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1075
VOID NTAPI KdExitDebugger(IN BOOLEAN Enable)
Definition: kdapi.c:1924
BOOLEAN KdDebuggerNotPresent
Definition: kddata.c:82
CONTEXT ContextFrame
Definition: ketypes.h:531
unsigned char BOOLEAN
VOID NTAPI KiRestoreProcessorControlState(IN PKPROCESSOR_STATE ProcessorState)
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
VOID NTAPI KdpReportLoadSymbolsStateChange(IN PSTRING PathName, IN PKD_SYMBOLS_INFO SymbolInfo, IN BOOLEAN Unload, IN OUT PCONTEXT Context)
Definition: kdapi.c:1581
KPROCESSOR_STATE ProcessorState
Definition: ketypes.h:579
_IRQL_requires_same_ _In_ PVOID _Inout_ struct _CONTEXT * ContextRecord
Definition: ntbasedef.h:655
VOID NTAPI KiSaveProcessorControlState(OUT PKPROCESSOR_STATE ProcessorState)
Definition: cpu.c:375
static const char const char * DllPath
Definition: image.c:34
BOOLEAN NTAPI KdEnterDebugger(IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame)
Definition: kdapi.c:1871

Referenced by KdpTrap().

◆ KdpSysCheckLowMemory()

NTSTATUS NTAPI KdpSysCheckLowMemory ( IN ULONG  Flags)

Definition at line 356 of file kdx64.c.

357 {
359  return STATUS_UNSUCCESSFUL;
360 }
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define UNIMPLEMENTED_DBGBREAK(...)
Definition: debug.h:57

Referenced by KdpCheckLowMemory().

◆ KdpSysGetVersion()

VOID NTAPI KdpSysGetVersion ( IN PDBGKD_GET_VERSION64  Version)

Definition at line 428 of file kdapi.c.

429 {
430  /* Copy the version block */
433  sizeof(DBGKD_GET_VERSION64));
434 }
DBGKD_GET_VERSION64 KdVersionBlock
Definition: kddata.c:495
VOID NTAPI KdpMoveMemory(_In_ PVOID Destination, _In_ PVOID Source, _In_ SIZE_T Length)
Definition: kdapi.c:22
IN PVOID IN PVOID IN USHORT Version
Definition: pci.h:361

Referenced by KdpGetVersion().

◆ KdpSysReadBusData()

NTSTATUS NTAPI KdpSysReadBusData ( IN ULONG  BusDataType,
IN ULONG  BusNumber,
IN ULONG  SlotNumber,
IN ULONG  Offset,
IN PVOID  Buffer,
IN ULONG  Length,
OUT PULONG  ActualLength 
)

Definition at line 134 of file kdx64.c.

141 {
143  return STATUS_UNSUCCESSFUL;
144 }
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define UNIMPLEMENTED_DBGBREAK(...)
Definition: debug.h:57

Referenced by KdpGetBusData().

◆ KdpSysReadControlSpace()

NTSTATUS NTAPI KdpSysReadControlSpace ( IN ULONG  Processor,
IN ULONG64  BaseAddress,
IN PVOID  Buffer,
IN ULONG  Length,
OUT PULONG  ActualLength 
)

Definition at line 162 of file kdx64.c.

167 {
168  PVOID ControlStart;
170  PKIPCR Pcr = CONTAINING_RECORD(Prcb, KIPCR, Prcb);
171 
172  switch (BaseAddress)
173  {
175  /* Copy a pointer to the Pcr */
176  ControlStart = &Pcr;
177  *ActualLength = sizeof(PVOID);
178  break;
179 
181  /* Copy a pointer to the Prcb */
182  ControlStart = &Prcb;
183  *ActualLength = sizeof(PVOID);
184  break;
185 
187  /* Copy SpecialRegisters */
188  ControlStart = &Prcb->ProcessorState.SpecialRegisters;
189  *ActualLength = sizeof(KSPECIAL_REGISTERS);
190  break;
191 
193  /* Copy a pointer to the current Thread */
194  ControlStart = &Prcb->CurrentThread;
195  *ActualLength = sizeof(PVOID);
196  break;
197 
198  default:
199  *ActualLength = 0;
200  ASSERT(FALSE);
201  return STATUS_UNSUCCESSFUL;
202  }
203 
204  /* Copy the memory */
205  RtlCopyMemory(Buffer, ControlStart, min(Length, *ActualLength));
206 
207  /* Finish up */
208  return STATUS_SUCCESS;
209 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define AMD64_DEBUG_CONTROL_SPACE_KPCR
Definition: windbgkd.h:203
_In_ UCHAR Processor
Definition: kefuncs.h:682
KSPECIAL_REGISTERS SpecialRegisters
Definition: ketypes.h:530
#define AMD64_DEBUG_CONTROL_SPACE_KTHREAD
Definition: windbgkd.h:206
#define FALSE
Definition: types.h:117
struct _KTHREAD * CurrentThread
Definition: ketypes.h:566
Definition: bufpool.h:45
void * PVOID
Definition: retypes.h:9
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
#define ASSERT(a)
Definition: mode.c:45
KPROCESSOR_STATE ProcessorState
Definition: ketypes.h:579
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
struct _KSPECIAL_REGISTERS KSPECIAL_REGISTERS
PKPRCB KiProcessorBlock[]
Definition: krnlinit.c:32
#define min(a, b)
Definition: monoChain.cc:55
#define AMD64_DEBUG_CONTROL_SPACE_KSPECIAL
Definition: windbgkd.h:205
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_SUCCESS
Definition: shellext.h:65
#define AMD64_DEBUG_CONTROL_SPACE_KPRCB
Definition: windbgkd.h:204

Referenced by KdpReadControlSpace().

◆ KdpSysReadIoSpace()

NTSTATUS NTAPI KdpSysReadIoSpace ( IN ULONG  InterfaceType,
IN ULONG  BusNumber,
IN ULONG  AddressSpace,
IN ULONG64  IoAddress,
IN PVOID  DataValue,
IN ULONG  DataSize,
OUT PULONG  ActualDataSize 
)

Definition at line 108 of file kdarm.c.

115 {
117  return STATUS_UNSUCCESSFUL;
118 }
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define UNIMPLEMENTED_DBGBREAK(...)
Definition: debug.h:57

Referenced by KdpReadIoSpace(), and KdpReadIoSpaceExtended().

◆ KdpSysReadMsr()

NTSTATUS NTAPI KdpSysReadMsr ( IN ULONG  Msr,
OUT PLARGE_INTEGER  MsrValue 
)

Definition at line 96 of file kdx64.c.

98 {
99  /* Use SEH to protect from invalid MSRs */
100  _SEH2_TRY
101  {
102  MsrValue->QuadPart = __readmsr(Msr);
103  }
105  {
107  }
108  _SEH2_END;
109 
110  return STATUS_SUCCESS;
111 }
_SEH2_TRY
Definition: create.c:4226
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
PPC_QUAL unsigned long long __readmsr()
Definition: intrin_ppc.h:741
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
_SEH2_END
Definition: create.c:4400
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by KdpReadMachineSpecificRegister().

◆ KdpSysWriteBusData()

NTSTATUS NTAPI KdpSysWriteBusData ( IN ULONG  BusDataType,
IN ULONG  BusNumber,
IN ULONG  SlotNumber,
IN ULONG  Offset,
IN PVOID  Buffer,
IN ULONG  Length,
OUT PULONG  ActualLength 
)

Definition at line 148 of file kdx64.c.

155 {
157  return STATUS_UNSUCCESSFUL;
158 }
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define UNIMPLEMENTED_DBGBREAK(...)
Definition: debug.h:57

Referenced by KdpSetBusData().

◆ KdpSysWriteControlSpace()

NTSTATUS NTAPI KdpSysWriteControlSpace ( IN ULONG  Processor,
IN ULONG64  BaseAddress,
IN PVOID  Buffer,
IN ULONG  Length,
OUT PULONG  ActualLength 
)

Definition at line 213 of file kdx64.c.

218 {
219  PVOID ControlStart;
221 
222  switch (BaseAddress)
223  {
225  /* Copy SpecialRegisters */
226  ControlStart = &Prcb->ProcessorState.SpecialRegisters;
227  *ActualLength = sizeof(KSPECIAL_REGISTERS);
228  break;
229 
230  default:
231  *ActualLength = 0;
232  ASSERT(FALSE);
233  return STATUS_UNSUCCESSFUL;
234  }
235 
236  /* Copy the memory */
237  RtlCopyMemory(ControlStart, Buffer, min(Length, *ActualLength));
238 
239  return STATUS_SUCCESS;
240 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
_In_ UCHAR Processor
Definition: kefuncs.h:682
KSPECIAL_REGISTERS SpecialRegisters
Definition: ketypes.h:530
#define FALSE
Definition: types.h:117
Definition: bufpool.h:45
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
#define ASSERT(a)
Definition: mode.c:45
KPROCESSOR_STATE ProcessorState
Definition: ketypes.h:579
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
struct _KSPECIAL_REGISTERS KSPECIAL_REGISTERS
PKPRCB KiProcessorBlock[]
Definition: krnlinit.c:32
#define min(a, b)
Definition: monoChain.cc:55
#define AMD64_DEBUG_CONTROL_SPACE_KSPECIAL
Definition: windbgkd.h:205
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by KdpWriteControlSpace().

◆ KdpSysWriteIoSpace()

NTSTATUS NTAPI KdpSysWriteIoSpace ( IN ULONG  InterfaceType,
IN ULONG  BusNumber,
IN ULONG  AddressSpace,
IN ULONG64  IoAddress,
IN PVOID  DataValue,
IN ULONG  DataSize,
OUT PULONG  ActualDataSize 
)

Definition at line 300 of file kdx64.c.

307 {
308  /* Verify parameters */
309  if (InterfaceType != Isa || BusNumber != 0 || AddressSpace != 1)
310  {
311  /* No data was written */
312  *ActualDataSize = 0;
314  }
315 
316  /* Check for correct alignment */
317  if ((IoAddress & (DataSize - 1)))
318  {
319  /* Invalid alignment */
320  *ActualDataSize = 0;
322  }
323 
324  switch (DataSize)
325  {
326  case sizeof(UCHAR):
327  /* Write one UCHAR */
328  WRITE_PORT_UCHAR((PUCHAR)IoAddress, *(PUCHAR)DataValue);
329  break;
330 
331  case sizeof(USHORT):
332  /* Write one USHORT */
333  WRITE_PORT_USHORT((PUSHORT)IoAddress, *(PUSHORT)DataValue);
334  break;
335 
336  case sizeof(ULONG):
337  /* Write one ULONG */
338  WRITE_PORT_ULONG((PULONG)IoAddress, *(PULONG)DataValue);
339  break;
340 
341  default:
342  /* Invalid data size */
343  *ActualDataSize = 0;
345  }
346 
347  /* Return the size of the data */
348  *ActualDataSize = DataSize;
349 
350  /* Success! */
351  return STATUS_SUCCESS;
352 }
VOID NTAPI WRITE_PORT_USHORT(IN PUSHORT Port, IN USHORT Value)
Definition: portio.c:115
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG AddressSpace
Definition: iofuncs.h:2268
unsigned char * PUCHAR
Definition: retypes.h:3
VOID NTAPI WRITE_PORT_ULONG(IN PULONG Port, IN ULONG Value)
Definition: portio.c:123
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
unsigned char UCHAR
Definition: xmlstorage.h:181
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
unsigned short USHORT
Definition: pedump.c:61
unsigned int * PULONG
Definition: retypes.h:1
#define STATUS_DATATYPE_MISALIGNMENT
Definition: ntstatus.h:183
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_SUCCESS
Definition: shellext.h:65
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4751
unsigned short * PUSHORT
Definition: retypes.h:2
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID InterfaceType
Definition: wdffdo.h:461

Referenced by KdpWriteIoSpace(), and KdpWriteIoSpaceExtended().

◆ KdpSysWriteMsr()

NTSTATUS NTAPI KdpSysWriteMsr ( IN ULONG  Msr,
IN PLARGE_INTEGER  MsrValue 
)

Definition at line 115 of file kdx64.c.

117 {
118  /* Use SEH to protect from invalid MSRs */
119  _SEH2_TRY
120  {
121  __writemsr(Msr, MsrValue->QuadPart);
122  }
124  {
126  }
127  _SEH2_END;
128 
129  return STATUS_SUCCESS;
130 }
_SEH2_TRY
Definition: create.c:4226
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
PPC_QUAL void __writemsr(const unsigned long Value)
Definition: intrin_ppc.h:748
_SEH2_END
Definition: create.c:4400
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by KdpWriteMachineSpecificRegister().

◆ KdpTimeSlipDpcRoutine()

VOID NTAPI KdpTimeSlipDpcRoutine ( IN PKDPC  Dpc,
IN PVOID  DeferredContext,
IN PVOID  SystemArgument1,
IN PVOID  SystemArgument2 
)

Definition at line 1785 of file kdapi.c.

1789 {
1790  LONG OldSlip, NewSlip, PendingSlip;
1791 
1792  /* Get the current pending slip */
1793  PendingSlip = KdpTimeSlipPending;
1794  do
1795  {
1796  /* Save the old value and either disable or enable it now. */
1797  OldSlip = PendingSlip;
1798  NewSlip = OldSlip > 1 ? 1 : 0;
1799 
1800  /* Try to change the value */
1802  NewSlip,
1803  OldSlip) != OldSlip);
1804 
1805  /* If the New Slip value is 1, then do the Time Slipping */
1807 }
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
Definition: work.c:711
#define InterlockedCompareExchange
Definition: interlocked.h:104
LONG KdpTimeSlipPending
Definition: kddata.c:119
long LONG
Definition: pedump.c:60
WORK_QUEUE_ITEM KdpTimeSlipWorkItem
Definition: kddata.c:118

Referenced by KdInitSystem().

◆ KdpTimeSlipWork()

VOID NTAPI KdpTimeSlipWork ( IN PVOID  Context)

Definition at line 1811 of file kdapi.c.

1812 {
1813  KIRQL OldIrql;
1815 
1816  /* Update the System time from the CMOS */
1820 
1821  /* Check if we have a registered Time Slip Event and signal it */
1825 
1826  /* Delay the DPC until it runs next time */
1827  DueTime.QuadPart = -1800000000;
1829 }
VOID NTAPI ExReleaseTimeRefreshLock(VOID)
Definition: time.c:83
BOOLEAN NTAPI KeSetTimer(IN OUT PKTIMER Timer, IN LARGE_INTEGER DueTime, IN PKDPC Dpc OPTIONAL)
Definition: timerobj.c:281
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define FALSE
Definition: types.h:117
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
BOOLEAN NTAPI ExAcquireTimeRefreshLock(IN BOOLEAN Wait)
Definition: time.c:51
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
VOID NTAPI ExUpdateSystemTimeFromCmos(IN BOOLEAN UpdateInterruptTime, IN ULONG MaxSepInSeconds)
Definition: time.c:217
KDPC KdpTimeSlipDpc
Definition: kddata.c:116
PKEVENT KdpTimeSlipEvent
Definition: kddata.c:120
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
_In_ WDFTIMER _In_ LONGLONG DueTime
Definition: wdftimer.h:187
KSPIN_LOCK KdpTimeSlipEventLock
Definition: kddata.c:121
KTIMER KdpTimeSlipTimer
Definition: kddata.c:117

Referenced by KdInitSystem().

◆ KdpTrap()

BOOLEAN NTAPI KdpTrap ( IN PKTRAP_FRAME  TrapFrame,
IN PKEXCEPTION_FRAME  ExceptionFrame,
IN PEXCEPTION_RECORD  ExceptionRecord,
IN PCONTEXT  ContextRecord,
IN KPROCESSOR_MODE  PreviousMode,
IN BOOLEAN  SecondChanceException 
)

Definition at line 135 of file kdtrap.c.

141 {
142  BOOLEAN Unload;
143  ULONG_PTR ProgramCounter;
145  NTSTATUS ReturnStatus;
147 
148  /*
149  * Check if we got a STATUS_BREAKPOINT with a SubID for Print, Prompt or
150  * Load/Unload symbols. Make sure it isn't a software breakpoints as those
151  * are handled by KdpReport.
152  */
153  if ((ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT) &&
154  (ExceptionRecord->ExceptionInformation[0] != BREAKPOINT_BREAK))
155  {
156  /* Save Program Counter */
157  ProgramCounter = KeGetContextPc(ContextRecord);
158 
159  /* Check what kind of operation was requested from us */
160  Unload = FALSE;
161  switch (ExceptionRecord->ExceptionInformation[0])
162  {
163  /* DbgPrint */
164  case BREAKPOINT_PRINT:
165 
166  /* Call the worker routine */
167  ReturnStatus = KdpPrint((ULONG)KdpGetParameterThree(ContextRecord),
168  (ULONG)KdpGetParameterFour(ContextRecord),
169  (PCHAR)ExceptionRecord->ExceptionInformation[1],
170  (USHORT)ExceptionRecord->ExceptionInformation[2],
171  PreviousMode,
172  TrapFrame,
173  ExceptionFrame,
174  &Handled);
175 
176  /* Update the return value for the caller */
178  break;
179 
180  /* DbgPrompt */
181  case BREAKPOINT_PROMPT:
182 
183  /* Call the worker routine */
184  ReturnLength = KdpPrompt((PCHAR)ExceptionRecord->ExceptionInformation[1],
185  (USHORT)ExceptionRecord->ExceptionInformation[2],
186  (PCHAR)KdpGetParameterThree(ContextRecord),
187  (USHORT)KdpGetParameterFour(ContextRecord),
188  PreviousMode,
189  TrapFrame,
190  ExceptionFrame);
191  Handled = TRUE;
192 
193  /* Update the return value for the caller */
195  break;
196 
197  /* DbgUnLoadImageSymbols */
199 
200  /* Drop into the load case below, with the unload parameter */
201  Unload = TRUE;
202 
203  /* DbgLoadImageSymbols */
205 
206  /* Call the worker routine */
207  KdpSymbol((PSTRING)ExceptionRecord->ExceptionInformation[1],
208  (PKD_SYMBOLS_INFO)ExceptionRecord->ExceptionInformation[2],
209  Unload,
210  PreviousMode,
212  TrapFrame,
213  ExceptionFrame);
214  Handled = TRUE;
215  break;
216 
217  /* DbgCommandString */
219 
220  /* Call the worker routine */
221  KdpCommandString((PSTRING)ExceptionRecord->ExceptionInformation[1],
222  (PSTRING)ExceptionRecord->ExceptionInformation[2],
223  PreviousMode,
225  TrapFrame,
226  ExceptionFrame);
227  Handled = TRUE;
228  break;
229 
230  /* Anything else, do nothing */
231  default:
232 
233  /* Invalid debug service! Don't handle this! */
234  Handled = FALSE;
235  break;
236  }
237 
238  /*
239  * If the PC was not updated, we'll increment it ourselves so execution
240  * continues past the breakpoint.
241  */
242  if (ProgramCounter == KeGetContextPc(ContextRecord))
243  {
244  /* Update it */
246  ProgramCounter + KD_BREAKPOINT_SIZE);
247  }
248  }
249  else
250  {
251  /* Call the worker routine */
252  Handled = KdpReport(TrapFrame,
253  ExceptionFrame,
254  ExceptionRecord,
256  PreviousMode,
257  SecondChanceException);
258  }
259 
260  /* Return TRUE or FALSE to caller */
261  return Handled;
262 }
NTSTATUS NTAPI KdpPrint(_In_ ULONG ComponentId, _In_ ULONG Level, _In_reads_bytes_(Length) PCHAR String, _In_ USHORT Length, _In_ KPROCESSOR_MODE PreviousMode, _In_ PKTRAP_FRAME TrapFrame, _In_ PKEXCEPTION_FRAME ExceptionFrame, _Out_ PBOOLEAN Handled)
Definition: kdprint.c:358
signed char * PCHAR
Definition: retypes.h:7
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
VOID NTAPI Unload(PDRIVER_OBJECT DriverObject)
Definition: csqtest.c:160
#define TRUE
Definition: types.h:120
#define KeSetContextReturnRegister(Context, ReturnValue)
Definition: ke.h:139
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI KdpReport(IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame, IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT ContextRecord, IN KPROCESSOR_MODE PreviousMode, IN BOOLEAN SecondChanceException)
Definition: kdtrap.c:52
uint32_t ULONG_PTR
Definition: typedefs.h:65
VOID NTAPI KdpCommandString(IN PSTRING NameString, IN PSTRING CommandString, IN KPROCESSOR_MODE PreviousMode, IN PCONTEXT ContextRecord, IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame)
Definition: kdprint.c:137
#define FALSE
Definition: types.h:117
#define BREAKPOINT_UNLOAD_SYMBOLS
Definition: kdtypes.h:54
unsigned char BOOLEAN
#define STATUS_BREAKPOINT
Definition: ntstatus.h:184
#define KeGetContextPc(Context)
Definition: ke.h:124
#define BREAKPOINT_PROMPT
Definition: kdtypes.h:52
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
VOID NTAPI KdpSymbol(IN PSTRING DllPath, IN PKD_SYMBOLS_INFO SymbolInfo, IN BOOLEAN Unload, IN KPROCESSOR_MODE PreviousMode, IN PCONTEXT ContextRecord, IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame)
Definition: kdprint.c:176
_In_ BOOLEAN Handled
Definition: ketypes.h:337
_IRQL_requires_same_ _In_ PVOID _Inout_ struct _CONTEXT * ContextRecord
Definition: ntbasedef.h:655
#define BREAKPOINT_PRINT
Definition: kdtypes.h:51
unsigned short USHORT
Definition: pedump.c:61
USHORT NTAPI KdpPrompt(_In_reads_bytes_(PromptLength) PCHAR PromptString, _In_ USHORT PromptLength, _Out_writes_bytes_(MaximumResponseLength) PCHAR ResponseString, _In_ USHORT MaximumResponseLength, _In_ KPROCESSOR_MODE PreviousMode, _In_ PKTRAP_FRAME TrapFrame, _In_ PKEXCEPTION_FRAME ExceptionFrame)
Definition: kdprint.c:217
#define BREAKPOINT_LOAD_SYMBOLS
Definition: kdtypes.h:53
unsigned int ULONG
Definition: retypes.h:1
#define BREAKPOINT_COMMAND_STRING
Definition: kdtypes.h:55
#define KD_BREAKPOINT_SIZE
Definition: ke.h:118
#define KeSetContextPc(Context, ProgramCounter)
Definition: ke.h:127
#define BREAKPOINT_BREAK
Definition: kdtypes.h:50

Referenced by KdInitSystem(), and KdpStub().

◆ KdpZeroMemory()

VOID NTAPI KdpZeroMemory ( _In_ PVOID  Destination,
_In_ SIZE_T  Length 
)

Definition at line 37 of file kdapi.c.

40 {
41  PCHAR DestinationBytes;
42 
43  /* Zero the buffer 1 byte at a time */
44  DestinationBytes = Destination;
45  while (Length--) *DestinationBytes++ = 0;
46 }
signed char * PCHAR
Definition: retypes.h:7
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2937

Referenced by KdpReportCommandStringStateChange(), and KdpSetCommonState().

◆ KdSetOwedBreakpoints()

VOID NTAPI KdSetOwedBreakpoints ( VOID  )

Definition at line 105 of file kdbreak.c.

106 {
107  BOOLEAN Enable;
108  KD_BREAKPOINT_TYPE Content;
109  ULONG i;
111 
112  /* If we don't owe any breakpoints, just return */
113  if (!KdpOweBreakpoint) return;
114 
115  /* Enter the debugger */
117 
118  /*
119  * Suppose we succeed in setting all the breakpoints.
120  * If we fail to do so, the flag will be set again.
121  */
123 
124  /* Loop through current breakpoints and try to set or delete the pending ones */
125  for (i = 0; i < KD_BREAKPOINT_MAX; i++)
126  {
128  {
129  /*
130  * Set the breakpoint only if it is in kernel space, or if it is
131  * in user space and the active process context matches.
132  */
134  KdpBreakpointTable[i].DirectoryTableBase != KeGetCurrentThread()->ApcState.Process->DirectoryTableBase[0])
135  {
137  continue;
138  }
139 
140  /* Try to save the old instruction */
142  &Content,
144  0,
146  NULL);
147  if (!NT_SUCCESS(Status))
148  {
149  /* Memory is still inaccessible, breakpoint setting will be deferred again */
150  // KdpDprintf("Failed to set deferred breakpoint at address 0x%p\n",
151  // KdpBreakpointTable[i].Address);
153  continue;
154  }
155 
156  /* Check if we need to write the breakpoint */
158  {
159  /* Memory accessible, set the breakpoint */
160  KdpBreakpointTable[i].Content = Content;
161 
162  /* Write the breakpoint */
166  0,
168  NULL);
169  if (!NT_SUCCESS(Status))
170  {
171  /* This should never happen */
172  KdpDprintf("Unable to write deferred breakpoint to address 0x%p\n",
175  }
176  else
177  {
179  }
180 
181  continue;
182  }
183 
184  /* Check if we need to restore the original instruction */
186  {
187  /* Write it back */
189  &KdpBreakpointTable[i].Content,
191  0,
193  NULL);
194  if (!NT_SUCCESS(Status))
195  {
196  /* This should never happen */
197  KdpDprintf("Unable to delete deferred breakpoint at address 0x%p\n",
200  }
201  else
202  {
203  /* Check if the breakpoint is suspended */
205  {
207  }
208  else
209  {
210  /* Invalidate it */
212  }
213  }
214 
215  continue;
216  }
217  }
218  }
219 
220  /* Exit the debugger */
222 }
NTSTATUS NTAPI KdpCopyMemoryChunks(_In_ ULONG64 Address, _In_ PVOID Buffer, _In_ ULONG TotalSize, _In_ ULONG ChunkSize, _In_ ULONG Flags, _Out_opt_ PULONG ActualSize)
Definition: kdapi.c:50
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
#define KD_BREAKPOINT_SUSPENDED
Definition: kd64.h:42
VOID NTAPI KdExitDebugger(IN BOOLEAN Enable)
Definition: kdapi.c:1924
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define FALSE
Definition: types.h:117
BOOLEAN KdpOweBreakpoint
Definition: kddata.c:98
unsigned char BOOLEAN
static WCHAR Address[46]
Definition: ping.c:68
#define MMDBG_COPY_WRITE
Definition: mm.h:53
ULONG Flags
Definition: kd64.h:50
Status
Definition: gdiplustypes.h:24
#define KD_BREAKPOINT_PENDING
Definition: kd64.h:41
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define KD_HIGHEST_USER_BREAKPOINT_ADDRESS
Definition: kd64.h:35
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
KD_BREAKPOINT_TYPE Content
Definition: kd64.h:53
KD_BREAKPOINT_TYPE KdpBreakpointInstruction
Definition: kddata.c:97
#define KD_BREAKPOINT_MAX
Definition: kd64.h:23
#define KD_BREAKPOINT_TYPE
Definition: ke.h:117
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define MMDBG_COPY_UNSAFE
Definition: mm.h:55
_Out_ PKAPC_STATE ApcState
Definition: mm.h:1488
BREAKPOINT_ENTRY KdpBreakpointTable[KD_BREAKPOINT_MAX]
Definition: kddata.c:96
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
BOOLEAN NTAPI KdEnterDebugger(IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame)
Definition: kdapi.c:1871
#define KD_BREAKPOINT_SIZE
Definition: ke.h:118
#define KeGetCurrentThread
Definition: hal.h:44
#define KD_BREAKPOINT_EXPIRED
Definition: kd64.h:43
#define KdpDprintf(...)
Definition: mmdbg.c:19
#define KD_BREAKPOINT_ACTIVE
Definition: kd64.h:40

Referenced by KiTrap0EHandler().

◆ KdUpdateDataBlock()

VOID NTAPI KdUpdateDataBlock ( VOID  )

Definition at line 89 of file kdinit.c.

90 {
91  /* Update the KeUserCallbackDispatcher pointer */
94 }
PVOID KeUserCallbackDispatcher
Definition: ke.h:138
ULONG64 KeUserCallbackDispatcher
Definition: wdbgexts.h:188
KDDEBUGGER_DATA64 * KdDebuggerDataBlock
Definition: kdpacket.c:21
#define ULONG_PTR
Definition: config.h:101

Referenced by PspInitializeSystemDll().

Variable Documentation

◆ BreakpointsSuspended

BOOLEAN BreakpointsSuspended

Definition at line 99 of file kddata.c.

Referenced by KdpRestoreAllBreakpoints(), and KdpSuspendAllBreakPoints().

◆ Kd_ACPI_Mask

ULONG Kd_ACPI_Mask

Definition at line 168 of file kddata.c.

◆ Kd_ALPC_Mask

ULONG Kd_ALPC_Mask

Definition at line 252 of file kddata.c.

◆ Kd_AMLI_Mask

ULONG Kd_AMLI_Mask

Definition at line 169 of file kddata.c.

◆ Kd_APPCOMPAT_Mask

ULONG Kd_APPCOMPAT_Mask

Definition at line 270 of file kddata.c.

◆ Kd_AUTOCHK_Mask

ULONG Kd_AUTOCHK_Mask

Definition at line 187 of file kddata.c.

◆ Kd_BURNENG_Mask

ULONG Kd_BURNENG_Mask

Definition at line 193 of file kddata.c.

◆ Kd_CACHEMGR_Mask

ULONG Kd_CACHEMGR_Mask

Definition at line 274 of file kddata.c.

◆ Kd_CAPIMG_Mask

ULONG Kd_CAPIMG_Mask

Definition at line 304 of file kddata.c.

◆ Kd_CDAUDIO_Mask

ULONG Kd_CDAUDIO_Mask

Definition at line 150 of file kddata.c.

◆ Kd_CDROM_Mask

ULONG Kd_CDROM_Mask

Definition at line 151 of file kddata.c.

◆ Kd_CFR_Mask

ULONG Kd_CFR_Mask

Definition at line 276 of file kddata.c.

◆ Kd_CLASSPNP_Mask

ULONG Kd_CLASSPNP_Mask

Definition at line 152 of file kddata.c.

◆ Kd_CNG_Mask

ULONG Kd_CNG_Mask

Definition at line 287 of file kddata.c.

◆ Kd_CONFIG_Mask

ULONG Kd_CONFIG_Mask

Definition at line 158 of file kddata.c.

◆ Kd_COVERAGE_Mask

ULONG Kd_COVERAGE_Mask

Definition at line 273 of file kddata.c.

◆ Kd_CRASHDUMP_Mask

ULONG Kd_CRASHDUMP_Mask

Definition at line 149 of file kddata.c.

◆ Kd_CRASHDUMPXHCI_Mask

ULONG Kd_CRASHDUMPXHCI_Mask

Definition at line 297 of file kddata.c.

◆ Kd_DCOMSS_Mask

ULONG Kd_DCOMSS_Mask

Definition at line 188 of file kddata.c.

◆ Kd_DEFAULT_Mask

ULONG Kd_DEFAULT_Mask

Definition at line 245 of file kddata.c.

Referenced by NtQueryDebugFilterState(), and NtSetDebugFilterState().

◆ Kd_DFRGIFC_Mask

ULONG Kd_DFRGIFC_Mask

Definition at line 244 of file kddata.c.

◆ Kd_DFSC_Mask

ULONG Kd_DFSC_Mask

Definition at line 247 of file kddata.c.

◆ Kd_DISK_Mask

ULONG Kd_DISK_Mask

Definition at line 153 of file kddata.c.

◆ Kd_DMADMIN_Mask

ULONG Kd_DMADMIN_Mask

Definition at line 213 of file kddata.c.

◆ Kd_DMCONFIG_Mask

ULONG Kd_DMCONFIG_Mask

Definition at line 212 of file kddata.c.

◆ Kd_DMIO_Mask

ULONG Kd_DMIO_Mask

Definition at line 211 of file kddata.c.

◆ Kd_DMSERVER_Mask

ULONG Kd_DMSERVER_Mask

Definition at line 218 of file kddata.c.

◆ Kd_DMSYNTH_Mask

ULONG Kd_DMSYNTH_Mask

Definition at line 175 of file kddata.c.

◆ Kd_DRIVEEXTENDER_Mask

ULONG Kd_DRIVEEXTENDER_Mask

Definition at line 292 of file kddata.c.

◆ Kd_EMS_Mask

ULONG Kd_EMS_Mask

Definition at line 264 of file kddata.c.

◆ Kd_ENVIRON_Mask

ULONG Kd_ENVIRON_Mask

Definition at line 263 of file kddata.c.

◆ Kd_EXFAT_Mask

ULONG Kd_EXFAT_Mask

Definition at line 288 of file kddata.c.

◆ Kd_FASTFAT_Mask

ULONG Kd_FASTFAT_Mask

Definition at line 177 of file kddata.c.

◆ Kd_FCPORT_Mask

ULONG Kd_FCPORT_Mask

Definition at line 209 of file kddata.c.

◆ Kd_FDC_Mask

ULONG Kd_FDC_Mask

Definition at line 204 of file kddata.c.

◆ Kd_FILETRACE_Mask

ULONG Kd_FILETRACE_Mask

Definition at line 289 of file kddata.c.

◆ Kd_FLOPPY_Mask

ULONG Kd_FLOPPY_Mask

Definition at line 203 of file kddata.c.

◆ Kd_FLTMGR_Mask

ULONG Kd_FLTMGR_Mask

Definition at line 191 of file kddata.c.

◆ Kd_FLTREGRESS_Mask

ULONG Kd_FLTREGRESS_Mask

Definition at line 279 of file kddata.c.

◆ Kd_FSLIB_Mask

ULONG Kd_FSLIB_Mask

Definition at line 307 of file kddata.c.

◆ Kd_FSTUB_Mask

ULONG Kd_FSTUB_Mask

Definition at line 148 of file kddata.c.

◆ Kd_FUSION_Mask

ULONG Kd_FUSION_Mask

Definition at line 196 of file kddata.c.

◆ Kd_FVEVOL_Mask

ULONG Kd_FVEVOL_Mask

Definition at line 266 of file kddata.c.

◆ Kd_GPIO_Mask

ULONG Kd_GPIO_Mask

Definition at line 298 of file kddata.c.

◆ Kd_HALIA64_Mask

ULONG Kd_HALIA64_Mask

Definition at line 170 of file kddata.c.

◆ Kd_HEAP_Mask

ULONG Kd_HEAP_Mask

Definition at line 257 of file kddata.c.

◆ Kd_HPS_Mask

ULONG Kd_HPS_Mask

Definition at line 227 of file kddata.c.

◆ Kd_I8042PRT_Mask

ULONG Kd_I8042PRT_Mask

Definition at line 159 of file kddata.c.

◆ Kd_IDEP_Mask

ULONG Kd_IDEP_Mask

Definition at line 201 of file kddata.c.

◆ Kd_IDLETASK_Mask

ULONG Kd_IDLETASK_Mask

Definition at line 197 of file kddata.c.

◆ Kd_IHVAUDIO_Mask

ULONG Kd_IHVAUDIO_Mask

Definition at line 223 of file kddata.c.

◆ Kd_IHVBUS_Mask

ULONG Kd_IHVBUS_Mask

Definition at line 226 of file kddata.c.

◆ Kd_IHVDRIVER_Mask

ULONG Kd_IHVDRIVER_Mask

Definition at line 221 of file kddata.c.

◆ Kd_IHVNETWORK_Mask

ULONG Kd_IHVNETWORK_Mask

Definition at line 224 of file kddata.c.

◆ Kd_IHVSTREAMING_Mask

ULONG Kd_IHVSTREAMING_Mask

Definition at line 225 of file kddata.c.

◆ Kd_IHVVIDEO_Mask

ULONG Kd_IHVVIDEO_Mask

Definition at line 222 of file kddata.c.

◆ Kd_IMAPI_Mask

ULONG Kd_IMAPI_Mask

Definition at line 194 of file kddata.c.

◆ Kd_INFINIBAND_Mask

ULONG Kd_INFINIBAND_Mask

Definition at line 220 of file kddata.c.

◆ Kd_IOSTRESS_Mask

ULONG Kd_IOSTRESS_Mask

Definition at line 256 of file kddata.c.

◆ Kd_ISAPNP_Mask

ULONG Kd_ISAPNP_Mask

Definition at line 231 of file kddata.c.

◆ Kd_KBDCLASS_Mask

ULONG Kd_KBDCLASS_Mask

Definition at line 164 of file kddata.c.

◆ Kd_KBDHID_Mask

ULONG Kd_KBDHID_Mask

Definition at line 162 of file kddata.c.

◆ Kd_KSECDD_Mask

ULONG Kd_KSECDD_Mask

Definition at line 278 of file kddata.c.

◆ Kd_KTM_Mask

ULONG Kd_KTM_Mask

Definition at line 255 of file kddata.c.

◆ Kd_LDR_Mask

ULONG Kd_LDR_Mask

Definition at line 229 of file kddata.c.

◆ Kd_LSASS_Mask

ULONG Kd_LSASS_Mask

Definition at line 285 of file kddata.c.

◆ Kd_LSERMOUS_Mask

ULONG Kd_LSERMOUS_Mask

Definition at line 161 of file kddata.c.

◆ Kd_LUAFV_Mask

ULONG Kd_LUAFV_Mask

Definition at line 269 of file kddata.c.

◆ Kd_MCHGR_Mask

ULONG Kd_MCHGR_Mask

Definition at line 200 of file kddata.c.

◆ Kd_MM_Mask

ULONG Kd_MM_Mask

Definition at line 246 of file kddata.c.

◆ Kd_MMCSS_Mask

ULONG Kd_MMCSS_Mask

Definition at line 260 of file kddata.c.

◆ Kd_MOUCLASS_Mask

ULONG Kd_MOUCLASS_Mask

Definition at line 165 of file kddata.c.

◆ Kd_MOUHID_Mask

ULONG Kd_MOUHID_Mask

Definition at line 163 of file kddata.c.

◆ Kd_MOUNTMGR_Mask

ULONG Kd_MOUNTMGR_Mask

Definition at line 275 of file kddata.c.

◆ Kd_MPIO_Mask

ULONG Kd_MPIO_Mask

Definition at line 280 of file kddata.c.

◆ Kd_MSDSM_Mask

ULONG Kd_MSDSM_Mask

Definition at line 281 of file kddata.c.

◆ Kd_NDIS_Mask

ULONG Kd_NDIS_Mask

Definition at line 267 of file kddata.c.

◆ Kd_NETAPI_Mask

ULONG Kd_NETAPI_Mask

Definition at line 180 of file kddata.c.

◆ Kd_NTFS_Mask

ULONG Kd_NTFS_Mask

Definition at line 147 of file kddata.c.

◆ Kd_NTOSPNP_Mask

ULONG Kd_NTOSPNP_Mask

Definition at line 176 of file kddata.c.

◆ Kd_NVCTRACE_Mask

ULONG Kd_NVCTRACE_Mask

Definition at line 268 of file kddata.c.

◆ Kd_PCI_Mask

ULONG Kd_PCI_Mask

Definition at line 210 of file kddata.c.

◆ Kd_PCIIDE_Mask

ULONG Kd_PCIIDE_Mask

Definition at line 202 of file kddata.c.

◆ Kd_PERFLIB_Mask

ULONG Kd_PERFLIB_Mask

Definition at line 254 of file kddata.c.

◆ Kd_PNPMEM_Mask

ULONG Kd_PNPMEM_Mask

Definition at line 216 of file kddata.c.

◆ Kd_PNPMGR_Mask

ULONG Kd_PNPMGR_Mask

Definition at line 179 of file kddata.c.

◆ Kd_POWER_Mask

ULONG Kd_POWER_Mask

Definition at line 296 of file kddata.c.

◆ Kd_PREFETCHER_Mask

ULONG Kd_PREFETCHER_Mask

Definition at line 207 of file kddata.c.

◆ Kd_PRINTSPOOLER_Mask

ULONG Kd_PRINTSPOOLER_Mask

Definition at line 235 of file kddata.c.

◆ Kd_PROCESSOR_Mask

ULONG Kd_PROCESSOR_Mask

Definition at line 217 of file kddata.c.

◆ Kd_PSHED_Mask

ULONG Kd_PSHED_Mask

Definition at line 283 of file kddata.c.

◆ Kd_REDBOOK_Mask

ULONG Kd_REDBOOK_Mask

Definition at line 154 of file kddata.c.

◆ Kd_REFS_Mask

ULONG Kd_REFS_Mask

Definition at line 299 of file kddata.c.

◆ Kd_RPCPROXY_Mask

ULONG Kd_RPCPROXY_Mask

Definition at line 186 of file kddata.c.

◆ Kd_RSFILTER_Mask

ULONG Kd_RSFILTER_Mask

Definition at line 208 of file kddata.c.

◆ Kd_RTLTHREADPOOL_Mask

ULONG Kd_RTLTHREADPOOL_Mask

Definition at line 228 of file kddata.c.

◆ Kd_SAMSS_Mask

ULONG Kd_SAMSS_Mask

Definition at line 178 of file kddata.c.

◆ Kd_SBP2PORT_Mask

ULONG Kd_SBP2PORT_Mask

Definition at line 272 of file kddata.c.

◆ Kd_SCCLIENT_Mask

ULONG Kd_SCCLIENT_Mask

Definition at line 182 of file kddata.c.

◆ Kd_SCSERVER_Mask

ULONG Kd_SCSERVER_Mask

Definition at line 181 of file kddata.c.

◆ Kd_SCSIMINIPORT_Mask

ULONG Kd_SCSIMINIPORT_Mask

Definition at line 157 of file kddata.c.

◆ Kd_SCSIPORT_Mask

ULONG Kd_SCSIPORT_Mask

Definition at line 156 of file kddata.c.

◆ Kd_SE_Mask

ULONG Kd_SE_Mask

Definition at line 291 of file kddata.c.

◆ Kd_SERENUM_Mask

ULONG Kd_SERENUM_Mask

Definition at line 184 of file kddata.c.

◆ Kd_SERIAL_Mask

ULONG Kd_SERIAL_Mask

Definition at line 183 of file kddata.c.

◆ Kd_SERMOUSE_Mask

ULONG Kd_SERMOUSE_Mask

Definition at line 160 of file kddata.c.

◆ Kd_SETUP_Mask

ULONG Kd_SETUP_Mask

Definition at line 146 of file kddata.c.

◆ Kd_SHPC_Mask

ULONG Kd_SHPC_Mask

Definition at line 232 of file kddata.c.

◆ Kd_SIS_Mask

ULONG Kd_SIS_Mask

Definition at line 190 of file kddata.c.

◆ Kd_SMSS_Mask

ULONG Kd_SMSS_Mask

Definition at line 145 of file kddata.c.

◆ Kd_SOFTPCI_Mask

ULONG Kd_SOFTPCI_Mask

Definition at line 198 of file kddata.c.

◆ Kd_SR_Mask

ULONG Kd_SR_Mask

Definition at line 219 of file kddata.c.

◆ Kd_SSPICLI_Mask

ULONG Kd_SSPICLI_Mask

Definition at line 286 of file kddata.c.

◆ Kd_STORAGECLASSMEMORY_Mask

ULONG Kd_STORAGECLASSMEMORY_Mask

Definition at line 306 of file kddata.c.

◆ Kd_STORMINIPORT_Mask

ULONG Kd_STORMINIPORT_Mask

Definition at line 234 of file kddata.c.

◆ Kd_STORPORT_Mask

ULONG Kd_STORPORT_Mask

Definition at line 233 of file kddata.c.

◆ Kd_STORPROP_Mask

ULONG Kd_STORPROP_Mask

Definition at line 155 of file kddata.c.

◆ Kd_STORVSP_Mask

ULONG Kd_STORVSP_Mask

Definition at line 284 of file kddata.c.

◆ Kd_SVCHOST_Mask

ULONG Kd_SVCHOST_Mask

Definition at line 172 of file kddata.c.

◆ Kd_SXS_Mask

ULONG Kd_SXS_Mask

Definition at line 195 of file kddata.c.

◆ Kd_SYSTEM_Mask

ULONG Kd_SYSTEM_Mask

Definition at line 144 of file kddata.c.

◆ Kd_TAPE_Mask

ULONG Kd_TAPE_Mask

Definition at line 199 of file kddata.c.

◆ Kd_TCPIP6_Mask

ULONG Kd_TCPIP6_Mask

Definition at line 230 of file kddata.c.

◆ Kd_TCPIP_Mask

ULONG Kd_TCPIP_Mask

Definition at line 174 of file kddata.c.

◆ Kd_TERMSRV_Mask

ULONG Kd_TERMSRV_Mask

Definition at line 205 of file kddata.c.

◆ Kd_THREADORDER_Mask

ULONG Kd_THREADORDER_Mask

Definition at line 262 of file kddata.c.

◆ Kd_TPM_Mask

ULONG Kd_TPM_Mask

Definition at line 261 of file kddata.c.

◆ Kd_TWOTRACK_Mask

ULONG Kd_TWOTRACK_Mask

Definition at line 166 of file kddata.c.

◆ Kd_TXF_Mask

ULONG Kd_TXF_Mask

Definition at line 277 of file kddata.c.

◆ Kd_UDFS_Mask

ULONG Kd_UDFS_Mask

Definition at line 282 of file kddata.c.

◆ Kd_UHCD_Mask

ULONG Kd_UHCD_Mask

Definition at line 185 of file kddata.c.

◆ Kd_UNIMODEM_Mask

ULONG Kd_UNIMODEM_Mask

Definition at line 189 of file kddata.c.

◆ Kd_USBSTOR_Mask

ULONG Kd_USBSTOR_Mask

Definition at line 271 of file kddata.c.

◆ Kd_USERGDI_Mask

ULONG Kd_USERGDI_Mask

Definition at line 259 of file kddata.c.

◆ Kd_VDS_Mask

ULONG Kd_VDS_Mask

Definition at line 238 of file kddata.c.

◆ Kd_VDSBAS_Mask

ULONG Kd_VDSBAS_Mask

Definition at line 239 of file kddata.c.

◆ Kd_VDSDYN_Mask

ULONG Kd_VDSDYN_Mask

Definition at line 240 of file kddata.c.

◆ Kd_VDSDYNDR_Mask

ULONG Kd_VDSDYNDR_Mask

Definition at line 241 of file kddata.c.

◆ Kd_VDSLDR_Mask

ULONG Kd_VDSLDR_Mask

Definition at line 242 of file kddata.c.

◆ Kd_VDSUTIL_Mask

ULONG Kd_VDSUTIL_Mask

Definition at line 243 of file kddata.c.

◆ Kd_VERIFIER_Mask

ULONG Kd_VERIFIER_Mask

Definition at line 237 of file kddata.c.

◆ Kd_VIDEO_Mask

ULONG Kd_VIDEO_Mask

Definition at line 171 of file kddata.c.

◆ Kd_VIDEOPRT_Mask

ULONG Kd_VIDEOPRT_Mask

Definition at line 173 of file kddata.c.

◆ Kd_VPCI_Mask

ULONG Kd_VPCI_Mask

Definition at line 305 of file kddata.c.

◆ Kd_VSS_Mask

ULONG Kd_VSS_Mask

Definition at line 215 of file kddata.c.

◆ Kd_VSSDYNDISK_Mask

ULONG Kd_VSSDYNDISK_Mask

Definition at line 236 of file kddata.c.

◆ Kd_W32TIME_Mask

ULONG Kd_W32TIME_Mask

Definition at line 206 of file kddata.c.

◆ Kd_WDI_Mask

ULONG Kd_WDI_Mask

Definition at line 253 of file kddata.c.

◆ Kd_WDT_Mask

ULONG Kd_WDT_Mask

Definition at line 265 of file kddata.c.

◆ Kd_WER_Mask

ULONG Kd_WER_Mask

Definition at line 300 of file kddata.c.

◆ Kd_WHEA_Mask

ULONG Kd_WHEA_Mask

Definition at line 258 of file kddata.c.

◆ Kd_WIN2000_Mask

ULONG Kd_WIN2000_Mask

Definition at line 143 of file kddata.c.

Referenced by NtQueryDebugFilterState(), and NtSetDebugFilterState().

◆ Kd_WMICORE_Mask

ULONG Kd_WMICORE_Mask

Definition at line 192 of file kddata.c.

◆ Kd_WMILIB_Mask

ULONG Kd_WMILIB_Mask

Definition at line 167 of file kddata.c.

◆ Kd_WOW64_Mask

ULONG Kd_WOW64_Mask

Definition at line 248 of file kddata.c.

◆ Kd_WSOCKTRANSPORT_Mask

ULONG Kd_WSOCKTRANSPORT_Mask

Definition at line 214 of file kddata.c.

◆ Kd_XSAVE_Mask

ULONG Kd_XSAVE_Mask

Definition at line 290 of file kddata.c.

◆ KdAutoEnableOnEvent

BOOLEAN KdAutoEnableOnEvent

Definition at line 84 of file kddata.c.

Referenced by KdInitSystem(), and KdpStub().

◆ KdBlockEnable

BOOLEAN KdBlockEnable

◆ KdBreakAfterSymbolLoad

BOOLEAN KdBreakAfterSymbolLoad

Definition at line 80 of file kddata.c.

Referenced by ExpInitializeExecutive(), and KdInitSystem().

◆ KdComponentTable

Definition at line 314 of file kddata.c.

Referenced by NtQueryDebugFilterState(), and NtSetDebugFilterState().

◆ KdComponentTableSize

ULONG KdComponentTableSize

Definition at line 484 of file kddata.c.

Referenced by NtQueryDebugFilterState(), and NtSetDebugFilterState().

◆ KdDebuggerDataBlock

KDDEBUGGER_DATA64 KdDebuggerDataBlock

Definition at line 21 of file kdpacket.c.

Referenced by GetVersionSendHandler().

◆ KdDisableCount

ULONG KdDisableCount

Definition at line 90 of file kddata.c.

Referenced by KdDisableDebuggerWithLock(), and KdEnableDebuggerWithLock().

◆ KdEnteredDebugger

BOOLEAN KdEnteredDebugger

Definition at line 89 of file kddata.c.

Referenced by KdEnterDebugger().

◆ KdIgnoreUmExceptions

BOOLEAN KdIgnoreUmExceptions

Definition at line 86 of file kddata.c.

Referenced by KdInitSystem(), and KiDispatchException().

◆ KdpBreakpointInstruction

KD_BREAKPOINT_TYPE KdpBreakpointInstruction

◆ KdpBreakpointTable

◆ KdpContext

◆ KdpContextSent

BOOLEAN KdpContextSent

◆ KdpControlCPressed

BOOLEAN KdpControlCPressed

Definition at line 68 of file kddata.c.

Referenced by KdPollBreakIn(), and KdpReport().

◆ KdpCurrentSymbolEnd

ULONG_PTR KdpCurrentSymbolEnd

Definition at line 105 of file kddata.c.

Referenced by KdpGetStateChange().

◆ KdpCurrentSymbolStart

ULONG_PTR KdpCurrentSymbolStart

Definition at line 105 of file kddata.c.

Referenced by KdpGetStateChange().

◆ KdpDataSpinLock

KSPIN_LOCK KdpDataSpinLock

Definition at line 490 of file kddata.c.

Referenced by KdRegisterDebuggerDataBlock().

◆ KdpDebuggerDataListHead

LIST_ENTRY KdpDebuggerDataListHead

Definition at line 489 of file kddata.c.

Referenced by KdInitSystem(), and KdRegisterDebuggerDataBlock().

◆ KdpDebuggerLock

KSPIN_LOCK KdpDebuggerLock

Definition at line 67 of file kddata.c.

Referenced by KdEnterDebugger(), KdPollBreakIn(), KdpPortLock(), and KdpPortUnlock().

◆ KdpDebuggerStructuresInitialized

BOOLEAN KdpDebuggerStructuresInitialized

Definition at line 88 of file kddata.c.

Referenced by KdInitSystem().

◆ KdPerformanceCounterRate

LARGE_INTEGER KdPerformanceCounterRate

Definition at line 91 of file kddata.c.

Referenced by KdInitSystem().

◆ KdPitchDebugger

◆ KdpMessageBuffer

CHAR KdpMessageBuffer[0x1000]

◆ KdpNumInternalBreakpoints

ULONG KdpNumInternalBreakpoints

Definition at line 100 of file kddata.c.

Referenced by KdpSendWaitContinue().

◆ KdpOweBreakpoint

◆ KdpPathBuffer

CHAR KdpPathBuffer[0x1000]

Definition at line 128 of file kddata.c.

Referenced by KdpReportLoadSymbolsStateChange().

◆ KdpPortLocked

BOOLEAN KdpPortLocked

Definition at line 66 of file kddata.c.

Referenced by KdEnterDebugger(), and KdExitDebugger().

◆ KdPreviouslyEnabled

BOOLEAN KdPreviouslyEnabled

Definition at line 87 of file kddata.c.

Referenced by KdDisableDebuggerWithLock(), KdEnableDebuggerWithLock(), and KdpStub().

◆ KdPrintDefaultCircularBuffer

CHAR KdPrintDefaultCircularBuffer[KD_DEFAULT_LOG_BUFFER_SIZE]

Definition at line 133 of file kddata.c.

◆ KdpTimeSlipDpc

KDPC KdpTimeSlipDpc

Definition at line 116 of file kddata.c.

Referenced by KdExitDebugger(), KdInitSystem(), and KdpTimeSlipWork().

◆ KdpTimeSlipEvent

PKEVENT KdpTimeSlipEvent

Definition at line 120 of file kddata.c.

Referenced by KdpTimeSlipWork().

◆ KdpTimeSlipEventLock

KSPIN_LOCK KdpTimeSlipEventLock

Definition at line 121 of file kddata.c.

Referenced by KdpTimeSlipWork().

◆ KdpTimeSlipPending

LONG KdpTimeSlipPending

Definition at line 119 of file kddata.c.

Referenced by KdExitDebugger(), KdpTimeSlipDpcRoutine(), and Phase1InitializationDiscard().

◆ KdpTimeSlipTimer

KTIMER KdpTimeSlipTimer

Definition at line 117 of file kddata.c.

Referenced by KdInitSystem(), and KdpTimeSlipWork().

◆ KdpTimeSlipWorkItem

WORK_QUEUE_ITEM KdpTimeSlipWorkItem

Definition at line 118 of file kddata.c.

Referenced by KdInitSystem(), and KdpTimeSlipDpcRoutine().

◆ KdTimerDifference

LARGE_INTEGER KdTimerDifference

Definition at line 122 of file kddata.c.

Referenced by KdEnterDebugger().

◆ KdTimerStart

LARGE_INTEGER KdTimerStart

Definition at line 548 of file kd64.h.

Referenced by KdEnterDebugger(), KdExitDebugger(), and KdInitSystem().

◆ KdTimerStop

LARGE_INTEGER KdTimerStop

Definition at line 122 of file kddata.c.

Referenced by KdEnterDebugger(), and KdExitDebugger().

◆ KdVersionBlock

DBGKD_GET_VERSION64 KdVersionBlock

Definition at line 495 of file kddata.c.

Referenced by KdInitSystem(), KdpSysGetVersion(), and KiDispatchException().

◆ KiDebugRoutine

PKDEBUG_ROUTINE KiDebugRoutine

Definition at line 74 of file kddata.c.

Referenced by KdDisableDebuggerWithLock(), KdInitSystem(), and KiDispatchException().

◆ KiDebugSwitchRoutine

PKDEBUG_SWITCH_ROUTINE KiDebugSwitchRoutine

Definition at line 75 of file kddata.c.

Referenced by KdInitSystem().

◆ TraceDataBuffer

ULONG TraceDataBuffer[40]

Definition at line 110 of file kddata.c.

Referenced by DumpTraceData().

◆ TraceDataBufferPosition

ULONG TraceDataBufferPosition

Definition at line 111 of file kddata.c.

Referenced by DumpTraceData().