[FREELDR:NTLDR] Compile EMS support on all platforms

EMS support isn't platform-specific, so we can compile it everywhere
(as this is already done for the kernel and the SAC driver).

The only platform-specific code currently existing is the retrieval of
the system GUID, which is done on BIOS-based PC by reading the SMBIOS
table in the low-MB ROM region, but should be done differently on other
platforms. Add a compile-time warning for this.
This commit is contained in:
Hermès Bélusca-Maïto
2026-03-16 20:00:48 +01:00
parent 9a652291cb
commit ea93b886df
5 changed files with 25 additions and 11 deletions

View File

@@ -125,6 +125,16 @@ void MEMORY_WRITE_BREAKPOINT4(unsigned long addr);
#endif // DBG
#define __STRING2__(x) #x
#define __STRING__(x) __STRING2__(x)
#define __STRLINE__ __STRING__(__LINE__)
#if !defined(_MSC_VER) && !defined(__pragma)
#define __pragma(x) _Pragma(#x)
#endif
#define _WARN(msg) __pragma(message("WARNING! Line " __STRLINE__ ": " msg))
DECLSPEC_NORETURN
void
NTAPI

View File

@@ -47,6 +47,7 @@ VOID
WinLdrLoadGUID(
_Out_ PGUID SystemGuid)
{
#if (defined(_M_IX86) || defined(_M_AMD64)) && !defined(UEFIBOOT)
PSYSID_UUID_ENTRY CurrentAddress;
CurrentAddress = (PSYSID_UUID_ENTRY)0xE0000;
@@ -59,6 +60,9 @@ WinLdrLoadGUID(
}
CurrentAddress = (PSYSID_UUID_ENTRY)((ULONG_PTR)CurrentAddress + 1);
}
#else
_WARN("WinLdrLoadGUID needs SMBIOS table reading implementation on this platform!");
#endif
RtlZeroMemory(SystemGuid, SYSID_UUID_DATA_SIZE);
}
@@ -251,11 +255,14 @@ WinLdrSetupEms(
}
else
{
LoaderRedirectionInformation.PortAddress = (PUCHAR)strtoul(Option, 0, 16);
#ifdef _WIN64
#define strtoulptr strtoull
#else
#define strtoulptr strtoul
#endif
LoaderRedirectionInformation.PortAddress = (PUCHAR)strtoulptr(Option, 0, 16);
if (LoaderRedirectionInformation.PortAddress)
{
LoaderRedirectionInformation.PortNumber = 3;
}
}
}

View File

@@ -1193,10 +1193,8 @@ LoadAndBootWindowsCommon(
ASSERT(OperatingSystemVersion != 0);
#ifdef _M_IX86
/* Setup redirection support */
WinLdrSetupEms(BootOptions);
#endif
/* Convert BootPath to SystemRoot */
SystemRoot = strstr(BootPath, "\\");

View File

@@ -18,6 +18,7 @@ list(APPEND ROSLOAD_SOURCE
lib/rtl/libsupp.c
${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmboot.c
ntldr/conversion.c
ntldr/headless.c
ntldr/inffile.c
ntldr/registry.c
ntldr/setupldr.c
@@ -32,8 +33,7 @@ if(ARCH STREQUAL "i386")
arch/i386/halstub.c
arch/i386/ntoskrnl.c
disk/scsiport.c
ntldr/arch/i386/winldr.c
ntldr/headless.c)
ntldr/arch/i386/winldr.c)
list(APPEND ROSLOAD_ASM_SOURCE
arch/i386/drvmap.S
@@ -46,8 +46,7 @@ elseif(ARCH STREQUAL "amd64")
list(APPEND ROSLOAD_ASM_SOURCE
arch/amd64/misc.S
arch/amd64/linux.S
)
arch/amd64/linux.S)
elseif(ARCH STREQUAL "arm")

View File

@@ -56,6 +56,7 @@ add_asm_files(uefifreeldr_common_asm ${FREELDR_COMMON_ASM_SOURCE} ${UEFILDR_COMM
list(APPEND FREELDR_NTLDR_SOURCE
${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmboot.c
ntldr/conversion.c
ntldr/headless.c
ntldr/inffile.c
ntldr/registry.c
ntldr/setupldr.c
@@ -65,8 +66,7 @@ list(APPEND FREELDR_NTLDR_SOURCE
if(ARCH STREQUAL "i386")
list(APPEND FREELDR_NTLDR_SOURCE
ntldr/arch/i386/winldr.c
ntldr/headless.c)
ntldr/arch/i386/winldr.c)
elseif(ARCH STREQUAL "amd64")
list(APPEND FREELDR_NTLDR_SOURCE
ntldr/arch/amd64/winldr.c)