https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ce2d4740a6d0393870f4dcf48496f6d501870426

commit ce2d4740a6d0393870f4dcf48496f6d501870426
Author:     Adam Słaboń <[email protected]>
AuthorDate: Thu Jul 20 21:44:44 2023 +0200
Commit:     GitHub <[email protected]>
CommitDate: Thu Jul 20 21:44:44 2023 +0200

    [SDK][HAL] Enable x86Bios on x86 (#5454)
    
    This will be needed for compatibility with x86 Windows Vista/7 videoprt.sys 
builds.
    Might be also useful in future for platforms (x86 , ...) where V86 mode is 
not available or buggy.
    
    CORE-11954, CORE-18185
---
 hal/hal.spec                            | 15 ++++++++++-----
 hal/halx86/CMakeLists.txt               | 10 ++--------
 hal/halx86/generic.cmake                |  3 ++-
 hal/halx86/generic/halinit.c            |  6 ++----
 hal/halx86/{amd64 => generic}/x86bios.c |  2 ++
 hal/halx86/include/halp.h               |  3 +--
 hal/halx86/pc98.cmake                   |  3 ++-
 hal/halx86/xbox.cmake                   |  1 +
 sdk/include/ndk/halfuncs.h              |  4 ----
 sdk/include/ndk/haltypes.h              |  4 ----
 10 files changed, 22 insertions(+), 29 deletions(-)

diff --git a/hal/hal.spec b/hal/hal.spec
index 4f8e0bec939..94bb141afee 100644
--- a/hal/hal.spec
+++ b/hal/hal.spec
@@ -101,8 +101,13 @@
 @ stdcall -arch=i386,arm WRITE_PORT_UCHAR(ptr long)
 @ stdcall -arch=i386,arm WRITE_PORT_ULONG(ptr long)
 @ stdcall -arch=i386,arm WRITE_PORT_USHORT(ptr long)
-@ stdcall -arch=x86_64 x86BiosAllocateBuffer()
-@ stdcall -arch=x86_64 x86BiosCall()
-@ stdcall -arch=x86_64 x86BiosFreeBuffer()
-@ stdcall -arch=x86_64 x86BiosReadMemory()
-@ stdcall -arch=x86_64 x86BiosWriteMemory()
+@ stdcall -version=0x0502 -arch=x86_64 x86BiosAllocateBuffer(ptr ptr ptr)
+@ stdcall -version=0x0600+ -arch=i386,x86_64 x86BiosAllocateBuffer(ptr ptr ptr)
+@ stdcall -version=0x0502 -arch=x86_64 x86BiosCall(long ptr)
+@ stdcall -version=0x0600+ -arch=i386,x86_64 x86BiosCall(long ptr)
+@ stdcall -version=0x0502 -arch=x86_64 x86BiosFreeBuffer(long long)
+@ stdcall -version=0x0600+ -arch=i386,x86_64 x86BiosFreeBuffer(long long)
+@ stdcall -version=0x0502 -arch=x86_64 x86BiosReadMemory(long long ptr long)
+@ stdcall -version=0x0600+ -arch=i386,x86_64 x86BiosReadMemory(long long ptr 
long)
+@ stdcall -version=0x0502 -arch=x86_64 x86BiosWriteMemory(long long ptr long)
+@ stdcall -version=0x0600+ -arch=i386,x86_64 x86BiosWriteMemory(long long ptr 
long)
diff --git a/hal/halx86/CMakeLists.txt b/hal/halx86/CMakeLists.txt
index 50e1342f47f..dc22b0c9614 100644
--- a/hal/halx86/CMakeLists.txt
+++ b/hal/halx86/CMakeLists.txt
@@ -23,9 +23,9 @@ function(add_hal _halname)
         ${CMAKE_CURRENT_BINARY_DIR}/hal.def)
 
     if(${_halname} STREQUAL "hal")
-        target_link_libraries(${_halname} libcntpr arbiter)
+        target_link_libraries(${_halname} libcntpr arbiter fast486)
     else()
-        target_link_libraries(${_halname} libcntpr)
+        target_link_libraries(${_halname} libcntpr fast486)
     endif()
 
     add_importlibs(${_halname} ntoskrnl)
@@ -71,13 +71,7 @@ if(ARCH STREQUAL "i386")
 
 elseif(ARCH STREQUAL "amd64")
 
-    list(APPEND HAL_SOURCE
-        amd64/x86bios.c)
-
     add_hal(hal SOURCES ${HAL_SOURCE} COMPONENTS generic acpi up apic)
-    target_link_libraries(hal fast486)
-
     add_hal(halmp SOURCES ${HAL_SOURCE} COMPONENTS generic acpi smp apic)
-    target_link_libraries(halmp fast486)
 
 endif()
diff --git a/hal/halx86/generic.cmake b/hal/halx86/generic.cmake
index e9e60264e2b..b04bd23616d 100644
--- a/hal/halx86/generic.cmake
+++ b/hal/halx86/generic.cmake
@@ -13,7 +13,8 @@ list(APPEND HAL_GENERIC_SOURCE
     generic/pic.c
     generic/reboot.c
     generic/sysinfo.c
-    generic/usage.c)
+    generic/usage.c
+    generic/x86bios.c)
 
 if(ARCH STREQUAL "i386")
     list(APPEND HAL_GENERIC_SOURCE
diff --git a/hal/halx86/generic/halinit.c b/hal/halx86/generic/halinit.c
index 868e1b48ffa..bbd3c49204e 100644
--- a/hal/halx86/generic/halinit.c
+++ b/hal/halx86/generic/halinit.c
@@ -142,9 +142,8 @@ HalInitSystem(IN ULONG BootPhase,
         /* Do some HAL-specific initialization */
         HalpInitPhase0(LoaderBlock);
 
-#ifdef _M_AMD64
+        /* Initialize Phase 0 of the x86 emulator */
         HalInitializeBios(0, LoaderBlock);
-#endif
     }
     else if (BootPhase == 1)
     {
@@ -154,9 +153,8 @@ HalInitSystem(IN ULONG BootPhase,
         /* Do some HAL-specific initialization */
         HalpInitPhase1();
 
-#ifdef _M_AMD64
+        /* Initialize Phase 1 of the x86 emulator */
         HalInitializeBios(1, LoaderBlock);
-#endif
     }
 
     /* All done, return */
diff --git a/hal/halx86/amd64/x86bios.c b/hal/halx86/generic/x86bios.c
similarity index 99%
rename from hal/halx86/amd64/x86bios.c
rename to hal/halx86/generic/x86bios.c
index 80cefebc322..9a3c7e3bdfb 100644
--- a/hal/halx86/amd64/x86bios.c
+++ b/hal/halx86/generic/x86bios.c
@@ -493,6 +493,7 @@ x86BiosCall(
     return TRUE;
 }
 
+#ifdef _M_AMD64
 BOOLEAN
 NTAPI
 HalpBiosDisplayReset(VOID)
@@ -521,3 +522,4 @@ HalpBiosDisplayReset(VOID)
     return FALSE;
 #endif
 }
+#endif // _M_AMD64
diff --git a/hal/halx86/include/halp.h b/hal/halx86/include/halp.h
index 5446482dfc8..9ea22e8c3c5 100644
--- a/hal/halx86/include/halp.h
+++ b/hal/halx86/include/halp.h
@@ -555,8 +555,6 @@ HalpInitializeClockPc98(VOID);
 extern ULONG PIT_FREQUENCY;
 #endif /* SARCH_PC98 */
 
-#ifdef _M_AMD64
-
 VOID
 NTAPI
 HalInitializeBios(
@@ -564,6 +562,7 @@ HalInitializeBios(
     _In_ PLOADER_PARAMETER_BLOCK LoaderBlock
 );
 
+#ifdef _M_AMD64
 #define KfLowerIrql KeLowerIrql
 #define KiEnterInterruptTrap(TrapFrame) /* We do all neccessary in asm code */
 #define KiEoiHelper(TrapFrame) return /* Just return to the caller */
diff --git a/hal/halx86/pc98.cmake b/hal/halx86/pc98.cmake
index 3a46043df3a..3f28342eb2c 100644
--- a/hal/halx86/pc98.cmake
+++ b/hal/halx86/pc98.cmake
@@ -19,7 +19,8 @@ list(APPEND HAL_PC98_SOURCE
     generic/nmi.c
     generic/portio.c
     generic/sysinfo.c
-    generic/usage.c)
+    generic/usage.c
+    generic/x86bios.c)
 
 list(APPEND HAL_PC98_ASM_SOURCE
     generic/v86.S)
diff --git a/hal/halx86/xbox.cmake b/hal/halx86/xbox.cmake
index 90db5a730b3..4f08c0c2437 100644
--- a/hal/halx86/xbox.cmake
+++ b/hal/halx86/xbox.cmake
@@ -21,6 +21,7 @@ list(APPEND HAL_XBOX_SOURCE
     generic/usage.c
     generic/bios.c
     generic/portio.c
+    generic/x86bios.c
     legacy/bus/bushndlr.c
     legacy/bus/cmosbus.c
     legacy/bus/isabus.c
diff --git a/sdk/include/ndk/halfuncs.h b/sdk/include/ndk/halfuncs.h
index 6c5e480acb9..2c4b56075ad 100644
--- a/sdk/include/ndk/halfuncs.h
+++ b/sdk/include/ndk/halfuncs.h
@@ -298,8 +298,6 @@ HalSetTimeIncrement(
 //
 // BIOS call API
 //
-#ifdef _M_AMD64
-
 NTSTATUS
 NTAPI
 x86BiosAllocateBuffer(
@@ -335,7 +333,5 @@ x86BiosCall(
     _In_ ULONG InterruptNumber,
     _Inout_ PX86_BIOS_REGISTERS Registers);
 
-#endif // _M_AMD64
-
 #endif // NTOS_MODE_USER
 #endif // _HALFUNCS_H
diff --git a/sdk/include/ndk/haltypes.h b/sdk/include/ndk/haltypes.h
index 8e850e11c0e..ccba81a536d 100644
--- a/sdk/include/ndk/haltypes.h
+++ b/sdk/include/ndk/haltypes.h
@@ -289,8 +289,6 @@ extern NTHALAPI PUCHAR KdComPortInUse;
 //
 // BIOS call structure
 //
-#ifdef _M_AMD64
-
 typedef struct _X86_BIOS_REGISTERS
 {
     ULONG Eax;
@@ -304,8 +302,6 @@ typedef struct _X86_BIOS_REGISTERS
     USHORT SegEs;
 } X86_BIOS_REGISTERS, *PX86_BIOS_REGISTERS;
 
-#endif // _M_AMD64
-
 #endif
 #endif
 

Reply via email to