Fix usage of KdComPortInUse
authorHervé Poussineau <hpoussin@reactos.org>
Sun, 8 Jul 2007 20:13:20 +0000 (20:13 +0000)
committerHervé Poussineau <hpoussin@reactos.org>
Sun, 8 Jul 2007 20:13:20 +0000 (20:13 +0000)
svn path=/trunk/; revision=27515

reactos/drivers/serial/serial/pnp.c
reactos/hal/hal/hal.def
reactos/hal/halx86/generic/sysinfo.c
reactos/hal/halx86/include/halp.h
reactos/include/ndk/haltypes.h
reactos/ntoskrnl/kd/kdio.c

index 621c048..a713fd0 100644 (file)
@@ -218,8 +218,7 @@ SerialPnpStartDevice(
        ComPortBase = ULongToPtr(DeviceExtension->BaseAddress);
 
        /* Test if we are trying to start the serial port used for debugging */
-    DPRINT1("KdComPort: %p\n", KdComPortInUse);
-       if (KdComPortInUse == ULongToPtr(DeviceExtension->BaseAddress))
+       if (*KdComPortInUse == ULongToPtr(DeviceExtension->BaseAddress))
        {
                DPRINT("Failing IRP_MN_START_DEVICE as this serial port is used for debugging\n");
                return STATUS_INSUFFICIENT_RESOURCES;
index 688c9a3..eb48972 100644 (file)
@@ -74,7 +74,7 @@ IoReadPartitionTable@16=HalpReadPartitionTable@16
 IoSetPartitionInformation@16=HalpSetPartitionInformation@16
 IoWritePartitionTable@20=HalpWritePartitionTable@20
 KeAcquireSpinLock@8
-KdComPortInUse=_KdComPortInUse
+KdComPortInUse=_KdComPortInUse DATA
 KeFlushWriteBuffer@0
 KeGetCurrentIrql@0
 KeLowerIrql@4
index 8968fd2..ffdb34f 100644 (file)
 #define NDEBUG
 #include <debug.h>
 
-ULONG KdComPortInUse = 0;
+#ifdef __GNUC__
+static PUCHAR realKdComPortInUse = 0;
+PUCHAR *_KdComPortInUse = &realKdComPortInUse;
+#else
+PUCHAR _KdComPortInUse = 0;
+#endif
 
 /* FUNCTIONS *****************************************************************/
 
index cb54029..f06e2ee 100644 (file)
@@ -8,9 +8,6 @@
 /* Temporary hack */
 #define KPCR_BASE   0xFF000000
 
-/* WDK Hack */
-#define KdComPortInUse          _KdComPortInUse
-
 #define HAL_APC_REQUEST         0
 #define HAL_DPC_REQUEST         1
 
index 4bfffef..eac9b0f 100644 (file)
@@ -224,7 +224,7 @@ extern NTSYSAPI HAL_PRIVATE_DISPATCH HalPrivateDispatchTable;
 // HAL Exports
 //
 #ifndef _NTHAL_
-extern PUCHAR *KdComPortInUse;
+extern DECL_IMPORT PUCHAR *KdComPortInUse;
 #endif
 
 #endif
index 7f94a10..3e48a80 100644 (file)
@@ -26,8 +26,6 @@ KD_PORT_INFORMATION SerialPortInfo = {DEFAULT_DEBUG_PORT, DEFAULT_DEBUG_BAUD_RAT
 
 /* Current Port in use. FIXME: Do we support more then one? */
 ULONG KdpPort;
-/* If serial debugging is enabled, is pointing to the UART base address. */
-PUCHAR *KdComPortInUse;
 
 /* DEBUG LOG FUNCTIONS *******************************************************/
 
@@ -99,7 +97,7 @@ KdpInitDebugLog(PKD_DISPATCH_TABLE DispatchTable,
 
     if (BootPhase == 0)
     {
-        KdComPortInUse = NULL;
+        *KdComPortInUse = NULL;
 
         /* Write out the functions that we support for now */
         DispatchTable->KdpInitRoutine = KdpInitDebugLog;
@@ -184,7 +182,7 @@ KdpSerialInit(PKD_DISPATCH_TABLE DispatchTable,
             KdpDebugMode.Serial = FALSE;
             return;
         }
-        KdComPortInUse = (PUCHAR*)&SerialPortInfo.BaseAddress;
+        *KdComPortInUse = (PUCHAR)(ULONG_PTR)SerialPortInfo.BaseAddress;
 
         /* Register as a Provider */
         InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);