Author: hpoussin Date: Wed Mar 3 22:56:52 2010 New Revision: 45809
URL: http://svn.reactos.org/svn/reactos?rev=45809&view=rev Log: [hal] Add a mini-HAL static library Mostly the same thing as the real one, except interrupts and DMA
Modified: trunk/reactos/hal/halx86/generic/bios.c trunk/reactos/hal/halx86/generic/bus/halbus.c trunk/reactos/hal/halx86/generic/bus/pcibus.c trunk/reactos/hal/halx86/generic/bus/pcidata.c trunk/reactos/hal/halx86/generic/display.c trunk/reactos/hal/halx86/generic/dma.c trunk/reactos/hal/halx86/generic/halinit.c trunk/reactos/hal/halx86/generic/misc.c trunk/reactos/hal/halx86/generic/pic.c trunk/reactos/hal/halx86/generic/reboot.c trunk/reactos/hal/halx86/generic/systimer.S trunk/reactos/hal/halx86/generic/timer.c trunk/reactos/hal/halx86/generic/usage.c trunk/reactos/hal/halx86/hal_generic.rbuild trunk/reactos/hal/halx86/include/hal.h
Modified: trunk/reactos/hal/halx86/generic/bios.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/bios.c?r... ============================================================================== --- trunk/reactos/hal/halx86/generic/bios.c [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/generic/bios.c [iso-8859-1] Wed Mar 3 22:56:52 2010 @@ -196,6 +196,7 @@
/* V86 TRAP HANDLERS **********************************************************/
+#ifndef _MINIHAL_ VOID FASTCALL DECLSPEC_NORETURN @@ -234,6 +235,7 @@ longjmp(HalpSavedContext, 1); UNREACHABLE; } +#endif
/* V8086 ENTER ****************************************************************/
@@ -497,6 +499,7 @@ HalpFlushTLB(); }
+#ifndef _MINIHAL_ VOID NTAPI HalpSwitchToRealModeTrapHandlers(VOID) @@ -517,6 +520,7 @@ // KeRegisterInterruptHandler(6, HalpTrap06); } +#endif
VOID NTAPI @@ -626,6 +630,7 @@ HalpFlushTLB(); }
+#ifndef _MINIHAL_ BOOLEAN NTAPI HalpBiosDisplayReset(VOID) @@ -695,5 +700,6 @@ __writeeflags(Flags); return TRUE; } +#endif
/* EOF */
Modified: trunk/reactos/hal/halx86/generic/bus/halbus.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/bus/halb... ============================================================================== --- trunk/reactos/hal/halx86/generic/bus/halbus.c [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/generic/bus/halbus.c [iso-8859-1] Wed Mar 3 22:56:52 2010 @@ -27,8 +27,10 @@ KdReleasePciDeviceforDebugging = HalpReleasePciDeviceForDebugging;
/* Register memory functions */ +#ifndef _MINIHAL_ KdMapPhysicalMemory64 = HalpMapPhysicalMemory64; KdUnmapVirtualAddress = HalpUnmapVirtualAddress; +#endif
/* Register ACPI stub */ KdCheckPowerButton = HalpCheckPowerButton;
Modified: trunk/reactos/hal/halx86/generic/bus/pcibus.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/bus/pcib... ============================================================================== --- trunk/reactos/hal/halx86/generic/bus/pcibus.c [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/generic/bus/pcibus.c [iso-8859-1] Wed Mar 3 22:56:52 2010 @@ -702,6 +702,7 @@ NTAPI HalpQueryPciRegistryInfo(VOID) { +#ifndef _MINIHAL_ WCHAR NameBuffer[8]; OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING KeyName, ConfigName, IdentName; @@ -924,6 +925,9 @@
/* Return it */ return PciRegistryInfo; +#else + return NULL; +#endif }
VOID
Modified: trunk/reactos/hal/halx86/generic/bus/pcidata.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/bus/pcid... ============================================================================== --- trunk/reactos/hal/halx86/generic/bus/pcidata.c [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/generic/bus/pcidata.c [iso-8859-1] Wed Mar 3 22:56:52 2010 @@ -14,6 +14,7 @@
/* GLOBALS *******************************************************************/
+#ifndef _MINIHAL_ CHAR ClassTable[3922] = { 0x43, 0x20, 0x30, 0x30, 0x20, 0x20, 0x55, 0x6E, 0x63, 0x6C, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, @@ -40415,3 +40416,4 @@ 0x20, 0x49, 0x6C, 0x6C, 0x65, 0x67, 0x61, 0x6C, 0x20, 0x56, 0x65, 0x6E, 0x64, 0x6F, 0x72, 0x20, 0x49, 0x44, 0x00, }; +#endif
Modified: trunk/reactos/hal/halx86/generic/display.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/display.... ============================================================================== --- trunk/reactos/hal/halx86/generic/display.c [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/generic/display.c [iso-8859-1] Wed Mar 3 22:56:52 2010 @@ -31,8 +31,10 @@ NTAPI HalDisplayString(IN PCH String) { +#ifndef _MINIHAL_ /* Call the Inbv driver */ InbvDisplayString(String); +#endif }
/*
Modified: trunk/reactos/hal/halx86/generic/dma.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/dma.c?re... ============================================================================== --- trunk/reactos/hal/halx86/generic/dma.c [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/generic/dma.c [iso-8859-1] Wed Mar 3 22:56:52 2010 @@ -75,11 +75,15 @@ #define NDEBUG #include <debug.h>
+#ifndef _MINIHAL_ static KEVENT HalpDmaLock; static LIST_ENTRY HalpDmaAdapterList; static PADAPTER_OBJECT HalpEisaAdapter[8]; +#endif static BOOLEAN HalpEisaDma; +#ifndef _MINIHAL_ static PADAPTER_OBJECT HalpMasterAdapter; +#endif
static const ULONG_PTR HalpEisaPortPage[8] = { FIELD_OFFSET(DMA_PAGE, Channel0), @@ -92,6 +96,7 @@ FIELD_OFFSET(DMA_PAGE, Channel7) };
+#ifndef _MINIHAL_ static DMA_OPERATIONS HalpDmaOperations = { sizeof(DMA_OPERATIONS), (PPUT_DMA_ADAPTER)HalPutDmaAdapter, @@ -111,6 +116,7 @@ NULL /*(PBUILD_SCATTER_GATHER_LIST)HalBuildScatterGatherList*/, NULL /*(PBUILD_MDL_FROM_SCATTER_GATHER_LIST)HalBuildMdlFromScatterGatherList*/ }; +#endif
#define MAX_MAP_REGISTERS 64
@@ -118,6 +124,7 @@
/* FUNCTIONS *****************************************************************/
+#ifndef _MINIHAL_ VOID HalpInitDma(VOID) { @@ -154,6 +161,7 @@ */ HalGetDmaAdapter = HalpGetDmaAdapter; } +#endif
/** * @name HalpGetAdapterMaximumPhysicalAddress @@ -185,6 +193,7 @@ return HighestAddress; }
+#ifndef _MINIHAL_ /** * @name HalpGrowMapBuffers * @@ -428,6 +437,7 @@
return AdapterObject; } +#endif
/** * @name HalpDmaInitializeEisaAdapter @@ -564,6 +574,7 @@ return TRUE; }
+#ifndef _MINIHAL_ /** * @name HalGetAdapter * @@ -896,6 +907,7 @@ Length, CacheEnabled ? MmCached : MmNonCached); } +#endif
/** * @name HalpDmaGetDmaAlignment @@ -984,6 +996,7 @@ return Count; }
+#ifndef _MINIHAL_ /** * @name HalpGrowMapBufferWorker * @@ -1893,6 +1906,7 @@ */ return PhysicalAddress; } +#endif
/** * @name HalFlushCommonBuffer
Modified: trunk/reactos/hal/halx86/generic/halinit.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/halinit.... ============================================================================== --- trunk/reactos/hal/halx86/generic/halinit.c [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/generic/halinit.c [iso-8859-1] Wed Mar 3 22:56:52 2010 @@ -91,8 +91,10 @@ KeBugCheckEx(MISMATCHED_HAL, 1, Prcb->MajorVersion, 1, 0); }
+#ifndef _MINIHAL_ /* Initialize the PICs */ HalpInitializePICs(TRUE); +#endif
/* Force initial PIC state */ KfRaiseIrql(KeGetCurrentIrql()); @@ -107,9 +109,17 @@ HalQuerySystemInformation = HaliQuerySystemInformation; HalSetSystemInformation = HaliSetSystemInformation; HalInitPnpDriver = NULL; // FIXME: TODO +#ifndef _MINIHAL_ HalGetDmaAdapter = HalpGetDmaAdapter; +#else + HalGetDmaAdapter = NULL; +#endif HalGetInterruptTranslator = NULL; // FIXME: TODO +#ifndef _MINIHAL_ HalResetDisplay = HalpBiosDisplayReset; +#else + HalResetDisplay = NULL; +#endif HalHaltSystem = HaliHaltSystem;
/* Register IRQ 2 */ @@ -125,8 +135,10 @@ /* Setup busy waiting */ HalpCalibrateStallExecution();
+#ifndef _MINIHAL_ /* Initialize the clock */ HalpInitializeClock(); +#endif
/* * We could be rebooting with a pending profile interrupt, @@ -142,6 +154,7 @@ /* Initialize bus handlers */ HalpInitBusHandler();
+#ifndef _MINIHAL_ /* Enable IRQ 0 */ HalpEnableInterruptHandler(IDT_DEVICE, 0, @@ -160,6 +173,7 @@
/* Initialize DMA. NT does this in Phase 0 */ HalpInitDma(); +#endif
/* Do some HAL-specific initialization */ HalpInitPhase1();
Modified: trunk/reactos/hal/halx86/generic/misc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/misc.c?r... ============================================================================== --- trunk/reactos/hal/halx86/generic/misc.c [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/generic/misc.c [iso-8859-1] Wed Mar 3 22:56:52 2010 @@ -28,6 +28,7 @@ return; }
+#ifndef _MINIHAL_ PVOID NTAPI HalpMapPhysicalMemory64(IN PHYSICAL_ADDRESS PhysicalAddress, @@ -51,6 +52,7 @@ // MmUnmapIoSpace(VirtualAddress, NumberPages << PAGE_SHIFT); } +#endif
VOID NTAPI @@ -122,6 +124,7 @@ NTAPI HalHandleNMI(IN PVOID NmiInfo) { +#ifndef _MINIHAL_ SYSTEM_CONTROL_PORT_B_REGISTER SystemControl;
// @@ -202,6 +205,7 @@ // Halt the system // InbvDisplayString("\n*** The system has halted ***\n"); +#endif
// // Enter the debugger if possible
Modified: trunk/reactos/hal/halx86/generic/pic.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/pic.c?re... ============================================================================== --- trunk/reactos/hal/halx86/generic/pic.c [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/generic/pic.c [iso-8859-1] Wed Mar 3 22:56:52 2010 @@ -14,6 +14,7 @@
/* GLOBALS ********************************************************************/
+#ifndef _MINIHAL_ /* * This table basically keeps track of level vs edge triggered interrupts. * Windows has 250+ entries, but it seems stupid to replicate that since the PIC @@ -1335,3 +1336,28 @@ } }
+#else + +KIRQL +NTAPI +KeGetCurrentIrql(VOID) +{ + return PASSIVE_LEVEL; +} + +VOID +FASTCALL +KfLowerIrql( + IN KIRQL OldIrql) +{ +} + +KIRQL +FASTCALL +KfRaiseIrql( + IN KIRQL NewIrql) +{ + return NewIrql; +} + +#endif
Modified: trunk/reactos/hal/halx86/generic/reboot.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/reboot.c... ============================================================================== --- trunk/reactos/hal/halx86/generic/reboot.c [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/generic/reboot.c [iso-8859-1] Wed Mar 3 22:56:52 2010 @@ -98,8 +98,10 @@ case HalHaltRoutine: case HalRebootRoutine:
+#ifndef _MINIHAL_ /* Acquire the display */ InbvAcquireDisplayOwnership(); +#endif
/* Call the internal reboot function */ HalpReboot();
Modified: trunk/reactos/hal/halx86/generic/systimer.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/systimer... ============================================================================== --- trunk/reactos/hal/halx86/generic/systimer.S [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/generic/systimer.S [iso-8859-1] Wed Mar 3 22:56:52 2010 @@ -329,6 +329,7 @@ ret .endfunc
+#ifndef _MINIHAL_ .globl _KeStallExecutionProcessor@4 .func KeStallExecutionProcessor@4 _KeStallExecutionProcessor@4: @@ -359,6 +360,7 @@ /* Return */ ret 4 .endfunc +#endif
.global _KeQueryPerformanceCounter@4 .func KeQueryPerformanceCounter@4
Modified: trunk/reactos/hal/halx86/generic/timer.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/timer.c?... ============================================================================== --- trunk/reactos/hal/halx86/generic/timer.c [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/generic/timer.c [iso-8859-1] Wed Mar 3 22:56:52 2010 @@ -109,6 +109,7 @@ HalpCurrentRollOver = RollOver; }
+#ifndef _MINIHAL_ VOID FASTCALL HalpClockInterruptHandler(IN PKTRAP_FRAME TrapFrame) @@ -160,6 +161,7 @@ /* Spurious, just end the interrupt */ KiEoiHelper(TrapFrame); } +#endif
/* PUBLIC FUNCTIONS ***********************************************************/
Modified: trunk/reactos/hal/halx86/generic/usage.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/usage.c?... ============================================================================== --- trunk/reactos/hal/halx86/generic/usage.c [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/generic/usage.c [iso-8859-1] Wed Mar 3 22:56:52 2010 @@ -63,6 +63,7 @@ HalpIDTUsage[SystemVector].BusReleativeVector = BusVector; }
+#ifndef _MINIHAL_ VOID NTAPI HalpEnableInterruptHandler(IN UCHAR Flags, @@ -87,6 +88,7 @@ /* Enable the interrupt */ HalEnableSystemInterrupt(SystemVector, Irql, Mode); } +#endif
/* * @unimplemented
Modified: trunk/reactos/hal/halx86/hal_generic.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/hal_generic.rbui... ============================================================================== --- trunk/reactos/hal/halx86/hal_generic.rbuild [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/hal_generic.rbuild [iso-8859-1] Wed Mar 3 22:56:52 2010 @@ -35,4 +35,41 @@ <pch>hal.h</pch> </directory> </module> + <module name="mini_hal" type="objectlibrary"> + <include>include</include> + <include base="ntoskrnl">include</include> + <define name="_NTHAL_" /> + <define name="_NTSYSTEM_" /> + <define name="_MINIHAL_" /> + <directory name="generic"> + <directory name="bus"> + <file>bushndlr.c</file> + <file>isabus.c</file> + <file>halbus.c</file> + <file>pcibus.c</file> + <file>pcidata.c</file> + <file>sysbus.c</file> + </directory> + <file>beep.c</file> + <file>bios.c</file> + <file>cmos.c</file> + <file>dma.c</file> + <file>display.c</file> + <file>drive.c</file> + <file>misc.c</file> + <file>pic.c</file> + <file>portio.c</file> + <file>processor.c</file> + <file>profil.c</file> + <file>reboot.c</file> + <file>spinlock.c</file> + <file>sysinfo.c</file> + <file>systimer.S</file> + <file>timer.c</file> + <file>usage.c</file> + </directory> + <directory name="up"> + <file>halinit_up.c</file> + </directory> + </module> </group>
Modified: trunk/reactos/hal/halx86/include/hal.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/include/hal.h?re... ============================================================================== --- trunk/reactos/hal/halx86/include/hal.h [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/include/hal.h [iso-8859-1] Wed Mar 3 22:56:52 2010 @@ -17,8 +17,12 @@ #undef _NTHAL_ #undef DECLSPEC_IMPORT #define DECLSPEC_IMPORT +#ifndef _MINIHAL_ #undef NTSYSAPI #define NTSYSAPI __declspec(dllimport) +#else +#undef _NTSYSTEM_ +#endif
/* IFS/DDK/NDK Headers */ #include <ntifs.h>