Skip to content
Snippets Groups Projects
Commit 4adbacab authored by Laura Abbott's avatar Laura Abbott
Browse files

linux-ramdump-parser-v2: Add option for custom page offset

Some binaries may be compiled with a different page offset. Add
an option to allow the page offset to be adjusted properly.

Change-Id: I50cf0241f8a52aa0f9cd070da827775b5cb4764c
parent b9327ffa
No related branches found
No related tags found
No related merge requests found
......@@ -436,7 +436,8 @@ class RamDump():
if urc < 0:
break
def __init__(self, vmlinux_path, nm_path, gdb_path, ebi, file_path, phys_offset, outdir, hw_id=None, hw_version=None, arm64=False):
def __init__(self, vmlinux_path, nm_path, gdb_path, ebi, file_path, phys_offset, outdir, hw_id=None, hw_version=None, arm64=False,
page_offset=None):
self.ebi_files = []
self.phys_offset = None
self.tz_start = 0
......@@ -476,11 +477,14 @@ class RamDump():
'[!!!] Phys offset was set to {0:x}'.format(phys_offset))
self.phys_offset = phys_offset
self.lookup_table = []
self.page_offset = 0xc0000000
self.config = []
if self.arm64:
self.page_offset = 0xffffffc000000000
self.thread_size = 16384
if page_offset is not None:
print_out_str(
'[!!!] Page offset was set to {0:x}'.format(page_offset))
self.page_offset = page_offset
self.setup_symbol_tables()
# The address of swapper_pg_dir can be used to determine
......
......@@ -106,6 +106,8 @@ if __name__ == '__main__':
dest='stdout', help='Dump to stdout instead of the file')
parser.add_option('', '--phys-offset', type='int',
dest='phys_offset', help='use custom phys offset')
parser.add_option('', '--page-offset', type='int',
dest='page_offset', help='use custom page offset')
parser.add_option('', '--force-hardware', type='int',
dest='force_hardware', help='Force the hardware detection')
parser.add_option(
......@@ -260,7 +262,8 @@ if __name__ == '__main__':
dump = RamDump(options.vmlinux, nm_path, gdb_path, options.ram_addr,
options.autodump, options.phys_offset, options.outdir,
options.force_hardware, options.force_hardware_version,
arm64=options.arm64)
arm64=options.arm64,
page_offset=options.page_offset)
if options.shell or options.classic_shell:
print("Entering interactive shell mode.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment