Index: [thread] [date] [subject] [author]
  From: Jon M. Taylor <taylorj@gaia.ecs.csus.edu>
  To  : KGI mailing list <ggi-kgi@kludge.org>
  Date: Mon, 7 Jun 1999 21:27:21 -0700 (PDT)

Linux memory-mapping problem

	I'm having a very strange linux kernel related problem and I'm hoping
that someone here (Marcus in particular) might have some insight.  If not
I'll ask elsewhere.  The problem is that I cannot use remap_page_range() to
implement the mmap() function on a file so that I can map auxiliary hardware
buffers (z-buffer, textures, etc) into userspace.  I have tried implementing
this alternate mmap() system as an extension of fbcon-kgi.c's kgifb_mmap() as
well as implementing it as a separate function, but no matter what
contortions I put the code through I always see the same behavior.

	The exact behavior is that my mmap() handler returns a valid pointer
to userspace but then dies with a 'bogus page' error when the supposedly 
remapped memory range is accessed in userspace.  All I do in my KGI 
driver is define some kgi_mem_regions which span the appropriate address 
ranges (exactly like the LFB region is handled in every KGI driver), and 
then read them out of the driver private data in fbcon-kgi.c and pass 
them to the new aux-buffer mapping code I'm currently writing.

	The kgi_mem_regions have been claim_region()ed properly and can be
accessed from within the driver as well as by mmap() of /dev/mem.  I
shouldn't need to ioremap() the regions again, since they have already been
remapped by mem_claim_region().  Everything is set up appropriately, but I
can't make the damn mmap() process work!  Even if I replace my mmap() handler
with an _exact copy_ of kgifb_mmap(), it still gives the same error!  
That last is really weirding me out, because kgifb_mmap() works fine in 
its current implementation.

	I can show the affected code to anyone who is willing to help me with
this, since it does not involve anything proprietary.  In fact, most of it
does not involve the Savage4 KGI driver at all, just fbcon-kgi.c.  I really
want to get this (probably stupid) problem fixed so I can finish implementing
this new dynamic proc-based auxiliary buffer management system and release
it.

Jon

---
'Cloning and the reprogramming of DNA is the first serious step in 
becoming one with God.'
	- Scientist G. Richard Seed

Index: [thread] [date] [subject] [author]