Port-arm archive

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

pmap - VIPT PVF_DIRTY condition in pmap_enter()



pmap_enter() has this:

    892 #ifdef PMAP_CACHE_VIPT
        :
    895         if ((pg->mdpage.pvh_attrs & (PVF_DMOD|PVF_NC)) != PVF_NC)
    896                 pg->mdpage.pvh_attrs |= PVF_DIRTY;
    897         KASSERT((pg->mdpage.pvh_attrs & PVF_DMOD) == 0 || \
                    (pg->mdpage.pvh_attrs & (PVF_DIRTY|PVF_NC)));
    898 #endif

According to the log Rev. 1.185, the intention was to set PVF_DIRTY only for
cached & dirty pages.  The above "if" is equivalent to:

        if ((pg->mdpage.pvh_attrs & (PVF_DMOD|PVF_NC)) == PVF_NC)
                ;
        else
                pg->mdpage.pvh_attrs |= PVF_DIRTY;

which means:

        cached? modiified?
              n          0 -
              n          1 DIRTY
              y          0 DIRTY
              y          1 DIRTY

I think this should be:

        cached? modiified?
              n          0 -
              n          1 -
              y          0 -
              y          1 DIRTY

which is:

        if ((pg->mdpage.pvh_attrs & (PVF_NC|PVF_DMOD)) == PVF_DMOD)
                pg->mdpage.pvh_attrs |= PVF_DIRTY;

Masao

Index: sys/arch/arm/arm32/pmap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/arm32/pmap.c,v
retrieving revision 1.210
diff -u -r1.210 pmap.c
--- sys/arch/arm/arm32/pmap.c   1 Jan 2010 02:32:28 -0000       1.210
+++ sys/arch/arm/arm32/pmap.c   1 Jan 2010 05:33:37 -0000
@@ -892,9 +892,11 @@
 #ifdef PMAP_CACHE_VIPT
        if ((pv->pv_flags & PVF_KWRITE) == PVF_KWRITE)
                pg->mdpage.pvh_attrs |= PVF_KMOD;
-       if ((pg->mdpage.pvh_attrs & (PVF_DMOD|PVF_NC)) != PVF_NC)
+       if ((pg->mdpage.pvh_attrs & (PVF_NC|PVF_DMOD)) == PVF_DMOD)
                pg->mdpage.pvh_attrs |= PVF_DIRTY;
-       KASSERT((pg->mdpage.pvh_attrs & PVF_DMOD) == 0 || (pg->mdpage.pvh_attrs 
& (PVF_DIRTY|PVF_NC)));
+       KASSERT((pg->mdpage.pvh_attrs & PVF_NC) == 0 || (pg->mdpage.pvh_attrs & 
PVF_DIRTY) == 0);
+       KASSERT((pg->mdpage.pvh_attrs & PVF_NC) != 0 || (pg->mdpage.pvh_attrs & 
PVF_DMOD) == 0 || (pg->mdpage.pvh_attrs & PVF_DIRTY) != 0);
+
 #endif
        if (pm == pmap_kernel()) {
                PMAPCOUNT(kernel_mappings);
-- 
Masao Uebayashi / Tombi Inc. / Tel: +81-90-9141-4635


Home | Main Index | Thread Index | Old Index