mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* mmap issues
@ 2002-05-08 23:02 David Stroupe
  0 siblings, 0 replies; 5+ messages in thread
From: David Stroupe @ 2002-05-08 23:02 UTC (permalink / raw)
  To: linux-kernel

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-05-08 23:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <3C03D108.E3FADE95@zip.com.au>
2001-11-27 16:46 ` MMAP issues Peter Zaitsev
2001-11-27 17:54   ` Re[2]: " Peter Zaitsev
2001-11-27 22:36     ` Jeff Epler
2001-11-28  9:44     ` Re[2]: " Peter Zaitsev
2002-05-08 23:02 mmap issues David Stroupe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®