Skip to content

Commit d711768

Browse files
committed
[NTOS:KD] Merge some more functions with kd64
Functions are KdIsThisAKdTrap, KdUpdateDataBlock, KdEnterDebugger, KdExitDebugger, KdRefreshDebuggerNotPresent, KdDisableDebugger, KdEnableDebuggerWithLock, KdEnableDebugger, KdSystemDebugControl
1 parent 858846e commit d711768

File tree

4 files changed

+100
-237
lines changed

4 files changed

+100
-237
lines changed

ntoskrnl/kd/kdmain.c

Lines changed: 1 addition & 225 deletions
Original file line numberDiff line numberDiff line change
@@ -45,117 +45,13 @@
4545

4646
/* VARIABLES ***************************************************************/
4747

48-
BOOLEAN KdDebuggerEnabled = FALSE;
49-
BOOLEAN KdEnteredDebugger = FALSE;
50-
BOOLEAN KdDebuggerNotPresent = TRUE;
51-
BOOLEAN KdBreakAfterSymbolLoad = FALSE;
52-
BOOLEAN KdPitchDebugger = TRUE;
53-
BOOLEAN KdIgnoreUmExceptions = FALSE;
54-
5548
VOID NTAPI PspDumpThreads(BOOLEAN SystemThreads);
5649

57-
#if 0
58-
ULONG Kd_DEFAULT_MASK = 1 << DPFLTR_ERROR_LEVEL;
59-
#endif
60-
6150
extern CPPORT PortInfo;
6251
extern ANSI_STRING KdpLogFileName;
6352

6453
/* PRIVATE FUNCTIONS *********************************************************/
6554

66-
ULONG
67-
NTAPI
68-
KdpServiceDispatcher(ULONG Service,
69-
PVOID Buffer1,
70-
ULONG Buffer1Length,
71-
KPROCESSOR_MODE PreviousMode)
72-
{
73-
ULONG Result = 0;
74-
75-
switch (Service)
76-
{
77-
case BREAKPOINT_PRINT: /* DbgPrint */
78-
{
79-
/* Call KDBG */
80-
BOOLEAN Handled;
81-
Result = KdpPrint(MAXULONG,
82-
DPFLTR_INFO_LEVEL,
83-
(PCHAR)Buffer1,
84-
(USHORT)Buffer1Length,
85-
PreviousMode,
86-
NULL, // TrapFrame,
87-
NULL, // ExceptionFrame,
88-
&Handled);
89-
break;
90-
}
91-
92-
#if DBG
93-
case ' soR': /* ROS-INTERNAL */
94-
{
95-
switch ((ULONG_PTR)Buffer1)
96-
{
97-
case DumpAllThreads:
98-
PspDumpThreads(TRUE);
99-
break;
100-
101-
case DumpUserThreads:
102-
PspDumpThreads(FALSE);
103-
break;
104-
105-
case KdSpare3:
106-
MmDumpArmPfnDatabase(FALSE);
107-
break;
108-
109-
default:
110-
break;
111-
}
112-
break;
113-
}
114-
115-
#if defined(_M_IX86) && !defined(_WINKD_) // See ke/i386/traphdlr.c
116-
/* Register a debug callback */
117-
case 'CsoR':
118-
{
119-
switch (Buffer1Length)
120-
{
121-
case ID_Win32PreServiceHook:
122-
KeWin32PreServiceHook = Buffer1;
123-
break;
124-
125-
case ID_Win32PostServiceHook:
126-
KeWin32PostServiceHook = Buffer1;
127-
break;
128-
129-
}
130-
break;
131-
}
132-
#endif
133-
134-
/* Special case for stack frame dumps */
135-
case 'DsoR':
136-
{
137-
KeRosDumpStackFrames((PULONG_PTR)Buffer1, Buffer1Length);
138-
break;
139-
}
140-
141-
#if defined(KDBG)
142-
/* Register KDBG CLI callback */
143-
case 'RbdK':
144-
{
145-
Result = KdbRegisterCliCallback(Buffer1, Buffer1Length);
146-
break;
147-
}
148-
#endif /* KDBG */
149-
#endif /* DBG */
150-
default:
151-
DPRINT1("Invalid debug service call!\n");
152-
HalDisplayString("Invalid debug service call!\r\n");
153-
break;
154-
}
155-
156-
return Result;
157-
}
158-
15955
BOOLEAN
16056
NTAPI
16157
KdpTrap(IN PKTRAP_FRAME TrapFrame,
@@ -309,129 +205,9 @@ KdpStub(IN PKTRAP_FRAME TrapFrame,
309205
SecondChanceException);
310206
}
311207

312-
BOOLEAN
313-
NTAPI
314-
KdIsThisAKdTrap(IN PEXCEPTION_RECORD ExceptionRecord,
315-
IN PCONTEXT Context,
316-
IN KPROCESSOR_MODE PreviousMode)
317-
{
318-
/* KDBG has its own mechanism for ignoring user mode exceptions */
319-
return FALSE;
320-
}
321-
322208
/* PUBLIC FUNCTIONS *********************************************************/
323209

324-
VOID
325-
NTAPI
326-
KdUpdateDataBlock(VOID)
327-
{
328-
}
329-
330-
BOOLEAN
331-
NTAPI
332-
KdEnterDebugger(IN PKTRAP_FRAME TrapFrame,
333-
IN PKEXCEPTION_FRAME ExceptionFrame)
334-
{
335-
return FALSE;
336-
}
337-
338-
VOID
339-
NTAPI
340-
KdExitDebugger(IN BOOLEAN Enable)
341-
{
342-
}
343-
344-
/*
345-
* @implemented
346-
*/
347-
BOOLEAN
348-
NTAPI
349-
KdRefreshDebuggerNotPresent(VOID)
350-
{
351-
UNIMPLEMENTED;
352-
353-
/* Just return whatever was set previously -- FIXME! */
354-
return KdDebuggerNotPresent;
355-
}
356-
357-
/*
358-
* @implemented
359-
*/
360-
NTSTATUS
361-
NTAPI
362-
KdDisableDebugger(VOID)
363-
{
364-
KIRQL OldIrql;
365-
366-
/* Raise IRQL */
367-
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
368-
369-
/* TODO: Disable any breakpoints */
370-
371-
/* Disable the Debugger */
372-
KdDebuggerEnabled = FALSE;
373-
SharedUserData->KdDebuggerEnabled = FALSE;
374-
375-
/* Lower the IRQL */
376-
KeLowerIrql(OldIrql);
377-
378-
/* Return success */
379-
return STATUS_SUCCESS;
380-
}
381-
382-
NTSTATUS
383-
NTAPI
384-
KdEnableDebuggerWithLock(IN BOOLEAN NeedLock)
385-
{
386-
return STATUS_ACCESS_DENIED;
387-
}
388-
389-
/*
390-
* @implemented
391-
*/
392-
NTSTATUS
393-
NTAPI
394-
KdEnableDebugger(VOID)
395-
{
396-
KIRQL OldIrql;
397-
398-
/* Raise IRQL */
399-
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
400-
401-
/* TODO: Re-enable any breakpoints */
402-
403-
/* Enable the Debugger */
404-
KdDebuggerEnabled = TRUE;
405-
SharedUserData->KdDebuggerEnabled = TRUE;
406-
407-
/* Lower the IRQL */
408-
KeLowerIrql(OldIrql);
409-
410-
/* Return success */
411-
return STATUS_SUCCESS;
412-
}
413-
414-
/*
415-
* @unimplemented
416-
*/
417-
NTSTATUS
418-
NTAPI
419-
KdSystemDebugControl(IN SYSDBG_COMMAND Command,
420-
IN PVOID InputBuffer,
421-
IN ULONG InputBufferLength,
422-
OUT PVOID OutputBuffer,
423-
IN ULONG OutputBufferLength,
424-
IN OUT PULONG ReturnLength,
425-
IN KPROCESSOR_MODE PreviousMode)
426-
{
427-
/* HACK */
428-
return KdpServiceDispatcher(Command,
429-
InputBuffer,
430-
InputBufferLength,
431-
PreviousMode);
432-
}
433-
434-
PCHAR
210+
static PCHAR
435211
NTAPI
436212
KdpGetDebugMode(PCHAR Currentp2)
437213
{

0 commit comments

Comments
 (0)