Skip to content
Snippets Groups Projects
Commit 6cef78cd authored by Patrick Daly's avatar Patrick Daly
Browse files

lrdp: Add phys_to_virt

Support for kernels older than 4.4 will be added as required.

Change-Id: I0b876303f6f258dedc6133dcfa2b23f5185b69bb
parent 833f0498
No related branches found
No related tags found
No related merge requests found
# 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 # 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 # it under the terms of the GNU General Public License version 2 and
...@@ -309,6 +309,16 @@ def page_address(ramdump, page): ...@@ -309,6 +309,16 @@ def page_address(ramdump, page):
if pam == start: if pam == start:
return None 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): def for_each_pfn(ramdump):
""" creates a generator for looping through valid pfn """ creates a generator for looping through valid pfn
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment