2006-11-15 00:08:51 +00:00
|
|
|
/*
|
2021-03-14 23:42:49 +00:00
|
|
|
* PROJECT: ReactOS Hardware Abstraction Layer
|
|
|
|
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
|
|
|
* PURPOSE: HAL Processor Routines
|
|
|
|
* COPYRIGHT: Copyright 2006 Alex Ionescu <alex.ionescu@reactos.org>
|
2004-12-03 20:10:45 +00:00
|
|
|
*/
|
|
|
|
|
2006-11-15 00:08:51 +00:00
|
|
|
/* INCLUDES ******************************************************************/
|
2004-12-03 20:10:45 +00:00
|
|
|
|
2005-06-18 14:29:31 +00:00
|
|
|
#include <hal.h>
|
2005-06-19 22:53:49 +00:00
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
2004-12-03 20:10:45 +00:00
|
|
|
|
2010-04-01 20:42:43 +00:00
|
|
|
KAFFINITY HalpActiveProcessors;
|
2006-11-15 00:08:51 +00:00
|
|
|
KAFFINITY HalpDefaultInterruptAffinity;
|
|
|
|
|
- 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
|
|
|
/* PRIVATE FUNCTIONS *********************************************************/
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
HaliHaltSystem(VOID)
|
|
|
|
{
|
|
|
|
/* Disable interrupts and halt the CPU */
|
|
|
|
_disable();
|
|
|
|
__halt();
|
|
|
|
}
|
|
|
|
|
2004-12-03 20:10:45 +00:00
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
2006-11-14 20:59:48 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
HalAllProcessorsStarted(VOID)
|
2004-12-03 20:10:45 +00:00
|
|
|
{
|
2006-11-14 20:59:48 +00:00
|
|
|
/* Do nothing */
|
|
|
|
return TRUE;
|
2004-12-03 20:10:45 +00:00
|
|
|
}
|
|
|
|
|
2006-11-14 20:59:48 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2006-09-11 06:50:19 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
HalProcessorIdle(VOID)
|
|
|
|
{
|
2006-11-15 00:08:51 +00:00
|
|
|
/* Enable interrupts and halt the processor */
|
2006-11-14 20:59:48 +00:00
|
|
|
_enable();
|
2009-09-27 10:09:38 +00:00
|
|
|
__halt();
|
2006-09-11 06:50:19 +00:00
|
|
|
}
|
|
|
|
|
2004-12-03 20:10:45 +00:00
|
|
|
/* EOF */
|