diff --git a/linux-ramdump-parser-v2/mm.py b/linux-ramdump-parser-v2/mm.py index b626981030d598dcc23e1fee4e98c7cf90baccbf..b6633d458f5d4764e5d550d98558ccca56707643 100644 --- a/linux-ramdump-parser-v2/mm.py +++ b/linux-ramdump-parser-v2/mm.py @@ -1,4 +1,4 @@ -# Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. +# Copyright (c) 2013-2018, The Linux Foundation. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 and @@ -309,6 +309,16 @@ def page_address(ramdump, page): if pam == start: return None +def phys_to_virt(ramdump, phys): + if not ramdump.arm64: + return phys - ramdump.phys_offset + ramdump.page_offset + + if ramdump.kernel_version < (4, 4, 0): + return None + + memstart_addr = ramdump.read_s64('memstart_addr') + val = (phys - memstart_addr) | ramdump.page_offset + return val def for_each_pfn(ramdump): """ creates a generator for looping through valid pfn