reactos/include/ndk/halfuncs.h

286 lines
4.6 KiB
C
Raw Normal View History

/*++ NDK Version: 0098
Copyright (c) Alex Ionescu. All rights reserved.
Header Name:
halfuncs.h
Abstract:
Function definitions for the HAL.
Author:
Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
--*/
#ifndef _HALFUNCS_H
#define _HALFUNCS_H
//
// Dependencies
//
- Update NDK to remove zwfuncs.h and place the native functions in their respective xxfuncs.h instead, so that applications can now include only what they need. Add more xxfuncs.h files for every API. - Make the NDK smarter so that using #define NTOS_MODE_USER isn't needed anymore: the NDK can now auto-detect the presence of windows.h or ntddk.h and make the appropriate decision. - re-arrange ntndk.h to include all types in alphabetical order, and then all functions, regardless of um/kmode usage. - Make each file auto-detect if this is NTOS_MODE_USER or not and include each files it needs, instead of depending on a predefined order inside ntndk.h This way, any file can be included from both user-mode or kmode as simply as #include <iofuncs.h>, wthout any adtional work. - Update FIXME list with these changes and delay NDK release date since my trip is lasting a day longer. - Fix ntsecapi.h to define UNICODE_STRING, like it does in the PSDK. - Fix apps including ntsecapi + winternl.h These two cause a conflict even on PSDK and shouldn't be included together. - Make winlogon include only the NDK files it needs (2) instead of the whole NDK, as test for this faster newly supported method. - Remove some NDK apps from the FIXME list (the ones that weren't being built/are on my rewrite branch/are better off including the whole NDK instead of file-by-file). - Update debug.h to define RtlAssert and DbgPrint in case the NDK or DDK aren't already included, which will allow some of the apps to stop using the NDK solely for DPRINT/DPRINT1. Diabled for now since a lot of code needs to be changed to #include <debug.h> *After* they include the other headers. (so that the anti-double-definition check can work). svn path=/trunk/; revision=19538
2005-11-25 00:17:40 +00:00
#include <umtypes.h>
#include <haltypes.h>
#include <ketypes.h>
- Update NDK to remove zwfuncs.h and place the native functions in their respective xxfuncs.h instead, so that applications can now include only what they need. Add more xxfuncs.h files for every API. - Make the NDK smarter so that using #define NTOS_MODE_USER isn't needed anymore: the NDK can now auto-detect the presence of windows.h or ntddk.h and make the appropriate decision. - re-arrange ntndk.h to include all types in alphabetical order, and then all functions, regardless of um/kmode usage. - Make each file auto-detect if this is NTOS_MODE_USER or not and include each files it needs, instead of depending on a predefined order inside ntndk.h This way, any file can be included from both user-mode or kmode as simply as #include <iofuncs.h>, wthout any adtional work. - Update FIXME list with these changes and delay NDK release date since my trip is lasting a day longer. - Fix ntsecapi.h to define UNICODE_STRING, like it does in the PSDK. - Fix apps including ntsecapi + winternl.h These two cause a conflict even on PSDK and shouldn't be included together. - Make winlogon include only the NDK files it needs (2) instead of the whole NDK, as test for this faster newly supported method. - Remove some NDK apps from the FIXME list (the ones that weren't being built/are on my rewrite branch/are better off including the whole NDK instead of file-by-file). - Update debug.h to define RtlAssert and DbgPrint in case the NDK or DDK aren't already included, which will allow some of the apps to stop using the NDK solely for DPRINT/DPRINT1. Diabled for now since a lot of code needs to be changed to #include <debug.h> *After* they include the other headers. (so that the anti-double-definition check can work). svn path=/trunk/; revision=19538
2005-11-25 00:17:40 +00:00
#ifndef NTOS_MODE_USER
//
// Private HAL Callbacks
//
#define HalHandlerForBus HALPRIVATEDISPATCH->HalHandlerForBus
#define HalHandlerForConfigSpace HALPRIVATEDISPATCH->HalHandlerForConfigSpace
#define HalLocateHiberRanges HALPRIVATEDISPATCH->HalLocateHiberRanges
#define HalRegisterBusHandler HALPRIVATEDISPATCH->HalRegisterBusHandler
#define HalSetWakeEnable HALPRIVATEDISPATCH->HalSetWakeEnable
#define HalSetWakeAlarm HALPRIVATEDISPATCH->HalSetWakeAlarm
#define HalPciTranslateBusAddress HALPRIVATEDISPATCH->HalPciTranslateBusAddress
#define HalPciAssignSlotResources HALPRIVATEDISPATCH->HalPciAssignSlotResources
#define HalHaltSystem HALPRIVATEDISPATCH->HalHaltSystem
#define HalFindBusAddressTranslation HALPRIVATEDISPATCH->HalFindBusAddressTranslation
#define HalResetDisplay HALPRIVATEDISPATCH->HalResetDisplay
#define HalAllocateMapRegisters HALPRIVATEDISPATCH->HalAllocateMapRegisters
#define KdSetupPciDeviceForDebugging HALPRIVATEDISPATCH->KdSetupPciDeviceForDebugging
#define KdReleasePciDeviceforDebugging HALPRIVATEDISPATCH->KdReleasePciDeviceforDebugging
#define KdGetAcpiTablePhase0 HALPRIVATEDISPATCH->KdGetAcpiTablePhase0
#define KdCheckPowerButton HALPRIVATEDISPATCH->KdCheckPowerButton
#define HalVectorToIDTEntry HALPRIVATEDISPATCH->HalVectorToIDTEntry
#define KdMapPhysicalMemory64 HALPRIVATEDISPATCH->KdMapPhysicalMemory64
#define KdUnmapVirtualAddress HALPRIVATEDISPATCH->KdUnmapVirtualAddress
//
// The DDK steals these away from you.
//
#ifdef _MSC_VER
void __cdecl _enable(void);
void __cdecl _disable(void);
#pragma intrinsic(_enable)
#pragma intrinsic(_disable)
#endif
//
// Display Functions
//
NTHALAPI
VOID
NTAPI
HalDisplayString(
IN PCHAR String
);
//
// Initialization Functions
//
NTHALAPI
BOOLEAN
NTAPI
HalAllProcessorsStarted(
VOID
);
#ifdef _ARC_
NTHALAPI
VOID
NTAPI
HalInitializeProcessor(
ULONG ProcessorNumber,
struct _LOADER_PARAMETER_BLOCK *LoaderBlock
);
NTHALAPI
BOOLEAN
NTAPI
HalInitSystem(
ULONG BootPhase,
struct _LOADER_PARAMETER_BLOCK *LoaderBlock
);
NTHALAPI
BOOLEAN
NTAPI
HalStartNextProcessor(
IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock,
IN PKPROCESSOR_STATE ProcessorState
);
#endif
NTHALAPI
VOID
NTAPI
HalReturnToFirmware(
FIRMWARE_REENTRY Action
);
//
// CPU Routines
//
NTHALAPI
VOID
NTAPI
HalProcessorIdle(
VOID
);
//
// Interrupt Functions
//
NTHALAPI
BOOLEAN
NTAPI
HalBeginSystemInterrupt(
KIRQL Irql,
UCHAR Vector,
PKIRQL OldIrql
);
VOID
FASTCALL
HalClearSoftwareInterrupt(
IN KIRQL Request
);
NTHALAPI
VOID
NTAPI
HalDisableSystemInterrupt(
UCHAR Vector,
KIRQL Irql
);
NTHALAPI
BOOLEAN
NTAPI
HalEnableSystemInterrupt(
UCHAR Vector,
KIRQL Irql,
KINTERRUPT_MODE InterruptMode
);
NTHALAPI
VOID
NTAPI
HalEndSystemInterrupt(
KIRQL Irql,
[HAL]: Rewrite IRQL handling. Alex's original code (lately translated to C) was a copy of the MicroChannel (MCA), Checked-Build HAL, an unexplained choice considering MCA is not supported or even available anymore. Windows, on machines with a PIC, uses a mechanism called Lazy IRQL, in which the PIC is only programmed "lazily", meaning that lowering and raising the IRQL does not actually change the interrupt mask. Therefore, lower priority interrupts will still come in at high IRQL. At this point, the HAL will detect this, only now mask the PICs, and lie that the lower interrupt was "spurious", while setting a pending bit. When the IRQL is lowered, the bit is detected, and a software/delayed "INT" is done with the correct IRQ vector number. More details are available in the typical resources. [HAL]: Implement support for Level interrupts, which are used by certain EISA cards, and more particularly, all PCI hardware. Level interrupts were not previously handled correctly, being treated as edge/latched interrupts instead. [NTOS/HAL]: Remove VDM Alert KPCR hack (which was buggy). Now the PKTRAP_FRAME is passed as a parameter to HalpEndSoftwareInterrupt/HalEndSystemInterrupt. This also removes the HalpNestedTrap ASM hack, since the call can now be done in C. [PERF]: On real machines, writing the PIC mask is a relatively expensive I/O operation, and IRQL lower/raise can happen hundreds of times a second. Lazy IRQL provides an important optimization. [PERF]: Correctly handling level interrupts as level interrupts allows for faster, and more efficient, IRQ handling. svn path=/trunk/; revision=45320
2010-01-29 21:10:33 +00:00
IN PKTRAP_FRAME TrapFrame
);
#ifdef _ARM_ // FIXME: ndk/arm? armddk.h?
ULONG
HalGetInterruptSource(
VOID
);
#endif
NTHALAPI
VOID
NTAPI
HalReportResourceUsage(
VOID
);
NTHALAPI
VOID
FASTCALL
HalRequestSoftwareInterrupt(
KIRQL SoftwareInterruptRequested
);
NTHALAPI
VOID
NTAPI
HalRequestIpi(
KAFFINITY TargetSet
);
NTHALAPI
VOID
NTAPI
HalHandleNMI(
PVOID NmiInfo
);
NTHALAPI
UCHAR
FASTCALL
HalSystemVectorDispatchEntry(
IN ULONG Vector,
OUT PKINTERRUPT_ROUTINE **FlatDispatch,
OUT PKINTERRUPT_ROUTINE *NoConnection
);
//
// Environment Functions
//
#ifdef _ARC_
NTHALAPI
ARC_STATUS
NTAPI
HalSetEnvironmentVariable(
IN PCH Name,
IN PCH Value
);
NTHALAPI
ARC_STATUS
NTAPI
HalGetEnvironmentVariable(
IN PCH Variable,
IN USHORT Length,
OUT PCH Buffer
);
#endif
//
// Profiling Functions
//
VOID
NTAPI
HalStartProfileInterrupt(
IN KPROFILE_SOURCE ProfileSource
);
NTHALAPI
VOID
NTAPI
HalStopProfileInterrupt(
IN KPROFILE_SOURCE ProfileSource
);
NTHALAPI
ULONG_PTR
NTAPI
HalSetProfileInterval(
IN ULONG_PTR Interval
);
//
// Time Functions
//
NTHALAPI
BOOLEAN
NTAPI
HalQueryRealTimeClock(
IN PTIME_FIELDS RtcTime
);
NTHALAPI
BOOLEAN
NTAPI
HalSetRealTimeClock(
IN PTIME_FIELDS RtcTime
);
NTHALAPI
ULONG
NTAPI
HalSetTimeIncrement(
IN ULONG Increment
);
- Update NDK to remove zwfuncs.h and place the native functions in their respective xxfuncs.h instead, so that applications can now include only what they need. Add more xxfuncs.h files for every API. - Make the NDK smarter so that using #define NTOS_MODE_USER isn't needed anymore: the NDK can now auto-detect the presence of windows.h or ntddk.h and make the appropriate decision. - re-arrange ntndk.h to include all types in alphabetical order, and then all functions, regardless of um/kmode usage. - Make each file auto-detect if this is NTOS_MODE_USER or not and include each files it needs, instead of depending on a predefined order inside ntndk.h This way, any file can be included from both user-mode or kmode as simply as #include <iofuncs.h>, wthout any adtional work. - Update FIXME list with these changes and delay NDK release date since my trip is lasting a day longer. - Fix ntsecapi.h to define UNICODE_STRING, like it does in the PSDK. - Fix apps including ntsecapi + winternl.h These two cause a conflict even on PSDK and shouldn't be included together. - Make winlogon include only the NDK files it needs (2) instead of the whole NDK, as test for this faster newly supported method. - Remove some NDK apps from the FIXME list (the ones that weren't being built/are on my rewrite branch/are better off including the whole NDK instead of file-by-file). - Update debug.h to define RtlAssert and DbgPrint in case the NDK or DDK aren't already included, which will allow some of the apps to stop using the NDK solely for DPRINT/DPRINT1. Diabled for now since a lot of code needs to be changed to #include <debug.h> *After* they include the other headers. (so that the anti-double-definition check can work). svn path=/trunk/; revision=19538
2005-11-25 00:17:40 +00:00
#endif
#endif