ReactOS 0.4.16-dev-732-g2d1144a
kdinit.c File Reference
#include <ntoskrnl.h>
#include <reactos/buildno.h>
#include <debug.h>
#include <mm/ARM3/miarm.h>
Include dependency graph for kdinit.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define DbgPrint(fmt, ...)   (KdpDprintf(fmt, ##__VA_ARGS__), 0)
 
#define DbgPrintEx(cmpid, lvl, fmt, ...)   (KdpDprintf(fmt, ##__VA_ARGS__), 0)
 

Functions

static SIZE_T KdpGetMemorySizeInMBs (_In_opt_ PLOADER_PARAMETER_BLOCK LoaderBlock)
 Retrieves the total size of the memory before Mm is initialized, by counting the number of physical pages. Useful for debug logging.
 
static VOID KdpPrintBanner (VOID)
 Displays the kernel debugger initialization banner.
 
VOID NTAPI KdUpdateDataBlock (VOID)
 
BOOLEAN NTAPI KdRegisterDebuggerDataBlock (IN ULONG Tag, IN PDBGKD_DEBUG_DATA_HEADER64 DataHeader, IN ULONG Size)
 
BOOLEAN NTAPI KdInitSystem (_In_ ULONG BootPhase, _In_opt_ PLOADER_PARAMETER_BLOCK LoaderBlock)
 

Macro Definition Documentation

◆ DbgPrint

#define DbgPrint (   fmt,
  ... 
)    (KdpDprintf(fmt, ##__VA_ARGS__), 0)

Definition at line 23 of file kdinit.c.

◆ DbgPrintEx

#define DbgPrintEx (   cmpid,
  lvl,
  fmt,
  ... 
)    (KdpDprintf(fmt, ##__VA_ARGS__), 0)

Definition at line 24 of file kdinit.c.

◆ NDEBUG

#define NDEBUG

Definition at line 15 of file kdinit.c.

Function Documentation

◆ KdInitSystem()

BOOLEAN NTAPI KdInitSystem ( _In_ ULONG  BootPhase,
_In_opt_ PLOADER_PARAMETER_BLOCK  LoaderBlock 
)

Definition at line 164 of file kdinit.c.

167{
168 BOOLEAN EnableKd, DisableKdAfterInit = FALSE, BlockEnable = FALSE;
169 PLDR_DATA_TABLE_ENTRY LdrEntry;
170 ULONG i;
171
172 /* Check if this is Phase 1 */
173 if (BootPhase)
174 {
175 /* Just query the performance counter */
177 return TRUE;
178 }
179
180 /* Check if we already initialized once */
182 return TRUE;
183
184 /* Set the Debug Routine as the Stub for now */
186
187 /* Disable break after symbol load for now */
189
190 /* Check if the Debugger Data Block was already initialized */
192 {
193 /* It wasn't...Initialize the KD Data Listhead */
195
196 /* Register the Debugger Data Block */
199 sizeof(KdDebuggerDataBlock));
200
201 /* Fill out the KD Version Block */
204
205#ifdef CONFIG_SMP
206 /* This is an MP Build */
208#endif
209
210 /* Save Pointers to Loaded Module List and Debugger Data */
213
214 /* Set protocol limits */
219 KdVersionBlock.Unused[0] = 0;
220
221 /* Link us in the KPCR */
222 KeGetPcr()->KdVersionBlock = &KdVersionBlock;
223 }
224
225 /* Check if we have a loader block */
226 if (LoaderBlock)
227 {
228 PSTR CommandLine, DebugLine;
229
230 /* Get the image entry */
231 LdrEntry = CONTAINING_RECORD(LoaderBlock->LoadOrderListHead.Flink,
233 InLoadOrderLinks);
234
235 /* Save the Kernel Base */
236 PsNtosImageBase = (ULONG_PTR)LdrEntry->DllBase;
238
239 /* Check if we have a command line */
240 CommandLine = LoaderBlock->LoadOptions;
241 if (CommandLine)
242 {
243 /* Upcase it */
244 _strupr(CommandLine);
245
246 /* Assume we'll disable KD */
247 EnableKd = FALSE;
248
249 /* Check for CRASHDEBUG, NODEBUG and just DEBUG */
250 if (strstr(CommandLine, "CRASHDEBUG"))
251 {
252 /* Don't enable KD now, but allow it to be enabled later */
254 }
255 else if (strstr(CommandLine, "NODEBUG"))
256 {
257 /* Don't enable KD and don't let it be enabled later */
259 }
260 else if ((DebugLine = strstr(CommandLine, "DEBUG")))
261 {
262 /* Enable KD */
263 EnableKd = TRUE;
264
265 /* Check if there are any options */
266 if (DebugLine[5] == '=')
267 {
268 /* Save pointers */
269 PSTR DebugOptionStart, DebugOptionEnd;
270 DebugOptionStart = DebugOptionEnd = &DebugLine[6];
271
272 /* Scan the string for debug options */
273 for (;;)
274 {
275 SIZE_T DebugOptionLength;
276
277 /* Loop until we reach the end of the string */
278 while (*DebugOptionEnd != ANSI_NULL)
279 {
280 /* Check if this is a comma, a space or a tab */
281 if ((*DebugOptionEnd == ',') ||
282 (*DebugOptionEnd == ' ') ||
283 (*DebugOptionEnd == '\t'))
284 {
285 /*
286 * We reached the end of the option or
287 * the end of the string, break out.
288 */
289 break;
290 }
291 else
292 {
293 /* Move on to the next character */
294 DebugOptionEnd++;
295 }
296 }
297
298 /* Calculate the length of the current option */
299 DebugOptionLength = (DebugOptionEnd - DebugOptionStart);
300
301 /*
302 * Break out if we reached the last option
303 * or if there were no options at all.
304 */
305 if (!DebugOptionLength)
306 break;
307
308 /* Now check which option this is */
309 if ((DebugOptionLength == 10) &&
310 !(strncmp(DebugOptionStart, "AUTOENABLE", 10)))
311 {
312 /* Disable the debugger, but
313 * allow to re-enable it later */
314 DisableKdAfterInit = TRUE;
315 BlockEnable = FALSE;
317 }
318 else if ((DebugOptionLength == 7) &&
319 !(strncmp(DebugOptionStart, "DISABLE", 7)))
320 {
321 /* Disable the debugger */
322 DisableKdAfterInit = TRUE;
323 BlockEnable = TRUE;
325 }
326 else if ((DebugOptionLength == 6) &&
327 !(strncmp(DebugOptionStart, "NOUMEX", 6)))
328 {
329 /* Ignore user mode exceptions */
331 }
332
333 /*
334 * If there are more options then the next character
335 * should be a comma. Break out if it isn't.
336 */
337 if (*DebugOptionEnd != ',')
338 break;
339
340 /* Move on to the next option */
341 DebugOptionEnd++;
342 DebugOptionStart = DebugOptionEnd;
343 }
344 }
345 }
346 }
347 else
348 {
349 /* No command line options? Disable debugger by default */
351 EnableKd = FALSE;
352 }
353 }
354 else
355 {
356 /* Called from a bugcheck or a re-enable. Save the Kernel Base. */
358
359 /* Unconditionally enable KD */
360 EnableKd = TRUE;
361 }
362
363 /* Set the Kernel Base in the Data Block */
365
366 /* Initialize the debugger if requested */
367 if (EnableKd && (NT_SUCCESS(KdDebuggerInitialize0(LoaderBlock))))
368 {
369 /* Now set our real KD routine */
371
372 /* Check if we've already initialized our structures */
374 {
375 /* Set Retries */
377
378 /* Initialize breakpoints owed flag and table */
380 for (i = 0; i < KD_BREAKPOINT_MAX; i++)
381 {
385 }
386
387 /* Initialize the Time Slip DPC */
391
392 /* First-time initialization done! */
394 }
395
396 /* Initialize the timer */
398
399 /* Officially enable KD */
402
403 /* Let user-mode know that it's enabled as well */
404 SharedUserData->KdDebuggerEnabled = TRUE;
405
406 /* Display separator + ReactOS version at the start of the debug log */
408
409 /* Check if the debugger should be disabled initially */
410 if (DisableKdAfterInit)
411 {
412 /* Disable it */
414
415 /*
416 * Save the enable block state and return initialized
417 * (the debugger is active but disabled).
418 */
419 KdBlockEnable = BlockEnable;
420 return TRUE;
421 }
422
423 /* Check if we have a loader block */
424 if (LoaderBlock)
425 {
426 PLIST_ENTRY NextEntry;
427 ULONG j, Length;
428 PWCHAR Name;
430 CHAR NameBuffer[256];
431
432 /* Loop over the first two boot images: HAL and kernel */
433 for (NextEntry = LoaderBlock->LoadOrderListHead.Flink, i = 0;
434 NextEntry != &LoaderBlock->LoadOrderListHead && (i < 2);
435 NextEntry = NextEntry->Flink, ++i)
436 {
437 /* Get the image entry */
438 LdrEntry = CONTAINING_RECORD(NextEntry,
440 InLoadOrderLinks);
441
442 /* Generate the image name */
443 Name = LdrEntry->FullDllName.Buffer;
444 Length = LdrEntry->FullDllName.Length / sizeof(WCHAR);
445 j = 0;
446 do
447 {
448 /* Do cheap Unicode to ANSI conversion */
449 NameBuffer[j++] = (CHAR)*Name++;
450 } while (j < Length);
451
452 /* Null-terminate */
453 NameBuffer[j] = ANSI_NULL;
454
455 /* Load the symbols */
456 RtlInitString(&ImageName, NameBuffer);
458 LdrEntry->DllBase,
460 }
461
462 /* Check for incoming break-in and break on symbol load
463 * if requested, see ex/init.c!ExpLoadBootSymbols() */
465 }
466 }
467 else
468 {
469 /* Disable debugger */
471 }
472
473 /* Return initialized */
474 return TRUE;
475}
unsigned char BOOLEAN
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
struct NameRec_ * Name
Definition: cdprocs.h:460
#define CHAR(Char)
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
Definition: dpc.c:712
#define ULONG_PTR
Definition: config.h:101
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
std::wstring STRING
Definition: fontsub.cpp:33
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
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 GLint GLint j
Definition: glfuncs.h:250
LARGE_INTEGER NTAPI KeQueryPerformanceCounter(IN PLARGE_INTEGER PerformanceFreq)
Definition: timer.c:138
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 KD_BREAKPOINT_MAX
Definition: kd64.h:28
BREAKPOINT_ENTRY KdpBreakpointTable[KD_BREAKPOINT_MAX]
Definition: kddata.c:95
BOOLEAN KdPitchDebugger
Definition: kddata.c:80
NTSTATUS NTAPI KdDisableDebuggerWithLock(IN BOOLEAN NeedLock)
Definition: kdapi.c:2063
BOOLEAN KdBlockEnable
Definition: kddata.c:84
LARGE_INTEGER KdPerformanceCounterRate
Definition: kddata.c:90
BOOLEAN KdBreakAfterSymbolLoad
Definition: kddata.c:79
KDPC KdpTimeSlipDpc
Definition: kddata.c:115
DBGKD_GET_VERSION64 KdVersionBlock
Definition: kddata.c:495
VOID NTAPI KdpTimeSlipWork(IN PVOID Context)
Definition: kdapi.c:1859
LARGE_INTEGER KdTimerStart
Definition: kd64.h:541
BOOLEAN KdIgnoreUmExceptions
Definition: kddata.c:85
PKDEBUG_ROUTINE KiDebugRoutine
Definition: kddata.c:74
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
WORK_QUEUE_ITEM KdpTimeSlipWorkItem
Definition: kddata.c:117
KD_CONTEXT KdpContext
Definition: kddata.c:65
LIST_ENTRY KdpDebuggerDataListHead
Definition: kddata.c:489
BOOLEAN KdpDebuggerStructuresInitialized
Definition: kddata.c:87
VOID NTAPI KdpTimeSlipDpcRoutine(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: kdapi.c:1833
BOOLEAN KdpOweBreakpoint
Definition: kddata.c:97
KTIMER KdpTimeSlipTimer
Definition: kddata.c:116
BOOLEAN KdAutoEnableOnEvent
Definition: kddata.c:83
NTSTATUS NTAPI KdDebuggerInitialize0(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
Definition: kdcom.c:158
BOOLEAN KdDebuggerNotPresent
Definition: kddata.c:81
BOOLEAN KdDebuggerEnabled
Definition: kddata.c:82
KDDEBUGGER_DATA64 * KdDebuggerDataBlock
Definition: kdpacket.c:21
BOOLEAN NTAPI KdRegisterDebuggerDataBlock(IN ULONG Tag, IN PDBGKD_DEBUG_DATA_HEADER64 DataHeader, IN ULONG Size)
Definition: kdinit.c:120
static VOID KdpPrintBanner(VOID)
Displays the kernel debugger initialization banner.
Definition: kdinit.c:90
BOOLEAN NTAPI KdPollBreakIn(VOID)
Definition: kdlock.c:75
if(dx< 0)
Definition: linetemp.h:194
unsigned __int64 ULONG64
Definition: imports.h:198
static const char * ImageName
Definition: image.c:34
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define KeGetPcr()
Definition: ketypes.h:81
VOID NTAPI DbgLoadImageSymbols(_In_ PSTRING Name, _In_ PVOID Base, _In_ ULONG_PTR ProcessId)
NTSYSAPI VOID NTAPI RtlInitString(PSTRING DestinationString, PCSZ SourceString)
#define ANSI_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
HANDLE NTAPI PsGetCurrentProcessId(VOID)
Definition: process.c:1123
unsigned short USHORT
Definition: pedump.c:61
LIST_ENTRY PsLoadedModuleList
Definition: sysldr.c:21
ULONG_PTR PsNtosImageBase
Definition: sysldr.c:25
#define DBGKD_VERS_FLAG_MP
Definition: wdbgexts.h:27
#define KDBG_TAG
Definition: wdbgexts.h:34
@ DBGKD_MAJOR_NT
Definition: wdbgexts.h:38
_strupr
Definition: string.h:453
#define SharedUserData
ULONG NtBuildNumber
Definition: init.c:50
ULONG_PTR DirectoryTableBase
Definition: kd64.h:56
ULONG Flags
Definition: kd64.h:55
PVOID Address
Definition: kd64.h:57
ULONG64 DebuggerDataList
Definition: wdbgexts.h:167
ULONG64 PsLoadedModuleList
Definition: wdbgexts.h:166
USHORT Unused[1]
Definition: wdbgexts.h:164
DBGKD_DEBUG_DATA_HEADER64 Header
Definition: wdbgexts.h:192
ULONG64 KernBase
Definition: wdbgexts.h:193
ULONG KdpDefaultRetries
Definition: windbgkd.h:226
Definition: btrfs_drv.h:1876
UNICODE_STRING FullDllName
Definition: btrfs_drv.h:1882
PVOID DllBase
Definition: btrfs_drv.h:1880
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
VOID NTAPI KeInitializeTimer(OUT PKTIMER Timer)
Definition: timerobj.c:233
#define LONG_PTR
Definition: treelist.c:79
char * PSTR
Definition: typedefs.h:51
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint16_t * PWCHAR
Definition: typedefs.h:56
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
LONGLONG QuadPart
Definition: typedefs.h:114
#define DbgKdMaximumStateChange
Definition: windbgkd.h:62
#define DbgKdMinimumStateChange
Definition: windbgkd.h:58
#define DbgKdMaximumManipulate
Definition: windbgkd.h:117
#define DbgKdMinimumManipulate
Definition: windbgkd.h:73
#define ExInitializeWorkItem(Item, Routine, Context)
Definition: exfuncs.h:265
__wchar_t WCHAR
Definition: xmlstorage.h:180
char CHAR
Definition: xmlstorage.h:175

Referenced by KdEnableDebuggerWithLock(), KeEnterKernelDebugger(), KiInitializeSystem(), KiSystemStartup(), and Phase1InitializationDiscard().

◆ KdpGetMemorySizeInMBs()

static SIZE_T KdpGetMemorySizeInMBs ( _In_opt_ PLOADER_PARAMETER_BLOCK  LoaderBlock)
static

Retrieves the total size of the memory before Mm is initialized, by counting the number of physical pages. Useful for debug logging.

Adapted from mm/ARM3/mminit.c!MiScanMemoryDescriptors().

Definition at line 39 of file kdinit.c.

41{
42 PLIST_ENTRY ListEntry;
44 SIZE_T NumberOfPhysicalPages = 0;
45
46 /*
47 * If no loader block is present (e.g. the debugger is initialized only
48 * much later after boot), just use the already-initialized Mm-computed
49 * number of physical pages. Otherwise do the evaluation ourselves.
50 */
51 if (!LoaderBlock)
52 {
53 NumberOfPhysicalPages = MmNumberOfPhysicalPages;
54 goto ReturnSize;
55 }
56
57 /* Loop the memory descriptors */
58 for (ListEntry = LoaderBlock->MemoryDescriptorListHead.Flink;
59 ListEntry != &LoaderBlock->MemoryDescriptorListHead;
60 ListEntry = ListEntry->Flink)
61 {
62 /* Get the descriptor */
63 Descriptor = CONTAINING_RECORD(ListEntry,
65 ListEntry);
66
67 /* If this is invisible memory, skip this descriptor */
68 if (MiIsMemoryTypeInvisible(Descriptor->MemoryType))
69 continue;
70
71 /* Check if this isn't bad memory */
72 if (Descriptor->MemoryType != LoaderBad)
73 {
74 /* Count it in the physical pages */
75 NumberOfPhysicalPages += Descriptor->PageCount;
76 }
77 }
78
79ReturnSize:
80 /* Round size up. Assumed to better match actual physical RAM size */
81 return ALIGN_UP_BY(NumberOfPhysicalPages * PAGE_SIZE, 1024 * 1024) / (1024 * 1024);
82}
#define ALIGN_UP_BY(size, align)
#define PAGE_SIZE
Definition: env_spec_w32.h:49
FORCEINLINE BOOLEAN MiIsMemoryTypeInvisible(TYPE_OF_MEMORY MemoryType)
Definition: miarm.h:692
PFN_COUNT MmNumberOfPhysicalPages
Definition: init.c:48
@ LoaderBad
Definition: arc.h:177
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342

Referenced by KdpPrintBanner().

◆ KdpPrintBanner()

static VOID KdpPrintBanner ( VOID  )
static

Displays the kernel debugger initialization banner.

Definition at line 90 of file kdinit.c.

91{
93
94 DPRINT1("-----------------------------------------------------\n");
95 DPRINT1("ReactOS " KERNEL_VERSION_STR " (Build " KERNEL_VERSION_BUILD_STR ") (Commit " KERNEL_VERSION_COMMIT_HASH ")\n");
96 DPRINT1("%u System Processor [%u MB Memory]\n", KeNumberProcessors, MemSizeMBs);
97
98 if (KeLoaderBlock)
99 {
100 DPRINT1("Command Line: %s\n", KeLoaderBlock->LoadOptions);
101 DPRINT1("ARC Paths: %s %s %s %s\n",
104 }
105}
#define DPRINT1
Definition: precomp.h:8
static SIZE_T KdpGetMemorySizeInMBs(_In_opt_ PLOADER_PARAMETER_BLOCK LoaderBlock)
Retrieves the total size of the memory before Mm is initialized, by counting the number of physical p...
Definition: kdinit.c:39
PLOADER_PARAMETER_BLOCK KeLoaderBlock
Definition: krnlinit.c:28
CCHAR KeNumberProcessors
Definition: processor.c:16
PSTR ArcBootDeviceName
Definition: arc.h:550

Referenced by KdInitSystem().

◆ KdRegisterDebuggerDataBlock()

BOOLEAN NTAPI KdRegisterDebuggerDataBlock ( IN ULONG  Tag,
IN PDBGKD_DEBUG_DATA_HEADER64  DataHeader,
IN ULONG  Size 
)

Definition at line 120 of file kdinit.c.

123{
125 PLIST_ENTRY NextEntry;
126 PDBGKD_DEBUG_DATA_HEADER64 CurrentHeader;
127
128 /* Acquire the Data Lock */
130
131 /* Loop the debugger data list */
132 NextEntry = KdpDebuggerDataListHead.Flink;
133 while (NextEntry != &KdpDebuggerDataListHead)
134 {
135 /* Get the header for this entry */
136 CurrentHeader = CONTAINING_RECORD(NextEntry,
138 List);
139
140 /* Move to the next one */
141 NextEntry = NextEntry->Flink;
142
143 /* Check if we already have this data block */
144 if ((CurrentHeader == DataHeader) || (CurrentHeader->OwnerTag == Tag))
145 {
146 /* Release the lock and fail */
148 return FALSE;
149 }
150 }
151
152 /* Setup the header */
153 DataHeader->OwnerTag = Tag;
154 DataHeader->Size = Size;
155
156 /* Insert it into the list and release the lock */
159 return TRUE;
160}
#define InsertTailList(ListHead, Entry)
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
KSPIN_LOCK KdpDataSpinLock
Definition: kddata.c:490
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4065
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778

Referenced by KdInitSystem().

◆ KdUpdateDataBlock()

VOID NTAPI KdUpdateDataBlock ( VOID  )

Definition at line 111 of file kdinit.c.

112{
113 /* Update the KeUserCallbackDispatcher pointer */
116}
PVOID KeUserCallbackDispatcher
Definition: ke.h:142
ULONG64 KeUserCallbackDispatcher
Definition: wdbgexts.h:201

Referenced by PspInitializeSystemDll().