Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: paddr_t change to 64-bits



On 28.09.2010 00:47, Christos Zoulas wrote:
>> Opinions?
> 
> I've already fixed it. I am not sure what to do in the PAE case though.

That's what I was looking at; I guess it should be done the other way
around: the physical address is allocated and returned by the kernel
from agp_allocate_user(), so the address in the compat struct should be
set after the call to agp_allocate_user() (if it returns without error):


Index: sys/dev/pci/agp.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/agp.c,v
retrieving revision 1.71
diff -u -p -r1.71 agp.c
--- sys/dev/pci/agp.c   27 Sep 2010 22:53:46 -0000      1.71
+++ sys/dev/pci/agp.c   27 Sep 2010 23:35:09 -0000
@@ -963,15 +963,19 @@ agpioctl(dev_t dev, u_long cmd, void *da
        } agp_oallocate;

        case AGPIOC_OALLOCATE: {
+               int ret;
                agp_allocate aga;
                agp_oallocate *oaga = data;

-               aga.key = oaga->key;
-               aga.pg_count = oaga->pg_count;
                aga.type = oaga->type;
-               aga.physical = oaga->physical;
+               aga.pg_count = oaga->pg_count;
+
+               if ((ret = agp_allocate_user(sc, &aga)) == 0) {
+                       oaga->key = aga->key;
+                       oaga->physical = aga->physical; /* XXX Cast u_long? */
+               }

-               return agp_allocate_user(sc, &aga);
+               return ret;
        }
 }
 #endif

Anyway, this does not seem to fix all the scenarios.

Using paddr_t is unfortunate there: if we take a currentish userland,
struct agp_allocate will have a 64 bits "physical" element. Sadly, for a
native i386 kernel (!PAE), paddr_t being 32 bits, struct agp_allocate
will not have the same size for "physical", let alone the struct's size.
Kernel agp.c and userland headers do not match.

One very ugly dirty fix would be to redefine the types just for PAE in
agp.c.

Hmm, that one takes more thought. What other ports are using AGP
allocation routines? ppc?

-- 
Jean-Yves Migeon
jeanyves.migeon%free.fr@localhost


Home | Main Index | Thread Index | Old Index