public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Stroupe <dstroupe@keyed-upsoftware.com>
To: linux-kernel@vger.kernel.org
Subject: mmap issues
Date: Wed, 08 May 2002 18:02:13 -0500	[thread overview]
Message-ID: <3CD9AE75.60105@keyed-upsoftware.com> (raw)

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



             reply	other threads:[~2002-05-08 23:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-08 23:02 David Stroupe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-11-27 16:46 MMAP issues Peter Zaitsev
     [not found] ` <3C03D108.E3FADE95@zip.com.au>
2001-11-27 17:54   ` Re[2]: " Peter Zaitsev
2001-11-27 22:36     ` Jeff Epler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3CD9AE75.60105@keyed-upsoftware.com \
    --to=dstroupe@keyed-upsoftware.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox