From 46976af8c8792e28129daf40b88ac0ef081dbc3e Mon Sep 17 00:00:00 2001
From: Laura Abbott <lauraa@codeaurora.org>
Date: Tue, 11 Mar 2014 15:40:48 -0700
Subject: [PATCH] linux-ramdump-parser-v2: Make page offset a property of the
 ramdump

The PAGE_OFFSET (traditionally 0xc0000000) may change depending on
architecture version. Switch it to be a property of the ramdump.

Change-Id: Ide04649f59005f39e84d0caa5edab0f46e691b3f
---
 linux-ramdump-parser-v2/ramdump.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/linux-ramdump-parser-v2/ramdump.py b/linux-ramdump-parser-v2/ramdump.py
index bbe2a37..4ec2806 100644
--- a/linux-ramdump-parser-v2/ramdump.py
+++ b/linux-ramdump-parser-v2/ramdump.py
@@ -432,6 +432,7 @@ class RamDump():
         self.imem_fname = None
         self.gdbmi = gdbmi.GdbMI(self.gdb_path, self.vmlinux)
         self.gdbmi.open()
+        self.page_offset = 0xc0000000
         if ebi is not None:
             # TODO sanity check to make sure the memory regions don't overlap
             for file_path, start, end in ebi:
@@ -543,7 +544,7 @@ class RamDump():
         banner_addr = self.addr_lookup('linux_banner')
         if banner_addr is not None:
             # Don't try virt to phys yet, compute manually
-            banner_addr = banner_addr - 0xc0000000 + self.phys_offset
+            banner_addr = banner_addr - self.page_offset + self.phys_offset
             b = self.read_cstring(banner_addr, 256, False)
             if b is None:
                 print_out_str('!!! Could not read banner address!')
-- 
GitLab