[HAL] Add NT6-compatible version of HalpMapPhysicalMemory64 and HalpUnmapVirtualAddress 359/head
authorDenis Malikov <filedem@gmail.com>
Sun, 4 Feb 2018 15:59:21 +0000 (22:59 +0700)
committerThomas Faber <thomas.faber@reactos.org>
Sun, 5 Aug 2018 08:14:57 +0000 (10:14 +0200)
hal/halx86/acpi/busemul.c
hal/halx86/generic/memory.c
hal/halx86/include/halp.h
hal/halx86/legacy/bussupp.c

index 17697a4..87ff519 100644 (file)
@@ -26,8 +26,13 @@ HalpRegisterKdSupportFunctions(VOID)
 
     /* Register memory functions */
 #ifndef _MINIHAL_
+#if (NTDDI_VERSION >= NTDDI_VISTA)
+    KdMapPhysicalMemory64 = HalpMapPhysicalMemory64Vista;
+    KdUnmapVirtualAddress = HalpUnmapVirtualAddressVista;
+#else
     KdMapPhysicalMemory64 = HalpMapPhysicalMemory64;
     KdUnmapVirtualAddress = HalpUnmapVirtualAddress;
+#endif
 #endif
 
     /* Register ACPI stub */
index 587503f..14b7f67 100644 (file)
@@ -139,6 +139,23 @@ PVOID
 NTAPI
 HalpMapPhysicalMemory64(IN PHYSICAL_ADDRESS PhysicalAddress,
                         IN PFN_COUNT PageCount)
+{
+    return HalpMapPhysicalMemory64Vista(PhysicalAddress, PageCount, TRUE);
+}
+
+VOID
+NTAPI
+HalpUnmapVirtualAddress(IN PVOID VirtualAddress,
+                        IN PFN_COUNT PageCount)
+{
+    HalpUnmapVirtualAddressVista(VirtualAddress, PageCount, TRUE);
+}
+
+PVOID
+NTAPI
+HalpMapPhysicalMemory64Vista(IN PHYSICAL_ADDRESS PhysicalAddress,
+                             IN PFN_COUNT PageCount,
+                             IN BOOLEAN FlushCurrentTLB)
 {
     PHARDWARE_PTE PointerPte;
     PFN_NUMBER UsedPages = 0;
@@ -199,14 +216,17 @@ HalpMapPhysicalMemory64(IN PHYSICAL_ADDRESS PhysicalAddress,
     }
 
     /* Flush the TLB and return the address */
-    HalpFlushTLB();
+    if (FlushCurrentTLB)
+        HalpFlushTLB();
+
     return VirtualAddress;
 }
 
 VOID
 NTAPI
-HalpUnmapVirtualAddress(IN PVOID VirtualAddress,
-                        IN PFN_COUNT PageCount)
+HalpUnmapVirtualAddressVista(IN PVOID VirtualAddress,
+                             IN PFN_COUNT PageCount,
+                             IN BOOLEAN FlushCurrentTLB)
 {
     PHARDWARE_PTE PointerPte;
     ULONG i;
@@ -226,7 +246,8 @@ HalpUnmapVirtualAddress(IN PVOID VirtualAddress,
     }
 
     /* Flush the TLB */
-    HalpFlushTLB();
+    if (FlushCurrentTLB)
+        HalpFlushTLB();
 
     /* Put the heap back */
     if (HalpHeapStart > VirtualAddress) HalpHeapStart = VirtualAddress;
index ed43091..a8e935f 100644 (file)
@@ -646,6 +646,22 @@ HalpAllocPhysicalMemory(
     IN BOOLEAN Aligned
 );
 
+PVOID
+NTAPI
+HalpMapPhysicalMemory64Vista(
+    IN PHYSICAL_ADDRESS PhysicalAddress,
+    IN PFN_COUNT PageCount,
+    IN BOOLEAN FlushCurrentTLB
+);
+
+VOID
+NTAPI
+HalpUnmapVirtualAddressVista(
+    IN PVOID VirtualAddress,
+    IN PFN_COUNT NumberPages,
+    IN BOOLEAN FlushCurrentTLB
+);
+
 PVOID
 NTAPI
 HalpMapPhysicalMemory64(
index 595bdef..a37d875 100644 (file)
@@ -1228,8 +1228,13 @@ HalpRegisterKdSupportFunctions(VOID)
 
     /* Register memory functions */
 #ifndef _MINIHAL_
+#if (NTDDI_VERSION >= NTDDI_VISTA)
+    KdMapPhysicalMemory64 = HalpMapPhysicalMemory64Vista;
+    KdUnmapVirtualAddress = HalpUnmapVirtualAddressVista;
+#else
     KdMapPhysicalMemory64 = HalpMapPhysicalMemory64;
     KdUnmapVirtualAddress = HalpUnmapVirtualAddress;
+#endif
 #endif
 
     /* Register ACPI stub */