Jump to content











Photo
- - - - -

ACPI Patcher at boot time

acpi

  • Please log in to reply
4 replies to this topic

#1 Mov AX 0xDEAD

Mov AX 0xDEAD
  • Members
  • 4 posts
  •  
    Pakistan

Posted 04 June 2019 - 02:11 PM

Dedicated to fans of windows XP/2003 running on moderm (acpi 2.0) PC :)
Main purpose of patcher is eliminate/fixing acpi 2.0 opcodes and 64-bit fields/regions/math. Patch modify acpi tables every time when os start, it load current state of acpi tables from RAM memory (bios prepare its from flash chips to ram). Patcher works only with CSM (compatibility) mode, it will never works in UEFI boot mode. All custom files must named in old "8.3" DOS way !
 
Using:
1) Create folder "ACPI_PAT" at root of you boot drive where installed target OS, this folder is place for storing all custom flies (except bootloader)
2) Replace original bootloader (NTLDR for windows 2000/2003/XP, BOOTMGR for Vista/7/8/10) with patcher, original bootloader save as "XPLDR"
3) Place acpi_pat.img at ACPI_PAT folder, this is bootable 2.88MB FAT12 floppy image
4) Place main configuration file ACPI_PAT.CFG:

[DSDT]
reload.bin
bnum_fix.dif
iotr_fix.dif,201904
test1.dif
test2.hex

[SSDT1]
; patch1
;SSDT_FI1.HEX

[SSDT3]
; patch 3
;SSDT_FI3.HEX

[SSDT*]
# universal ssdt patch
#SSDT_UNI.HEX

[FACS]
;APIC_FIX.HEX

[DSDT], [SSDT]     - name of acpi table, only 4 chars !!!
[SSDT*]                  - special name to modify all ssdt tables
; patch1                  - comment start with ";" or "#"
reload.bin              - BIN override table from binary file
bnum_fix.dif           - DIF is text format for GNU Patch
iotr_fix.dif,201904  - DIF format with forcing iasl compiler/decompiler version
test2.hex               - HEX is text format of "Find&Replace" hex strings
 
4) Order of applying patches is up-to-down, better to place first .bin patch, then .dif or .hex
 
5) Example of .hex format:



; comment
706869637320/706869637420             ;without spaces
70 68 69 63 73 20 / 70 68 69 63 74 20 ;with spaces, more readable

70 68 69 63 73 20 - hex string to find
70 68 69 63 74 20 - hex string to replace
you can increase/decrease count of replaced bytes, table size will be changed dynamicaly
 
6) Patcher supplied with 3 versions of iasl compiler/decompiler:

IA201604.EXE
IA201612.EXE
IA201904.EXE

Default version for processing dsdt/ssdt tables is IA201612.EXE, you can also use your own version (DOS VERSION, compile from acpica sources), name it "iaXXXX.exe" and place inside EXE.7z archive on floppy image.
 
7) Examples of .DIF format:

Fix BNUM Bug:

--- DSDT.dsl
+++ DSDT.dsl
@@ -1,1 +1,0 @@
-    External (BNUM, UnknownObj)

Fix Resource conflicting on Windows XP for Gigabyte latest H110-hd2 bioses:

--- DSDT.dsl
+++ DSDT.dsl
@@ -1,36 +1,13 @@
                 AMI1 = ITA1 /* \ITA1 */
                 AMA1 = ITA1 /* \ITA1 */
                 AMI2 = ITA2 /* \ITA2 */
                 AMA2 = ITA2 /* \ITA2 */
                 AMI3 = ITA3 /* \ITA3 */
                 AMA3 = ITA3 /* \ITA3 */
-                If ((ITS0 == One))
-                {
-                    ConcatenateResTemplate (Local0, BUF0, Local1)
-                    Local0 = Local1
-                }
-
-                If ((ITS1 == One))
-                {
-                    ConcatenateResTemplate (Local0, BUF1, Local1)
-                    Local0 = Local1
-                }
-
-                If ((ITS2 == One))
-                {
-                    ConcatenateResTemplate (Local0, BUF2, Local1)
-                    Local0 = Local1
-                }
-
-                If ((ITS3 == One))
-                {
-                    ConcatenateResTemplate (Local0, BUF3, Local1)
-                    Local0 = Local1
-                }

                 Return (Local0)
             }
         }
     }
 
     Scope (_SB.PCI0.LPCB)

Patches generated by invoking (you can change -u6 to -u3 or remove this option):
 

diff -u6 --strip-trailing-cr OLD.DSL NEW.DSL > my_patch.dif

 
Keep in mind that different versions of the compiler generate different versions of the original acpi text. So the context .the dif file is in most cases bound to a specific version of the compiler

8) If using DIF patches, need additional file external.txt
this is text format for using iasl.exe decompiler "-fe" option like this:

External (AL6F, MethodObj, 0)
External (HLVT, MethodObj, 0)
External (P0L6, MethodObj, 0)
External (P1L6, MethodObj, 0)
External (P2L6, MethodObj, 0)
External (PS0X, MethodObj, 0)
External (PS2X, MethodObj, 0)
External (PS3X, MethodObj, 0)
External (_SB_.PCI0.GFX0.IUEH, MethodObj, 1)
External (_SB_.PCI0.GFX0.GSCI, MethodObj, 0)
External (_SB_.PCI0.PAUD.PUAM, MethodObj, 0)
External (_SB_.PCI0.PEG0.HPME, MethodObj, 0)
External (_SB_.PCI0.PEG1.HPME, MethodObj, 0)
External (_SB_.PCI0.PEG2.HPME, MethodObj, 0)
External (_SB_.PCI0.XHC_.DUAM, MethodObj, 0)
External (_SB_.PCI0.XHC_.RHUB.INIR, MethodObj, 0)
External (_SB_.PCI0.SAT0.SDSM, MethodObj, 4)
External (MDBG, MethodObj, 1)
External (_SB_.TPM_.PTS_, MethodObj, 1)

9) If using DIF patches, may be need additional file ignores.txt
this is text format for filter iasl.exe decompiler errors, example of file:

[BNUM] Namespace lookup failure, AE_ALREADY_EXISTS

Many kabylake/coffelake bioses created with uncorrected asl code around BNUM fileld, when you decompile it, you will get "ACPI Error: [BNUM] Namespace lookup failure, AE_ALREADY_EXISTS (20161222/dswload-390)" error. With ignores.txt possible to filter/ignore these errors
 
10) When using .BIN files,  take care about overloading DSDT/SSDT tables, "template" from BIOS image is not enough. Bios patch some parts inside table before deploying to OS. In this case run OS and save tables from it.

Regards & Copyrights:
FreeDOS by FreeDOS Project
SHSURDRV by Jason Hood
7zdec by Igor Pavlov/7-zip.org
Move by Joe Cosentino/Imre Leber
XCOPY by Rene Ableidinger/Eric Auer
GRUB4DOS by GRUB4DOS Developers
FAT module for grub4dos by chenall.net
Volkov Commander by Vsevolod V. Volkov
NTFS for DOS by Avira GmbH
iASL by Intel/Acpica
DJGPP  by DJ Delorie
CWSDPMI by CW Sandmann
 
Internals & Hacks:
- When pressing any SHIFT key when starting, Patcher will go to debug mode, it will stop loading OS and run shell
- Patcher replace ntldr/bootmgr with grub4dos loader
- When all done, patcher run grub4dos.exe for loading original loader
- Patcher reserve 2Mb of RAM for storing acpi tables (Windows will report -2Mb available memory)
- Before decompiling any table, all ssdt and dsdt tables stored at disk and used as external files "iasl -e ssdt1 ssdt 2 ... "
 
History:
v1 - Initial (Beta)


Edited by Mov AX 0xDEAD, 04 June 2019 - 02:29 PM.

  • Dietmar likes this

#2 Mov AX 0xDEAD

Mov AX 0xDEAD
  • Members
  • 4 posts
  •  
    Pakistan

Posted 04 June 2019 - 02:12 PM

Links to binary and git repositary will be later....



#3 Dietmar

Dietmar

    Frequent Member

  • Advanced user
  • 235 posts
  •  
    Afghanistan

Posted 04 June 2019 - 06:13 PM

@Mov AX 0xDEAD

Can your patch also be applied direct to the DSDT and SSDT tables

and flash it on Bios

 

Dietmar



#4 Mov AX 0xDEAD

Mov AX 0xDEAD
  • Members
  • 4 posts
  •  
    Pakistan

Posted 04 June 2019 - 06:34 PM

and flash it on Bios

Hi Dietmar,
Patcher is tool for modify tables at boot time before loading OS.
You dont need patcher if you can directly change bios

#5 Mov AX 0xDEAD

Mov AX 0xDEAD
  • Members
  • 4 posts
  •  
    Pakistan

Posted 06 June 2019 - 05:43 PM

Download Binaries
https://github.com/M...atcher/releases
Download Sources
https://github.com/M...AD/ACPI-Patcher


  • Dietmar likes this




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users