memblock: add functions to convert allocated pointers between virt/phys
This commit is contained in:
@@ -404,3 +404,13 @@ void __next_memory_region(memblock_iter_t *it, memblock_type_t *type_a, memblock
|
||||
/* ULLONG_MAX signals the end of the iteration */
|
||||
it->__idx = ITER_END;
|
||||
}
|
||||
|
||||
phys_addr_t memblock_virt_to_phys(void *p)
|
||||
{
|
||||
return (phys_addr_t)p - memblock.m_voffset;
|
||||
}
|
||||
|
||||
void *memblock_phys_to_virt(phys_addr_t p)
|
||||
{
|
||||
return (void *)(p + memblock.m_voffset);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user