summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2003-05-19 08:02:36 +0000
committermarcel <marcel@FreeBSD.org>2003-05-19 08:02:36 +0000
commiteb68623668b44ffebeaf326c9ee1703940bea978 (patch)
tree882e2a7d5e90a8b212b02862ed642ccdf2586c96 /sys
parent221bfcf45081fa48b23787d26d1e04477e13e0e1 (diff)
downloadFreeBSD-src-eb68623668b44ffebeaf326c9ee1703940bea978.zip
FreeBSD-src-eb68623668b44ffebeaf326c9ee1703940bea978.tar.gz
Turn pmap_install_pte() into a critical section. We better not get
interrupted while writing into the VHPT table. While here, make sure memory accesses a properly ordered. Tag invalidation must happen first so that the hardware VHPT walker will not be able to match this entry while we're updating it and we have to make sure the new new tag gets written only after the PTE is completely updated. Approved by: re (blanket)
Diffstat (limited to 'sys')
-rw-r--r--sys/ia64/ia64/pmap.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/ia64/ia64/pmap.c b/sys/ia64/ia64/pmap.c
index c76871e..9921764 100644
--- a/sys/ia64/ia64/pmap.c
+++ b/sys/ia64/ia64/pmap.c
@@ -719,18 +719,24 @@ pmap_install_pte(struct ia64_lpte *vhpte, struct ia64_lpte *pte)
{
u_int64_t *vhp, *p;
- /* invalidate the pte */
- atomic_set_64(&vhpte->pte_tag, 1L << 63);
- ia64_mf(); /* make sure everyone sees */
+ vhp = (u_int64_t *)vhpte;
+ p = (u_int64_t *)pte;
- vhp = (u_int64_t *) vhpte;
- p = (u_int64_t *) pte;
+ critical_enter();
+
+ /* Invalidate the tag so the VHPT walker will not match this entry. */
+ vhp[2] = 1UL << 63;
+ ia64_mf();
vhp[0] = p[0];
vhp[1] = p[1];
- vhp[2] = p[2]; /* sets ti to one */
+ ia64_mf();
+ /* Install a proper tag now that we're done. */
+ vhp[2] = p[2];
ia64_mf();
+
+ critical_exit();
}
/*
OpenPOWER on IntegriCloud