From f3c01aa9beacc44a91811f0ec27d09d13ecb0fda Mon Sep 17 00:00:00 2001 From: Sergey Isakov Date: Thu, 19 Dec 2019 14:14:54 +0300 Subject: [PATCH] check more Scope false search Signed-off-by: Sergey Isakov --- cbuild.bat | 8 +++++--- rEFIt_UEFI/Platform/FixBiosDsdt.c | 24 +++++++++++++++++++++--- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/cbuild.bat b/cbuild.bat index 20291f7be..0292e7fdc 100644 --- a/cbuild.bat +++ b/cbuild.bat @@ -30,10 +30,12 @@ set DEVSTAGE= set IASL_PREFIX=c:\ASL\ set DEFAULT_CYGWIN_HOME=c:\cygwin -set DEFAULT_PYTHONHOME= +rem set DEFAULT_PYTHONHOME= rem d:\Program File\Python37" -set DEFAULT_PYTHON_FREEZER_PATH=%PYTHON_HOME%\Scripts -set PYTHON3_ENABLE=FALSE +rem set DEFAULT_PYTHON_FREEZER_PATH=%PYTHON_HOME%\Scripts +set "PYTHONHOME=d:\Program File\Python37" +set "PYTHON_FREEZER_PATH=%PYTHONHOME%\Scripts" +set PYTHON3_ENABLE=TRUE set DEFAULT_NASM_PREFIX= rem C:\Program Files (x86)\NASM" rem # %DEFAULT_CYGWIN_HOME%\bin diff --git a/rEFIt_UEFI/Platform/FixBiosDsdt.c b/rEFIt_UEFI/Platform/FixBiosDsdt.c index cb25d75ba..b66d6dc8e 100644 --- a/rEFIt_UEFI/Platform/FixBiosDsdt.c +++ b/rEFIt_UEFI/Platform/FixBiosDsdt.c @@ -1375,11 +1375,11 @@ UINT32 CorrectOuterMethod (UINT8 *dsdt, UINT32 len, UINT32 adr, INT32 shift) UINT32 CorrectOuters (UINT8 *dsdt, UINT32 len, UINT32 adr, INT32 shift) { INT32 i, k; -// INT32 j; + INT32 j; UINT32 size = 0; INT32 offset = 0; // UINT32 SBSIZE = 0, SBADR = 0; -// BOOLEAN SBFound = FALSE; + BOOLEAN SBFound = FALSE; if (shift == 0) { return len; @@ -1393,7 +1393,25 @@ UINT32 CorrectOuters (UINT8 *dsdt, UINT32 len, UINT32 adr, INT32 shift) k = i + 2; } else if ((dsdt[i] == 0x10) && !CmpNum(dsdt, i, TRUE)) { //device scope like Scope (_PCI) //additional check for Field - if (!((dsdt[i - 2] == 0x5B) && (dsdt[i - 1] == 0x81))) { + // a problem with fields 52 4D 53 33 10 41 4D 45 4D + // 1. Search outer filed + // 2. check the size of the field + // 3. compare if we are in the filed + j = i - 1; + SBFound = TRUE; + while (j > 0x20) { + if (((dsdt[j - 1] == 0x5B) && (dsdt[j] == 0x81)) || + ((dsdt[j - 1] == 0x5B) && (dsdt[j] == 0x86))) { //we found a Field() or IndexField before the 0x10 will check what is it + size = get_size(dsdt, j + 1); // if it is not a size then size = 0 + if (j + size >= i) { + // it is inside a Field, skip it + SBFound = FALSE; + } + break; // other field so we stop search + } + j--; + } + if (SBFound) { k = i + 1; } }