mirror of
https://github.com/reactos/reactos
synced 2025-10-05 16:02:58 +02:00
[FREELDR] Fix the DPTE validity check, addendum to commit 4190b48924
Which is also an addendum to commit b3f11cfb38
(r17484).
The Enhanced Disk Drive Specification tells us that if the (far) pointer
to the Device Parameter Table Extension is set to FFFF:FFFF, the pointer
is invalid.
However there are some BIOSes, incl UEFI ones when running in Legacy
mode (e.g. GIGABYTE UEFI DualBIOS), that set this pointer to 0000:0000
instead, which is also an invalid value.
This commit is contained in:
@@ -346,8 +346,10 @@ DiskGetExtendedDriveParameters(
|
||||
if (Ptr[0] >= 0x1e)
|
||||
{
|
||||
// Ptr[13]: offset, Ptr[14]: segment
|
||||
TRACE("EDD configuration parameters: %x:%x\n", Ptr[14], Ptr[13]);
|
||||
if (Ptr[13] != 0xffff && Ptr[14] != 0xffff)
|
||||
TRACE("EDD configuration parameters (DPTE): %x:%x\n", Ptr[14], Ptr[13]);
|
||||
/* The DPTE pointer is valid if it's != FFFF:FFFF (per the Enhanced Disk
|
||||
* Drive Specification), but also, when it's != 0000:0000 (broken BIOSes) */
|
||||
if (!(Ptr[13] == 0xFFFF && Ptr[14] == 0xFFFF) && !(Ptr[13] == 0 && Ptr[14] == 0))
|
||||
{
|
||||
PUCHAR SpecPtr = (PUCHAR)(ULONG_PTR)((Ptr[14] << 4) + Ptr[13]);
|
||||
TRACE("SpecPtr: 0x%x\n", SpecPtr);
|
||||
|
Reference in New Issue
Block a user