Windows NT 4.0 source code leak
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

157 lines
3.3 KiB

4 years ago
  1. // #pragma comment(exestr, "@(#) r94adbg.c 1.1 95/09/28 15:47:19 nec")
  2. /*++
  3. Copyright (c) 1994 KOBE NEC Software
  4. Module Name:
  5. r94adbg.c
  6. Abstract:
  7. The module provides the debug support functions for R94A systems.
  8. Author:
  9. Revision History:
  10. Modification History for NEC R94A (MIPS R4400):
  11. H000 Thu Sep 8 10:32:42 JST 1994 kbnes!kishimoto
  12. - add HalDisplayLED()
  13. new function.
  14. - add HalpOutputCharacterToLED()
  15. new function.
  16. H001 Mon Oct 17 13:01:53 JST 1994 kbnes!kishimoto
  17. - add HalR94aDebugPrint()
  18. new function.
  19. - chg HalpDisplayLED()
  20. rename from HalDisplayLED()
  21. H002 Thu Oct 20 19:42:03 JST 1994 kbnes!kishimoto
  22. - add R94aBbmLEDMapped used at KdPortInitialize()(jxport.c)
  23. for debug use only
  24. H003 Fri Oct 21 10:18:01 JST 1994 kbnes!kishimoto
  25. - add specify the output device.
  26. M004 Fri Jan 06 10:49:29 JST 1995 kbnes!kuriyama
  27. - add HalpPrintMdl()
  28. H005 Sat Mar 18 16:23:05 JST 1995 kbnes!kishimoto
  29. - always include "halp.h"
  30. S006 kuriyama@oa2.kb.nec.co.jp Mon Apr 03 10:49:48 JST 1995
  31. - delete PrintMdl routine (if defined _PRINT_MDL_)
  32. --*/
  33. #include <stdarg.h>
  34. #include <stdio.h>
  35. #include "halp.h" // H005
  36. #define R94A_LED 0
  37. #define R94A_DBG 1
  38. #define R94A_CON 2
  39. ULONG HalpR94aDebugOutput = R94A_DBG ; // start H003
  40. ULONG R94aDebugLevel = 1;
  41. VOID
  42. HalR94aDebugPrint(
  43. ULONG DebugLevel,
  44. PUCHAR LedCharactor,
  45. PUCHAR Message,
  46. ...
  47. )
  48. /*++
  49. Routine Description:
  50. This function is used to display debug information.
  51. Usage :
  52. HalR94aDebugPrint(
  53. (ULONG) 3,
  54. "1234",
  55. "Dbg : Current file is %s [%d]\n",
  56. __FILE__,
  57. __LINE__
  58. );
  59. Arguments:
  60. DebugLevel - Debug level for output.
  61. If DebugLevel less than R94aDebugLevel, not display.
  62. LedCharactor - Display charactor for LED.
  63. Message - Display format for console or debug-teminal.
  64. Return Value:
  65. None.
  66. --*/
  67. {
  68. va_list argp;
  69. ULONG Index;
  70. CHAR Buffer[100];
  71. if (DebugLevel >= R94aDebugLevel) {
  72. va_start(argp, Message);
  73. vsprintf(Buffer, Message, argp);
  74. if (HalpR94aDebugOutput & (1 << R94A_DBG)) { // H003
  75. DbgPrint(Buffer);
  76. }
  77. if (HalpR94aDebugOutput & (1 << R94A_CON)) {
  78. HalDisplayString(Buffer);
  79. }
  80. va_end(argp);
  81. }
  82. return;
  83. }
  84. /* end H001 */
  85. /* M004 +++ */
  86. #if defined(_PRINT_MDL_) //S006
  87. VOID
  88. HalpPrintMdl(PLOADER_PARAMETER_BLOCK LoaderBlock)
  89. {
  90. PLIST_ENTRY NextMd;
  91. PMEMORY_ALLOCATION_DESCRIPTOR MemoryDescriptor;
  92. //
  93. // Get the lower bound of the free physical memory and the
  94. // number of physical pages by walking the memory descriptor lists.
  95. //
  96. NextMd = LoaderBlock->MemoryDescriptorListHead.Flink;
  97. while (NextMd != &LoaderBlock->MemoryDescriptorListHead) {
  98. MemoryDescriptor = CONTAINING_RECORD(NextMd,
  99. MEMORY_ALLOCATION_DESCRIPTOR,
  100. ListEntry);
  101. DbgPrint("MemoryType = %d ",MemoryDescriptor->MemoryType);
  102. DbgPrint("BasePage = %010x ",MemoryDescriptor->BasePage);
  103. DbgPrint("PageCount = %5d\n",MemoryDescriptor->PageCount);
  104. NextMd = MemoryDescriptor->ListEntry.Flink;
  105. }
  106. }
  107. #endif // _PRINT_MDL_ // S006
  108. /* M004 --- */