Re: KLD mmap question

2002-05-31 Thread Doug White

On Thu, 30 May 2002, Tom Tang wrote:

>   Thanks for the reply, I'll check it out.  However
> if you'll notice in my prev mail, I stated that I was
> trying to contigmalloc 4K... Hard to believe that
> the system doesnt have 4K lying around.

Good point.

Contigmallocing a page is pretty silly, since you get a page anyway. Why
not just use normal malloc?

Doug White|  FreeBSD: The Power to Serve
[EMAIL PROTECTED] |  www.FreeBSD.org


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: KLD mmap question

2002-05-30 Thread Eric Anholt

On Thu, 2002-05-30 at 13:14, Tom Tang wrote:
> Hello,
> 
>   I have a question about implementing mmap functions in
> device drivers.  Thinking it would be simple, I contigmalloc'd
> a buffer of PAGE_SIZE and returned it using atop like other
> mmap device implementations.  However when my userland program
> mmaps the device with offset 0, when I try accessing the returned
> pointer, it returns me invalid memory address.  Any help would
> be appreciated...

An associated question: while I was looking at the DRM's mmap for the
shared memory area, I think I figured out that you didn't need memory
that was going to be mmapped to be physically contiguous (since the
device pager would get each page of it separately).  Was I right?

-- 
Eric Anholt <[EMAIL PROTECTED]>
http://gladstone.uoregon.edu/~eanholt/dri/



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: KLD mmap question

2002-05-30 Thread Tom Tang

Doug,

  Thanks for the reply, I'll check it out.  However
if you'll notice in my prev mail, I stated that I was
trying to contigmalloc 4K... Hard to believe that
the system doesnt have 4K lying around.

- Tom

On Thu, 30 May 2002, Doug White wrote:

> On Thu, 30 May 2002, Tom Tang wrote:
>
> >   I have a question about implementing mmap functions in
> > device drivers.  Thinking it would be simple, I contigmalloc'd
> > a buffer of PAGE_SIZE and returned it using atop like other
> > mmap device implementations.  However when my userland program
> > mmaps the device with offset 0, when I try accessing the returned
> > pointer, it returns me invalid memory address.  Any help would
> > be appreciated...
>
> Generally, after the machine is started, memory gets too fragmented to use
> contigmalloc.
>
> If you preload the module and do the contigmalloc at attach time it should
> succeed.
>
> Doug White|  FreeBSD: The Power to Serve
> [EMAIL PROTECTED] |  www.FreeBSD.org
>
>

-- 

  Tom Tang
  [EMAIL PROTECTED]



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: KLD mmap question

2002-05-30 Thread Doug White

On Thu, 30 May 2002, Tom Tang wrote:

>   I have a question about implementing mmap functions in
> device drivers.  Thinking it would be simple, I contigmalloc'd
> a buffer of PAGE_SIZE and returned it using atop like other
> mmap device implementations.  However when my userland program
> mmaps the device with offset 0, when I try accessing the returned
> pointer, it returns me invalid memory address.  Any help would
> be appreciated...

Generally, after the machine is started, memory gets too fragmented to use
contigmalloc.

If you preload the module and do the contigmalloc at attach time it should
succeed.

Doug White|  FreeBSD: The Power to Serve
[EMAIL PROTECTED] |  www.FreeBSD.org


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message