lkml.org 
[lkml]   [2002]   [May]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectmmap issues
In the driver is:
static int S_Mmap(struct file * flip, struct vm_area_struct *vma)
{

<snip>
unsigned long size = (unsigned long)vma->vm_end - vma->vm_start;
<------size = 2000 for this case
unsigned long start = (unsigned long)vma->vm_start;

vma->vm_flags |= VM_LOCKED;


vaddy = kmalloc(size , GFP_KERNEL);
strcpy((char*)vaddy, "testing\0");
mem_map_reserve(virt_to_page(vaddy));
result = remap_page_range(start, virt_to_phys(vaddy), size,
vma->vm_page_prot);
if (result)
return -EAGAIN;
return 0;

in user space is:
<snip>
pdma->dwBytes = 2000;
pdma->pUserAddr = mmap(0, pdma->dwBytes, PROT_READ | PROT_WRITE,
MAP_SHARED, hWd, 0);
str = (char*)pdma->pUserAddr;
<snip)

when I try to view the memory that I just mmap()ed using gdb I see:
$12 = 0x40018000 <Address 0x40018000 out of bounds>

If I don't do the mem_map_reserve() command I can view the memory but it
is all zeros.

What am I missing?

TIA

--
Best regards,
David Stroupe
Keyed-Up Software


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

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