summaryrefslogtreecommitdiffstats
path: root/kexec/arch/arm/phys_to_virt.c
blob: 46a4f68685fd79bfc93c836896975d4190d3c4e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "../../kexec.h"
#include "../../crashdump.h"
#include "phys_to_virt.h"

uint64_t phys_offset;

/**
 * phys_to_virt() - translate physical address to virtual address
 * @paddr: physical address to translate
 *
 * For ARM we have following equation to translate from virtual address to
 * physical:
 *	paddr = vaddr - PAGE_OFFSET + PHYS_OFFSET
 *
 * See also:
 * http://lists.arm.linux.org.uk/lurker/message/20010723.185051.94ce743c.en.html
 */
unsigned long
phys_to_virt(struct crash_elf_info *elf_info, unsigned long long paddr)
{
	return paddr + elf_info->page_offset - phys_offset;
}