Example #1
0
/** Unmap memory mapped with phys_map().
 * @param addr		Address of virtual mapping.
 * @param size		Size of range.
 * @param shared	Whether the mapping was used by other CPUs. */
void phys_unmap(void *addr, size_t size, bool shared) {
	ptr_t base, end;

	/* If the range lies within the physical map area, don't need to do
	 * anything. Otherwise, unmap and free from kernel memory. */
	if((ptr_t)addr < KERNEL_PMAP_BASE || (ptr_t)addr > KERNEL_PMAP_END) {
		base = round_down((ptr_t)addr, PAGE_SIZE);
		end = round_up((ptr_t)addr + size, PAGE_SIZE);
		
		kmem_unmap((void *)base, end - base, shared);
	}
}
Example #2
0
void phys_unmap(void *addr, size_t size, boolean_t shared)
{
	ptr_t base;
	ptr_t end;

	/* If the memory range lies within the physical map area, we don't
	 * need to do anything. Otherwise, unmap and free the kernel memory.
	 */
	if (((uint32_t)addr < PAGE_SIZE) || ((uint32_t)addr > _placement_addr)) {
		base = ROUND_DOWN((ptr_t)addr, PAGE_SIZE);
		end = ROUND_UP((ptr_t)addr + size, PAGE_SIZE);

		DEBUG(DL_DBG, ("addr(%p), size(%x), base(%x), end(%x)\n",
			       addr, size, base, end));
	
		ASSERT(end > base);
		kmem_unmap((void *)base, end - base, shared);
	}
}