lkml.org 
[lkml]   [2000]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: phys-to-virt kernel mapping and ioremap()


On Thu, 20 Jul 2000, Timur Tabi wrote:

> I'm studying the code for __ioremap and I'm confused by something.
>
> The phys_to_virt and virt_to_phys macros are very simple. Basically, in kernel
> space, the virtual address is an offset of the physical address, so it's very
> simple.
>
> __ioremap is supposed to take high PCI memory and map it to kernel space.
> However, __ioremap() calls get_vm_area() which then calls kmalloc(), which
> allocates some memory from the heap. Then remap_area_pages() is called, and
> that uses the three-level page tables to map the memory allocated by kmalloc to
> the PCI memory.
>
> And that's where I'm confused. Particularly:
>
> 1) Doesn't this mapping break the phys_to_virt and virt_to_phys macros?
>
> 2) kmalloc takes real physical memory from the kernel heap. But then the
> virtual addresses are remapped to other physical memory. What happens to the
> physical memory that kmalloc allocated? Why isn't it freed?

You are being confused by the allocation. kmalloc only allocates a
vm_area_struct, which holds information about the new mapping.

Jeff





-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.130 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site