/*++ Copyright (c) 1990 Microsoft Corporation Module Name: stubs.c Abstract: This module implements stub routines for the boot code. Author: David N. Cutler (davec) 7-Nov-1990 Environment: Kernel mode only. Revision History: --*/ #define _BLDR_ #include "ntos.h" // // Define global data. // ULONG BlDcacheFillSize = 32; VOID KeBugCheck ( IN ULONG BugCheckCode ) /*++ Routine Description: This function crashes the system in a controlled manner. Arguments: BugCheckCode - Supplies the reason for the bug check. Return Value: None. --*/ { // // Print out the bug check code and break. // DbgPrint("\n*** BugCheck (%lx) ***\n\n", BugCheckCode); while(TRUE) { DbgBreakPoint(); }; return; } LARGE_INTEGER KeQueryPerformanceCounter ( OUT PLARGE_INTEGER Frequency OPTIONAL ) /*++ Routine Description: This routine is a stub for the kernel debugger and always returns a value of zero. Arguments: Frequency - Supplies an optional pointer to a variable which receives the performance counter frequency in Hertz. Return Value: A value of zero is returned. --*/ { LARGE_INTEGER Counter; // // Return the current system time as the function value. // Counter.LowPart = 0; Counter.HighPart = 0; return Counter; } VOID KeStallExecutionProcessor ( IN ULONG MicroSeconds ) /*++ Routine Description: This function stalls execution for the specified number of microseconds. Arguments: MicroSeconds - Supplies the number of microseconds that execution is to be stalled. Return Value: None. --*/ { ULONG Index; ULONG Limit; PULONG Store; ULONG Value; // // ****** begin temporary code ****** // // This code must be replaced with a smarter version. For now it assumes // an execution rate of 40,000,000 instructions per second and 4 instructions // per iteration. // Store = &Value; Limit = (MicroSeconds * 40 / 4); for (Index = 0; Index < Limit; Index += 1) { *Store = Index; } return; } PVOID MmDbgReadCheck ( IN PVOID VirtualAddress ) /*++ Routine Description: This routine returns the phyiscal address for a virtual address which is valid (mapped) for read access. Arguments: VirtualAddress - Supplies the virtual address to check. Return Value: Returns NULL if the address is not valid or readable, otherwise returns the physical address of the corresponding virtual address. --*/ { return VirtualAddress; } PVOID MmDbgTranslatePhysicalAddress ( IN PHYSICAL_ADDRESS PhysicalAddress ) /*++ Routine Description: This routine returns the phyiscal address for a physical address which is valid (mapped). Arguments: PhysicalAddress - Supplies the physical address to check. Return Value: Returns NULL if the address is not valid or readable, otherwise returns the physical address of the corresponding virtual address. --*/ { return (PVOID)PhysicalAddress.LowPart; } PVOID MmDbgWriteCheck ( IN PVOID VirtualAddress ) /*++ Routine Description: This routine returns the phyiscal address for a virtual address which is valid (mapped) for write access. Arguments: VirtualAddress - Supplies the virtual address to check. Return Value: Returns NULL if the address is not valid or readable, otherwise returns the physical address of the corresponding virtual address. --*/ { return VirtualAddress; } VOID RtlAssert( IN PVOID FailedAssertion, IN PVOID FileName, IN ULONG LineNumber, IN PCHAR Message OPTIONAL ) { DbgPrint( "\n*** Assertion failed\n"); while (TRUE) { DbgBreakPoint(); } }