Skip to contentSkip to conversation

having problems with remap_page_range() and virt_to_phys()

DISCUSSION Peter Chubb 1 participant 1 message Sep 10, 2004 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Chris" == Chris Friesen <[email protected]> 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.

Signature · 2 lines
Dr Peter Chubb  http://www.gelato.unsw.edu.au  peterc AT gelato.unsw.edu.au
The technical we do immediately,  the political takes *forever*