self.base = debug_info_table_header_offset\r
\r
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
\r
\r
for i in range(0, count):\r
# Get the address of the structure EFI_DEBUG_IMAGE_INFO\r
- debug_info = self.ec.getMemoryService().readMemory32(debug_info_table_base + (i * 4))\r
+ if edk2_debugger.is_aarch64(self.ec):\r
+ debug_info = self.ec.getMemoryService().readMemory32(debug_info_table_base + (i * 8))\r
+ else:\r
+ debug_info = self.ec.getMemoryService().readMemory32(debug_info_table_base + (i * 4))\r
+\r
if debug_info:\r
debug_info_type = self.ec.getMemoryService().readMemory32(debug_info)\r
# Normal Debug Info Type\r
if debug_info_type == 1:\r
- # Get the base address of the structure EFI_LOADED_IMAGE_PROTOCOL\r
- loaded_image_protocol = self.ec.getMemoryService().readMemory32(debug_info + 0x4)\r
- \r
- image_base = self.ec.getMemoryService().readMemory32(loaded_image_protocol + 0x20)\r
- image_size = self.ec.getMemoryService().readMemory32(loaded_image_protocol + 0x28)\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
+\r
+ image_base = self.ec.getMemoryService().readMemory32(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
+ loaded_image_protocol = self.ec.getMemoryService().readMemory32(debug_info + 0x4)\r
+\r
+ image_base = self.ec.getMemoryService().readMemory32(loaded_image_protocol + 0x20)\r
+ image_size = self.ec.getMemoryService().readMemory32(loaded_image_protocol + 0x28)\r
\r
self.DebugInfos.append((image_base,image_size))\r
\r
found = False\r
for debug_info in self.DebugInfos:\r
if (addr >= debug_info[0]) and (addr < debug_info[0] + debug_info[1]):\r
- section = firmware_volume.EfiSectionPE32(self.ec, debug_info[0])\r
+ if edk2_debugger.is_aarch64(self.ec):\r
+ section = firmware_volume.EfiSectionPE64(self.ec, debug_info[0])\r
+ else:\r
+ section = firmware_volume.EfiSectionPE32(self.ec, debug_info[0])\r
\r
try:\r
edk2_debugger.load_symbol_from_file(self.ec, section.get_debug_filepath(), section.get_debug_elfbase(), verbose)\r
except Exception, (ErrorClass, ErrorMessage):\r
if verbose:\r
print "Error while loading a symbol file (%s: %s)" % (ErrorClass, ErrorMessage)\r
- pass\r
\r
found = True\r
return debug_info\r
self.get_debug_info()\r
\r
for debug_info in self.DebugInfos:\r
- section = firmware_volume.EfiSectionPE32(self.ec, debug_info[0])\r
- \r
+ if edk2_debugger.is_aarch64(self.ec):\r
+ section = firmware_volume.EfiSectionPE64(self.ec, debug_info[0])\r
+ else:\r
+ section = firmware_volume.EfiSectionPE32(self.ec, debug_info[0])
+ \r
try:\r
edk2_debugger.load_symbol_from_file(self.ec, section.get_debug_filepath(), section.get_debug_elfbase(), verbose)\r
except Exception, (ErrorClass, ErrorMessage):\r
if verbose:\r
print "Error while loading a symbol file (%s: %s)" % (ErrorClass, ErrorMessage)\r
- pass\r
\r
def dump(self):\r
self.get_debug_info()\r
for debug_info in self.DebugInfos:\r
base_pe32 = debug_info[0]\r
- section = firmware_volume.EfiSectionPE32(self.ec, base_pe32)\r
+ if edk2_debugger.is_aarch64(self.ec):\r
+ section = firmware_volume.EfiSectionPE64(self.ec, base_pe32)\r
+ else:\r
+ section = firmware_volume.EfiSectionPE32(self.ec, base_pe32)\r
print section.get_debug_filepath()\r
\r
class SystemTable:\r
raise Exception('SystemTable','System Table not found in System Memory [0x%x;0x%X]' % (membase,membase+memsize))\r
\r
def get_configuration_table(self, conf_table_guid):\r
- # Number of configuration Table entry\r
- conf_table_entry_count = self.ec.getMemoryService().readMemory32(self.system_table_base + 0x40)\r
- \r
- # Get location of the Configuration Table entries\r
- conf_table_offset = self.ec.getMemoryService().readMemory32(self.system_table_base + 0x44)\r
+ if edk2_debugger.is_aarch64(self.ec):\r
+ # Number of configuration Table entry\r
+ 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
+ else:\r
+ # Number of configuration Table entry\r
+ conf_table_entry_count = self.ec.getMemoryService().readMemory32(self.system_table_base + 0x40)
+\r
+ # Get location of the Configuration Table entries\r
+ conf_table_offset = self.ec.getMemoryService().readMemory32(self.system_table_base + 0x44)\r
\r
for i in range(0, conf_table_entry_count):\r
- offset = conf_table_offset + (i * 0x14)\r
+ if edk2_debugger.is_aarch64(self.ec):\r
+ offset = conf_table_offset + (i * 0x18)\r
+ else:\r
+ 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