--- pgtable.h-orig Tue Feb 1 14:20:49 2000 +++ pgtable.h Tue Feb 1 14:30:09 2000 @@ -128,6 +128,7 @@ #define _PAGE_SHARED 0 #else + #define _PAGE_PRESENT 0x0001 /* Page is valid */ #define _PAGE_NO_CACHE 0x0002 /* I: cache inhibit */ #define _PAGE_SHARED 0x0004 /* No ASID (context) compare */ @@ -136,17 +137,14 @@ * into the TLB. */ #define _PAGE_GUARDED 0x0010 /* software: guarded access */ -#define _PAGE_WRITETHRU 0x0020 /* software: use writethrough cache */ +#define _PAGE_DIRTY 0x0020 /* software: page is dirty */ #define _PAGE_RW 0x0040 /* software: user write access allowed */ #define _PAGE_ACCESSED 0x0080 /* software: page referenced */ -#define _PAGE_DIRTY 0x0100 /* C: page changed (write protect) */ +#define _PAGE_HWWRITE 0x0100 /* C: page changed (~write protect) */ #define _PAGE_USER 0x0800 /* One of the PP bits, the other must be 0 */ -/* This is used to enable or disable the actual hardware write - * protection. - */ -#define _PAGE_HWWRITE _PAGE_DIRTY +#define _PAGE_WRITETHRU _PAGE_NO_CACHE /* software: use writethrough cache */ #endif /* CONFIG_8xx */ @@ -226,11 +224,18 @@ #define SET_PAGE_DIR(tsk,pgdir) \ ((tsk)->tss.pg_tables = (unsigned long *)(pgdir)) #else /* CONFIG_8xx */ +/* + * SET_PAGE_DIR should only update M_TWB if the destination + * is the current task otherwise the next TLB miss could cause + * a disaster. -- P.C.A. + */ #define SET_PAGE_DIR(tsk,pgdir) \ do { \ unsigned long __pgdir = (unsigned long)pgdir; \ ((tsk)->tss.pg_tables = (unsigned long *)(__pgdir)); \ - asm("mtspr %0,%1 \n\t" : : "i"(M_TWB), "r"(__pa(__pgdir))); \ + if ((tsk) == current) { \ + asm("mtspr %0,%1 \n\t" : : "i"(M_TWB), "r"(__pa(__pgdir))); \ + } \ } while (0) #endif /* CONFIG_8xx */