]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFspWrapperPkg/FspWrapperSecCore/Vtf0/Tools/FixupForRawSection.py
IntelFspPkg&IntelFspWrapperPkg: Remove them
[mirror_edk2.git] / IntelFspWrapperPkg / FspWrapperSecCore / Vtf0 / Tools / FixupForRawSection.py
diff --git a/IntelFspWrapperPkg/FspWrapperSecCore/Vtf0/Tools/FixupForRawSection.py b/IntelFspWrapperPkg/FspWrapperSecCore/Vtf0/Tools/FixupForRawSection.py
deleted file mode 100644 (file)
index 7765c22..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-## @file\r
-#  Apply fixup to VTF binary image for FFS Raw section\r
-#\r
-#  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
-#\r
-#  SPDX-License-Identifier: BSD-2-Clause-Patent\r
-#\r
-\r
-import sys\r
-\r
-filename = sys.argv[1]\r
-\r
-if filename.lower().find('ia32') >= 0:\r
-    d = open(sys.argv[1], 'rb').read()\r
-    c = ((len(d) + 4 + 7) & ~7) - 4\r
-    if c > len(d):\r
-        c -= len(d)\r
-        f = open(sys.argv[1], 'wb')\r
-        f.write('\x90' * c)\r
-        f.write(d)\r
-        f.close()\r
-else:\r
-    from struct import pack\r
-\r
-    PAGE_PRESENT             =     0x01\r
-    PAGE_READ_WRITE          =     0x02\r
-    PAGE_USER_SUPERVISOR     =     0x04\r
-    PAGE_WRITE_THROUGH       =     0x08\r
-    PAGE_CACHE_DISABLE       =    0x010\r
-    PAGE_ACCESSED            =    0x020\r
-    PAGE_DIRTY               =    0x040\r
-    PAGE_PAT                 =    0x080\r
-    PAGE_GLOBAL              =   0x0100\r
-    PAGE_2M_MBO              =    0x080\r
-    PAGE_2M_PAT              =  0x01000\r
-\r
-    def NopAlign4k(s):\r
-        c = ((len(s) + 0xfff) & ~0xfff) - len(s)\r
-        return ('\x90' * c) + s\r
-\r
-    def PageDirectoryEntries4GbOf2MbPages(baseAddress):\r
-\r
-        s = ''\r
-        for i in range(0x800):\r
-            i = (\r
-                    baseAddress + long(i << 21) +\r
-                    PAGE_2M_MBO +\r
-                    PAGE_CACHE_DISABLE +\r
-                    PAGE_ACCESSED +\r
-                    PAGE_DIRTY +\r
-                    PAGE_READ_WRITE +\r
-                    PAGE_PRESENT\r
-                )\r
-            s += pack('Q', i)\r
-        return s\r
-\r
-    def PageDirectoryPointerTable4GbOf2MbPages(pdeBase):\r
-        s = ''\r
-        for i in range(0x200):\r
-            i = (\r
-                    pdeBase +\r
-                    (min(i, 3) << 12) +\r
-                    PAGE_CACHE_DISABLE +\r
-                    PAGE_ACCESSED +\r
-                    PAGE_READ_WRITE +\r
-                    PAGE_PRESENT\r
-                )\r
-            s += pack('Q', i)\r
-        return s\r
-\r
-    def PageMapLevel4Table4GbOf2MbPages(pdptBase):\r
-        s = ''\r
-        for i in range(0x200):\r
-            i = (\r
-                    pdptBase +\r
-                    (min(i, 0) << 12) +\r
-                    PAGE_CACHE_DISABLE +\r
-                    PAGE_ACCESSED +\r
-                    PAGE_READ_WRITE +\r
-                    PAGE_PRESENT\r
-                )\r
-            s += pack('Q', i)\r
-        return s\r
-\r
-    def First4GbPageEntries(topAddress):\r
-        PDE = PageDirectoryEntries4GbOf2MbPages(0L)\r
-        pml4tBase = topAddress - 0x1000\r
-        pdptBase = pml4tBase - 0x1000\r
-        pdeBase = pdptBase - len(PDE)\r
-        PDPT = PageDirectoryPointerTable4GbOf2MbPages(pdeBase)\r
-        PML4T = PageMapLevel4Table4GbOf2MbPages(pdptBase)\r
-        return PDE + PDPT + PML4T\r
-\r
-    def AlignAndAddPageTables():\r
-        d = open(sys.argv[1], 'rb').read()\r
-        code = NopAlign4k(d)\r
-        topAddress = 0x100000000 - len(code)\r
-        d = ('\x90' * 4) + First4GbPageEntries(topAddress) + code\r
-        f = open(sys.argv[1], 'wb')\r
-        f.write(d)\r
-        f.close()\r
-\r
-    AlignAndAddPageTables()\r
-\r