Re: having problems with remap_page_range() and virt_to_phys()

From: Peter Chubb
Date: Thu Sep 09 2004 - 23:07:13 EST


>>>>> "Chris" == Chris Friesen <cfriesen@xxxxxxxxxxxxxxxxxx> writes:

Chris> I'm trying to allocate a page of in-kernel memory and make it
Chris> accessable to userspace and to late asm code where we don't
Chris> have virtual memory enabled.

Chris> I'm running code essentially equivalent to the following, where
Chris> "map_addr" is a virtual address passed in by userspace, and
Chris> "vma" is the appropriate one for that address:


Chris> struct page *pg = alloc_page(GFP_KERNEL); void *virt =
Chris> page_address(pg); unsigned long phys = virt_to_phys(virt)
Chris> remap_page_range(vma, map_addr, phys, PAGE_SIZE,
Chris> vma->vm_page_prot)


Chris> The problem that I'm having is that after the call to
Chris> remap_page_range, the result of

Chris> virt_to_phys(map_addr)

Did you set the VM_RESERVED bit on the VMA? If you didn't then the remap
page range will allocate a new zero-filled page for you.


--
Dr Peter Chubb http://www.gelato.unsw.edu.au peterc AT gelato.unsw.edu.au
The technical we do immediately, the political takes *forever*
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/