Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 


Mov AX, 0xDEAD

ACPI Patcher at boot time

Recommended Posts

Dedicated to fans of windows XP/2003 running on moderm (Acpi 2.0) PC :)
Main purpose of patcher is help with eliminate/fixing Acpi 2.0 opcodes and 64-bit fields/regions/math without touching bios. Patch modify acpi tables every time when os start, it change current state of acpi tables in RAM memory (Bios load tables from flash chips to ram). Patcher works only with CSM (compatibility) mode, it will never works in UEFI boot mode.
 
Using:
1) All custom files must named in old "8.3" DOS way !
2) Create folder "ACPI_PAT" at root of you boot drive where installed target OS, this folder is place for storing all custom files (except bootloader)
3) Replace original bootloader (NTLDR for windows 2000/2003/XP, BOOTMGR for Vista/7/8/10, GRLDR for grub4dos) with patcher, original bootloader save as "xpldr" in ACPI_PAT folder
4) Place acpi_pat.img at ACPI_PAT folder
5) 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 !!!
[SSDT3]                    - patch 3rd ssdt table,  order of the ssdt table is determined by its position in the rsdt/xsdt tables
[SSDT*]                    - special name to modify all ssdt tables
; patch1                   - comments 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 version
test2.hex                 - HEX is text format of "Find&Replace" hex strings

 

 
6) Order of applying patches is up-to-down, better to place first .bin patch, then .dif or .hex
 
7) 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, size of table will be changed dynamicaly
 
8) Patcher supplied with 3 versions of iasl compiler/decompiler:

IA201604.EXE
IA201612.EXE
IA201904.EXE

These versions are equivalent of 20160422, 20161222, 20190405 at acpica.org
Default version for processing dsdt/ssdt tables maded before 2016-12-31 is IA201612.EXE, for later dates is IA201904.EXE.
You can also use your own version (DOS VERSION, compile yourself from acpica sources), name it "iaXXXX.exe" and place inside EXE.7z archive on floppy image.
 
9) Examples of .dif format:
Fix BNUM Decompiling Bug:

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

Fix Resource conflicting on Windows XP for Gigabyte 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/remove "-u6" option) Diff :

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 ASL text. So context of  .dif file is in most cases bound to specific version of the compiler

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


11) 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
 
12) When using .bin files,  take care about override DSDT/SSDT tables, "template" from BIOS image is bad choice for such files. Bios patch some parts inside table before deploying to OS (bios usualy set absolute adresses). In this case run OS and save tables from runned state.

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
inih by benhoyt


Internals & Hacks:
- acpi_pat.img is bootable 2.88MB FAT12 floppy image with FreeDOS & utils
- When pressing any SHIFT key when starting, Patcher will go to debug mode, it will stop loading OS and run shell
- Patcher replace original bootloader with grub4dos, when all job is 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)

Download Binaries
https://github.com/MovAX0xDEAD/ACPI-Patcher/releases
Download Sources
https://github.com/MovAX0xDEAD/ACPI-Patcher

Edited by Mov AX, 0xDEAD
  • Like 3
  • Upvote 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...