]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/Scripts/Ds5/system_table.py
ArmPlatformPkg/Ds5: Update script to support System Memory above the 32bit space...
[mirror_edk2.git] / ArmPlatformPkg / Scripts / Ds5 / system_table.py
index 2128e25f23bf61ce667a76b9bc05220c0ab29975..ff1db2f6e492ceaee132450ab7427f5db9da1938 100644 (file)
@@ -29,14 +29,17 @@ class DebugInfoTable:
     def get_debug_info(self):\r
         # Get the information from EFI_DEBUG_IMAGE_INFO_TABLE_HEADER\r
         count = self.ec.getMemoryService().readMemory32(self.base + 0x4)\r
-        debug_info_table_base = self.ec.getMemoryService().readMemory32(self.base + 0x8)\r
+        if edk2_debugger.is_aarch64(self.ec):\r
+            debug_info_table_base = self.ec.getMemoryService().readMemory64(self.base + 0x8)\r
+        else:\r
+            debug_info_table_base = self.ec.getMemoryService().readMemory32(self.base + 0x8)\r
         \r
         self.DebugInfos = []\r
         \r
         for i in range(0, count):\r
             # Get the address of the structure EFI_DEBUG_IMAGE_INFO\r
             if edk2_debugger.is_aarch64(self.ec):\r
-                debug_info = self.ec.getMemoryService().readMemory32(debug_info_table_base + (i * 8))\r
+                debug_info = self.ec.getMemoryService().readMemory64(debug_info_table_base + (i * 8))\r
             else:\r
                 debug_info = self.ec.getMemoryService().readMemory32(debug_info_table_base + (i * 4))\r
 \r
@@ -46,9 +49,9 @@ class DebugInfoTable:
                 if debug_info_type == 1:\r
                     if edk2_debugger.is_aarch64(self.ec):\r
                         # Get the base address of the structure EFI_LOADED_IMAGE_PROTOCOL\r
-                        loaded_image_protocol = self.ec.getMemoryService().readMemory32(debug_info + 0x8)\r
+                        loaded_image_protocol = self.ec.getMemoryService().readMemory64(debug_info + 0x8)\r
 \r
-                        image_base = self.ec.getMemoryService().readMemory32(loaded_image_protocol + 0x40)\r
+                        image_base = self.ec.getMemoryService().readMemory64(loaded_image_protocol + 0x40)\r
                         image_size = self.ec.getMemoryService().readMemory32(loaded_image_protocol + 0x48)\r
                     else:\r
                         # Get the base address of the structure EFI_LOADED_IMAGE_PROTOCOL\r
@@ -135,7 +138,10 @@ class SystemTable:
                 raise Exception('SystemTable','Fail to access System Memory. Ensure all the memory in the region [0x%x;0x%X] is accessible.' % (membase,membase+memsize))\r
             if signature == SystemTable.CONST_ST_SIGNATURE:\r
                 found = True\r
-                self.system_table_base = self.ec.getMemoryService().readMemory32(offset + 0x8)\r
+                if edk2_debugger.is_aarch64(self.ec):\r
+                    self.system_table_base = self.ec.getMemoryService().readMemory64(offset + 0x8)\r
+                else:\r
+                    self.system_table_base = self.ec.getMemoryService().readMemory32(offset + 0x8)\r
                 break\r
             offset = offset - 0x400000\r
             \r
@@ -148,7 +154,7 @@ class SystemTable:
             conf_table_entry_count = self.ec.getMemoryService().readMemory32(self.system_table_base + 0x68)
 \r
             # Get location of the Configuration Table entries\r
-            conf_table_offset = self.ec.getMemoryService().readMemory32(self.system_table_base + 0x70)\r
+            conf_table_offset = self.ec.getMemoryService().readMemory64(self.system_table_base + 0x70)\r
         else:\r
             # Number of configuration Table entry\r
             conf_table_entry_count = self.ec.getMemoryService().readMemory32(self.system_table_base + 0x40)
@@ -163,6 +169,9 @@ class SystemTable:
                 offset = conf_table_offset + (i * 0x14)\r
             guid = struct.unpack("<IIII", self.ec.getMemoryService().read(str(offset), 16, 32))\r
             if guid == conf_table_guid:\r
-                return self.ec.getMemoryService().readMemory32(offset + 0x10)\r
+                if edk2_debugger.is_aarch64(self.ec):\r
+                    return self.ec.getMemoryService().readMemory64(offset + 0x10)\r
+                else:\r
+                    return self.ec.getMemoryService().readMemory32(offset + 0x10)\r
             \r
         raise Exception('SystemTable','Configuration Table not found')\r