Source code of Windows XP (NT5)
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.

245 lines
3.7 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. stubs.c
  5. Abstract:
  6. This module implements stub routines for the boot code.
  7. Author:
  8. David N. Cutler (davec) 7-Nov-1990
  9. Environment:
  10. Kernel mode only.
  11. Revision History:
  12. --*/
  13. #define _BLDR_
  14. #include "ntos.h"
  15. //
  16. // Define global data.
  17. //
  18. ULONG BlDcacheFillSize = 32;
  19. VOID
  20. KeBugCheck (
  21. IN ULONG BugCheckCode
  22. )
  23. /*++
  24. Routine Description:
  25. This function crashes the system in a controlled manner.
  26. Arguments:
  27. BugCheckCode - Supplies the reason for the bug check.
  28. Return Value:
  29. None.
  30. --*/
  31. {
  32. //
  33. // Print out the bug check code and break.
  34. //
  35. DbgPrint("\n*** BugCheck (%lx) ***\n\n", BugCheckCode);
  36. while(TRUE) {
  37. DbgBreakPoint();
  38. };
  39. return;
  40. }
  41. LARGE_INTEGER
  42. KeQueryPerformanceCounter (
  43. OUT PLARGE_INTEGER Frequency OPTIONAL
  44. )
  45. /*++
  46. Routine Description:
  47. This routine is a stub for the kernel debugger and always returns a
  48. value of zero.
  49. Arguments:
  50. Frequency - Supplies an optional pointer to a variable which receives
  51. the performance counter frequency in Hertz.
  52. Return Value:
  53. A value of zero is returned.
  54. --*/
  55. {
  56. LARGE_INTEGER Counter;
  57. //
  58. // Return the current system time as the function value.
  59. //
  60. Counter.LowPart = 0;
  61. Counter.HighPart = 0;
  62. return Counter;
  63. }
  64. VOID
  65. KeStallExecutionProcessor (
  66. IN ULONG MicroSeconds
  67. )
  68. /*++
  69. Routine Description:
  70. This function stalls execution for the specified number of microseconds.
  71. Arguments:
  72. MicroSeconds - Supplies the number of microseconds that execution is to be
  73. stalled.
  74. Return Value:
  75. None.
  76. --*/
  77. {
  78. ULONG Index;
  79. ULONG Limit;
  80. PULONG Store;
  81. ULONG Value;
  82. //
  83. // ****** begin temporary code ******
  84. //
  85. // This code must be replaced with a smarter version. For now it assumes
  86. // an execution rate of 40,000,000 instructions per second and 4 instructions
  87. // per iteration.
  88. //
  89. Store = &Value;
  90. Limit = (MicroSeconds * 40 / 4);
  91. for (Index = 0; Index < Limit; Index += 1) {
  92. *Store = Index;
  93. }
  94. return;
  95. }
  96. PVOID
  97. MmDbgReadCheck (
  98. IN PVOID VirtualAddress
  99. )
  100. /*++
  101. Routine Description:
  102. This routine returns the phyiscal address for a virtual address
  103. which is valid (mapped) for read access.
  104. Arguments:
  105. VirtualAddress - Supplies the virtual address to check.
  106. Return Value:
  107. Returns NULL if the address is not valid or readable, otherwise
  108. returns the physical address of the corresponding virtual address.
  109. --*/
  110. {
  111. return VirtualAddress;
  112. }
  113. PVOID
  114. MmDbgTranslatePhysicalAddress (
  115. IN PHYSICAL_ADDRESS PhysicalAddress
  116. )
  117. /*++
  118. Routine Description:
  119. This routine returns the phyiscal address for a physical address
  120. which is valid (mapped).
  121. Arguments:
  122. PhysicalAddress - Supplies the physical address to check.
  123. Return Value:
  124. Returns NULL if the address is not valid or readable, otherwise
  125. returns the physical address of the corresponding virtual address.
  126. --*/
  127. {
  128. return (PVOID)PhysicalAddress.LowPart;
  129. }
  130. PVOID
  131. MmDbgWriteCheck (
  132. IN PVOID VirtualAddress
  133. )
  134. /*++
  135. Routine Description:
  136. This routine returns the phyiscal address for a virtual address
  137. which is valid (mapped) for write access.
  138. Arguments:
  139. VirtualAddress - Supplies the virtual address to check.
  140. Return Value:
  141. Returns NULL if the address is not valid or readable, otherwise
  142. returns the physical address of the corresponding virtual address.
  143. --*/
  144. {
  145. return VirtualAddress;
  146. }
  147. VOID
  148. RtlAssert(
  149. IN PVOID FailedAssertion,
  150. IN PVOID FileName,
  151. IN ULONG LineNumber,
  152. IN PCHAR Message OPTIONAL
  153. )
  154. {
  155. DbgPrint( "\n*** Assertion failed\n");
  156. while (TRUE) {
  157. DbgBreakPoint();
  158. }
  159. }