[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
This commit is contained in:
Adam Słaboń 2023-07-20 21:44:44 +02:00 committed by GitHub
parent 27ebedb367
commit ce2d4740a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 22 additions and 29 deletions

View file

@ -101,8 +101,13 @@
@ stdcall -arch=i386,arm WRITE_PORT_UCHAR(ptr long) @ stdcall -arch=i386,arm WRITE_PORT_UCHAR(ptr long)
@ stdcall -arch=i386,arm WRITE_PORT_ULONG(ptr long) @ stdcall -arch=i386,arm WRITE_PORT_ULONG(ptr long)
@ stdcall -arch=i386,arm WRITE_PORT_USHORT(ptr long) @ stdcall -arch=i386,arm WRITE_PORT_USHORT(ptr long)
@ stdcall -arch=x86_64 x86BiosAllocateBuffer() @ stdcall -version=0x0502 -arch=x86_64 x86BiosAllocateBuffer(ptr ptr ptr)
@ stdcall -arch=x86_64 x86BiosCall() @ stdcall -version=0x0600+ -arch=i386,x86_64 x86BiosAllocateBuffer(ptr ptr ptr)
@ stdcall -arch=x86_64 x86BiosFreeBuffer() @ stdcall -version=0x0502 -arch=x86_64 x86BiosCall(long ptr)
@ stdcall -arch=x86_64 x86BiosReadMemory() @ stdcall -version=0x0600+ -arch=i386,x86_64 x86BiosCall(long ptr)
@ stdcall -arch=x86_64 x86BiosWriteMemory() @ 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)

View file

@ -23,9 +23,9 @@ function(add_hal _halname)
${CMAKE_CURRENT_BINARY_DIR}/hal.def) ${CMAKE_CURRENT_BINARY_DIR}/hal.def)
if(${_halname} STREQUAL "hal") if(${_halname} STREQUAL "hal")
target_link_libraries(${_halname} libcntpr arbiter) target_link_libraries(${_halname} libcntpr arbiter fast486)
else() else()
target_link_libraries(${_halname} libcntpr) target_link_libraries(${_halname} libcntpr fast486)
endif() endif()
add_importlibs(${_halname} ntoskrnl) add_importlibs(${_halname} ntoskrnl)
@ -71,13 +71,7 @@ if(ARCH STREQUAL "i386")
elseif(ARCH STREQUAL "amd64") elseif(ARCH STREQUAL "amd64")
list(APPEND HAL_SOURCE
amd64/x86bios.c)
add_hal(hal SOURCES ${HAL_SOURCE} COMPONENTS generic acpi up apic) 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) add_hal(halmp SOURCES ${HAL_SOURCE} COMPONENTS generic acpi smp apic)
target_link_libraries(halmp fast486)
endif() endif()

View file

@ -13,7 +13,8 @@ list(APPEND HAL_GENERIC_SOURCE
generic/pic.c generic/pic.c
generic/reboot.c generic/reboot.c
generic/sysinfo.c generic/sysinfo.c
generic/usage.c) generic/usage.c
generic/x86bios.c)
if(ARCH STREQUAL "i386") if(ARCH STREQUAL "i386")
list(APPEND HAL_GENERIC_SOURCE list(APPEND HAL_GENERIC_SOURCE

View file

@ -142,9 +142,8 @@ HalInitSystem(IN ULONG BootPhase,
/* Do some HAL-specific initialization */ /* Do some HAL-specific initialization */
HalpInitPhase0(LoaderBlock); HalpInitPhase0(LoaderBlock);
#ifdef _M_AMD64 /* Initialize Phase 0 of the x86 emulator */
HalInitializeBios(0, LoaderBlock); HalInitializeBios(0, LoaderBlock);
#endif
} }
else if (BootPhase == 1) else if (BootPhase == 1)
{ {
@ -154,9 +153,8 @@ HalInitSystem(IN ULONG BootPhase,
/* Do some HAL-specific initialization */ /* Do some HAL-specific initialization */
HalpInitPhase1(); HalpInitPhase1();
#ifdef _M_AMD64 /* Initialize Phase 1 of the x86 emulator */
HalInitializeBios(1, LoaderBlock); HalInitializeBios(1, LoaderBlock);
#endif
} }
/* All done, return */ /* All done, return */

View file

@ -493,6 +493,7 @@ x86BiosCall(
return TRUE; return TRUE;
} }
#ifdef _M_AMD64
BOOLEAN BOOLEAN
NTAPI NTAPI
HalpBiosDisplayReset(VOID) HalpBiosDisplayReset(VOID)
@ -521,3 +522,4 @@ HalpBiosDisplayReset(VOID)
return FALSE; return FALSE;
#endif #endif
} }
#endif // _M_AMD64

View file

@ -555,8 +555,6 @@ HalpInitializeClockPc98(VOID);
extern ULONG PIT_FREQUENCY; extern ULONG PIT_FREQUENCY;
#endif /* SARCH_PC98 */ #endif /* SARCH_PC98 */
#ifdef _M_AMD64
VOID VOID
NTAPI NTAPI
HalInitializeBios( HalInitializeBios(
@ -564,6 +562,7 @@ HalInitializeBios(
_In_ PLOADER_PARAMETER_BLOCK LoaderBlock _In_ PLOADER_PARAMETER_BLOCK LoaderBlock
); );
#ifdef _M_AMD64
#define KfLowerIrql KeLowerIrql #define KfLowerIrql KeLowerIrql
#define KiEnterInterruptTrap(TrapFrame) /* We do all neccessary in asm code */ #define KiEnterInterruptTrap(TrapFrame) /* We do all neccessary in asm code */
#define KiEoiHelper(TrapFrame) return /* Just return to the caller */ #define KiEoiHelper(TrapFrame) return /* Just return to the caller */

View file

@ -19,7 +19,8 @@ list(APPEND HAL_PC98_SOURCE
generic/nmi.c generic/nmi.c
generic/portio.c generic/portio.c
generic/sysinfo.c generic/sysinfo.c
generic/usage.c) generic/usage.c
generic/x86bios.c)
list(APPEND HAL_PC98_ASM_SOURCE list(APPEND HAL_PC98_ASM_SOURCE
generic/v86.S) generic/v86.S)

View file

@ -21,6 +21,7 @@ list(APPEND HAL_XBOX_SOURCE
generic/usage.c generic/usage.c
generic/bios.c generic/bios.c
generic/portio.c generic/portio.c
generic/x86bios.c
legacy/bus/bushndlr.c legacy/bus/bushndlr.c
legacy/bus/cmosbus.c legacy/bus/cmosbus.c
legacy/bus/isabus.c legacy/bus/isabus.c

View file

@ -298,8 +298,6 @@ HalSetTimeIncrement(
// //
// BIOS call API // BIOS call API
// //
#ifdef _M_AMD64
NTSTATUS NTSTATUS
NTAPI NTAPI
x86BiosAllocateBuffer( x86BiosAllocateBuffer(
@ -335,7 +333,5 @@ x86BiosCall(
_In_ ULONG InterruptNumber, _In_ ULONG InterruptNumber,
_Inout_ PX86_BIOS_REGISTERS Registers); _Inout_ PX86_BIOS_REGISTERS Registers);
#endif // _M_AMD64
#endif // NTOS_MODE_USER #endif // NTOS_MODE_USER
#endif // _HALFUNCS_H #endif // _HALFUNCS_H

View file

@ -289,8 +289,6 @@ extern NTHALAPI PUCHAR KdComPortInUse;
// //
// BIOS call structure // BIOS call structure
// //
#ifdef _M_AMD64
typedef struct _X86_BIOS_REGISTERS typedef struct _X86_BIOS_REGISTERS
{ {
ULONG Eax; ULONG Eax;
@ -304,8 +302,6 @@ typedef struct _X86_BIOS_REGISTERS
USHORT SegEs; USHORT SegEs;
} X86_BIOS_REGISTERS, *PX86_BIOS_REGISTERS; } X86_BIOS_REGISTERS, *PX86_BIOS_REGISTERS;
#endif // _M_AMD64
#endif #endif
#endif #endif