summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/sparc/sparc/asm.h8
-rw-r--r--sys/arch/sparc/sparc/pmap.c4
2 files changed, 9 insertions, 3 deletions
diff --git a/sys/arch/sparc/sparc/asm.h b/sys/arch/sparc/sparc/asm.h
index 534853ce491..3258be1e584 100644
--- a/sys/arch/sparc/sparc/asm.h
+++ b/sys/arch/sparc/sparc/asm.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: asm.h,v 1.2 1997/08/08 08:26:58 downsj Exp $ */
+/* $OpenBSD: asm.h,v 1.3 1999/09/03 18:11:28 art Exp $ */
/* $NetBSD: asm.h,v 1.4 1996/07/01 18:01:26 abrown Exp $ */
/*
@@ -117,3 +117,9 @@
__asm __volatile("stda %0,[%1]%2" : : \
"r" ((long long)(value)), "r" ((int)(loc)), "n" (asi)); \
})
+
+/* atomic swap of a word between a register and memory */
+#define swap(loc, val) ({ \
+ __asm __volatile("swap [%2],%0" : "=&r" (val) : "0" (val), "r" (loc)); \
+})
+
diff --git a/sys/arch/sparc/sparc/pmap.c b/sys/arch/sparc/sparc/pmap.c
index 1867c14bcff..0416d02833f 100644
--- a/sys/arch/sparc/sparc/pmap.c
+++ b/sys/arch/sparc/sparc/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.32 1999/09/03 18:01:59 art Exp $ */
+/* $OpenBSD: pmap.c,v 1.33 1999/09/03 18:11:29 art Exp $ */
/* $NetBSD: pmap.c,v 1.118 1998/05/19 19:00:18 thorpej Exp $ */
/*
@@ -612,7 +612,7 @@ setpgt4m(ptep, pte)
int *ptep;
int pte;
{
- *ptep = pte;
+ swap(ptep, pte);
if ((cpuinfo.flags & CPUFLG_CACHEPAGETABLES) == 0)
cpuinfo.pcache_flush_line((int)ptep, VA2PA((caddr_t)ptep));
}