--- head.S-orig Tue Feb 1 14:33:58 2000 +++ head.S Tue Feb 1 14:49:47 2000 @@ -1025,6 +1031,16 @@ tophys(r21, r21, 0) ori r21, r21, 1 /* Set valid bit in physical L2 page */ mtspr MD_TWC, r21 /* Load pte table base address */ mfspr r21, MD_TWC /* ....and get the pte address */ - lwz r21, 0(r21) /* Get the pte */ + lwz r20, 0(r21) /* Get the pte */ + andi. r20, r20, _PAGE_PRESENT /* Set cr0 if it's invalid */ + beq 4f /* Skip update if invalid */ + mfspr r20, DSISR /* Check for store op */ + andis. r20, r20, 0x0200 /* If set, indicates store */ + lwz r20, 0(r21) /* Get the pte again */ + beq 3f + ori r20, r20, _PAGE_DIRTY|_PAGE_HWWRITE /* Set the dirty flags */ +3: + ori r20, r20, _PAGE_ACCESSED /* Set the accessed flag */ + stw r20, 0(r21) /* Update the pte */ +4: