lkml.org 
[lkml]   [1999]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectmmap() Failure with 2.2.7
I have a contiguous memory buffer in my driver that I have allocated by:

bufAddress = __get_dma_pages(GFP_KERNEL,order);

that I want to map to user space.

The following worked for 2.0.36-3SMP on RH 5.2 but does not
work for 2.2.7SMP on RH 6.0. It gives no error indication
but when I try to store data in the buffer and read it back,
the data is garbage (0xffffffff).

I would appreciate knowing the proper way to do this or
any suggestions about how to proceed.

Frank McGirt
fmcgirt@swcp.com


2.0.36 implementation:

1. in driver reserve buffer by setting RESERVED bit so that
remap_page range() will work
max_page = MAX_BUFFER_SIZE/PAGE_SIZE
paddr = bufAddress;
for( i = 0; i < max_page; i++ ) {
page = &mem_map[MAP_NR(paddr)];
set_bit(PG_reserved,&page->flags);
paddr += PAGE_SIZE;
}

2. call mmap() from app as:
mmap(0,bufferLength,PROT_READ|PROT_WRITE,MAP_SHARED,fd,bufAddress);

3. in driver mmap() implemented as:
mmap(struct file *file, struct vm_area_struct *vmarea)
{
...
remap_page_range(vmarea->vm_start, vmarea->vm_offset, vmarea->end -
vmarea->start, vmarea->vm_page_prot);
vmarea->vm_file = file;
file->f_dentry->d_inode-i_count++;

return 0;



-
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:51    [W:0.017 / U:6.512 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site