[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_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)

View file

@ -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()

View file

@ -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

View file

@ -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 */

View file

@ -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

View file

@ -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 */

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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