bug in __flush_tlb_global() ?

From: Mikael Pettersson (mikpe@csd.uu.se)
Date: Sun Jan 30 2000 - 06:04:08 EST


I believe there's a bug in the __flush_tlb_global() macro
added to include/asm-i386/pgtable.h in 2.3.40:

#define __flush_tlb_global() \
        do { \
                __asm__ __volatile__( \
                        "movl %0, %%cr4; # turn off PGE \n" \
                        "mov %2, %%cr3; # flush TLB \n" \
                        "mov %1, %%cr4; # turn PGE back on \n" \
                        : \
                        : "r" (mmu_cr4_features), \
                          "r" (mmu_cr4_features & ~X86_CR4_PGE), \
                          "r" (__pa(current->active_mm->pgd)) \
                        : "memory"); \
        } while (0)

Consider the comments. The macro uses input %1 to "turn PGE back on",
but input %1 is (mmu_cr4_features & ~X86_CR4_PGE), which cannot
possibly have the PGE bit on. Likewise, it's using input %0 to
"turn off PGE", but input %0 is (mmu_cr4_features), which probably
_does_ have the PGE bit on (see arch/i386/mm/init.c:pagetable_init()).

I may be wrong, but it looks to me as if inputs 0 and 1 have been
swapped. Proposed fix included below.

/Mikael

--- linux-2.3.41/include/asm-i386/pgtable.h.~1~ Sat Jan 29 14:16:35 2000
+++ linux-2.3.41/include/asm-i386/pgtable.h Sat Jan 29 23:51:44 2000
@@ -48,8 +48,8 @@
                         "mov %2, %%cr3; # flush TLB \n" \
                         "mov %1, %%cr4; # turn PGE back on \n" \
                         : \
- : "r" (mmu_cr4_features), \
- "r" (mmu_cr4_features & ~X86_CR4_PGE), \
+ : "r" (mmu_cr4_features & ~X86_CR4_PGE), \
+ "r" (mmu_cr4_features), \
                           "r" (__pa(current->active_mm->pgd)) \
                         : "memory"); \
         } while (0)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jan 31 2000 - 21:00:25 EST