2007-12-15 16:18:49 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS Kernel
|
|
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
|
|
|
* FILE: ntoskrnl/fstub/halstub.c
|
|
|
|
* PURPOSE: I/O Stub HAL Routines
|
|
|
|
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES ******************************************************************/
|
|
|
|
|
|
|
|
#include <ntoskrnl.h>
|
|
|
|
#define NDEBUG
|
2008-08-30 16:31:06 +00:00
|
|
|
#include <debug.h>
|
2007-12-15 16:18:49 +00:00
|
|
|
|
|
|
|
/* GLOBALS *******************************************************************/
|
|
|
|
|
|
|
|
HAL_DISPATCH HalDispatchTable =
|
|
|
|
{
|
|
|
|
HAL_DISPATCH_VERSION,
|
|
|
|
(pHalQuerySystemInformation)NULL,
|
|
|
|
(pHalSetSystemInformation)NULL,
|
|
|
|
(pHalQueryBusSlots)NULL,
|
|
|
|
0,
|
|
|
|
xHalExamineMBR,
|
|
|
|
xHalIoAssignDriveLetters,
|
|
|
|
xHalIoReadPartitionTable,
|
|
|
|
xHalIoSetPartitionInformation,
|
|
|
|
xHalIoWritePartitionTable,
|
|
|
|
(pHalHandlerForBus)NULL,
|
|
|
|
(pHalReferenceBusHandler)NULL,
|
|
|
|
(pHalReferenceBusHandler)NULL,
|
|
|
|
(pHalInitPnpDriver)NULL,
|
|
|
|
(pHalInitPowerManagement)NULL,
|
|
|
|
(pHalGetDmaAdapter) NULL,
|
|
|
|
(pHalGetInterruptTranslator)NULL,
|
|
|
|
(pHalStartMirroring)NULL,
|
|
|
|
(pHalEndMirroring)NULL,
|
|
|
|
(pHalMirrorPhysicalMemory)NULL,
|
2010-03-08 20:37:24 +00:00
|
|
|
xHalEndOfBoot,
|
2007-12-15 16:18:49 +00:00
|
|
|
(pHalMirrorVerify)NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
HAL_PRIVATE_DISPATCH HalPrivateDispatchTable =
|
|
|
|
{
|
|
|
|
HAL_PRIVATE_DISPATCH_VERSION,
|
|
|
|
(pHalHandlerForBus)NULL,
|
|
|
|
(pHalHandlerForConfigSpace)NULL,
|
|
|
|
(pHalLocateHiberRanges)NULL,
|
|
|
|
(pHalRegisterBusHandler)NULL,
|
2010-03-08 20:37:24 +00:00
|
|
|
xHalSetWakeEnable,
|
2007-12-15 16:18:49 +00:00
|
|
|
(pHalSetWakeAlarm)NULL,
|
|
|
|
(pHalTranslateBusAddress)NULL,
|
|
|
|
(pHalAssignSlotResources)NULL,
|
- Stub out DbgKdWriteVirtualMemoryApi, DbgKdReadPhysicalMemoryApi, DbgKdWritePhysicalMemoryApi, DbgKdWriteBreakPointExApi, DbgKdRestoreBreakPointExApi, DbgKdSearchMemoryApi and DbgKdFillMemoryApi cases more properly.
- Fail on physical memory write like we do for read too.
- Don't handle OldVlm1/2 as they appear to be deprecated and unhandled in Windows.
- Implement HalHaltSystem to halt execution in a portable way. Default to xHalHaltSystem, a simple infinite loop, if we get called before HAL has initialized. Use this in KiBugCheckDebugBreak and the system shutdown handler instead of x86/AMD64/ARM intrinsics.
- Don't try to halt the CPU if KeBugCheck has been called 3 times or more -- if this happens, something has gone very wrong, and we shouldn't try to do anything special. Just loop infinitely.
- Fix KiBugCheckDebugBreak -- it shouldn't halt execution when called for the first chance as bugcheck callbacks have not been invoked at this point (nor has the BSOD been displayed). Use SEH to protect against a crash instead of checking KdDebuggerNotPresent as the debugger, if it is present, *could* disconnect while the trap is being handled. Also, don't halt execution if the debugger handled the breakpoint, just break again.
- Don't call MmMapIoSpace from HalpReboot! The reboot might take place at elevated IRQL (as high as HIGH_LEVEL if called from KeBugCheck), and thus can't use any Mm support routines. Use a PTE from the reserved HAL region and map it ourselves instead as done in the BIOS call code.
- Acquire the display ownership in HalReturnToFirmware in case the caller hasn't done so (as done in the KD reboot routine, for example).
- Just include ntndk.h in hal.h instead of including 6 NDK headers (which turns into more than half of the NDK anyway since those headers include other NDK headers).
- Crashing and rebooting from KD now works properly.
svn path=/trunk/; revision=43380
2009-10-11 20:16:45 +00:00
|
|
|
xHalHaltSystem,
|
2007-12-15 16:18:49 +00:00
|
|
|
(pHalFindBusAddressTranslation)NULL,
|
|
|
|
(pHalResetDisplay)NULL,
|
|
|
|
(pHalAllocateMapRegisters)NULL,
|
|
|
|
(pKdSetupPciDeviceForDebugging)NULL,
|
|
|
|
(pKdReleasePciDeviceForDebugging)NULL,
|
|
|
|
(pKdGetAcpiTablePhase0)NULL,
|
|
|
|
(pKdCheckPowerButton)NULL,
|
2009-10-29 19:58:41 +00:00
|
|
|
(pHalVectorToIDTEntry)xHalVectorToIDTEntry,
|
2007-12-15 16:18:49 +00:00
|
|
|
(pKdMapPhysicalMemory64)NULL,
|
|
|
|
(pKdUnmapVirtualAddress)NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
2009-10-29 19:58:41 +00:00
|
|
|
UCHAR
|
|
|
|
NTAPI
|
|
|
|
xHalVectorToIDTEntry(IN ULONG Vector)
|
|
|
|
{
|
|
|
|
/* Return the vector */
|
|
|
|
return Vector;
|
|
|
|
}
|
|
|
|
|
- Stub out DbgKdWriteVirtualMemoryApi, DbgKdReadPhysicalMemoryApi, DbgKdWritePhysicalMemoryApi, DbgKdWriteBreakPointExApi, DbgKdRestoreBreakPointExApi, DbgKdSearchMemoryApi and DbgKdFillMemoryApi cases more properly.
- Fail on physical memory write like we do for read too.
- Don't handle OldVlm1/2 as they appear to be deprecated and unhandled in Windows.
- Implement HalHaltSystem to halt execution in a portable way. Default to xHalHaltSystem, a simple infinite loop, if we get called before HAL has initialized. Use this in KiBugCheckDebugBreak and the system shutdown handler instead of x86/AMD64/ARM intrinsics.
- Don't try to halt the CPU if KeBugCheck has been called 3 times or more -- if this happens, something has gone very wrong, and we shouldn't try to do anything special. Just loop infinitely.
- Fix KiBugCheckDebugBreak -- it shouldn't halt execution when called for the first chance as bugcheck callbacks have not been invoked at this point (nor has the BSOD been displayed). Use SEH to protect against a crash instead of checking KdDebuggerNotPresent as the debugger, if it is present, *could* disconnect while the trap is being handled. Also, don't halt execution if the debugger handled the breakpoint, just break again.
- Don't call MmMapIoSpace from HalpReboot! The reboot might take place at elevated IRQL (as high as HIGH_LEVEL if called from KeBugCheck), and thus can't use any Mm support routines. Use a PTE from the reserved HAL region and map it ourselves instead as done in the BIOS call code.
- Acquire the display ownership in HalReturnToFirmware in case the caller hasn't done so (as done in the KD reboot routine, for example).
- Just include ntndk.h in hal.h instead of including 6 NDK headers (which turns into more than half of the NDK anyway since those headers include other NDK headers).
- Crashing and rebooting from KD now works properly.
svn path=/trunk/; revision=43380
2009-10-11 20:16:45 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
xHalHaltSystem(VOID)
|
|
|
|
{
|
|
|
|
/* Halt execution */
|
|
|
|
while (TRUE);
|
|
|
|
}
|
2010-03-08 20:37:24 +00:00
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
xHalEndOfBoot(VOID)
|
|
|
|
{
|
|
|
|
/* Nothing */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
xHalSetWakeEnable(IN BOOLEAN Enable)
|
|
|
|
{
|
|
|
|
/* Nothing */
|
|
|
|
return;
|
|
|
|
}
|