From 9b702505ae13990c2fdad6f544edc7ef62878f55 Mon Sep 17 00:00:00 2001 From: dlg Date: Tue, 6 Jan 2015 00:38:32 +0000 Subject: [PATCH] implement atomic_swap_{uint,ulong,ptr) and some md variants. use these to replace x86_atomic_testset_{u32,u64}. help from guenther@ kettenis@ ok kettenis@ --- sys/arch/amd64/amd64/ipi.c | 4 +-- sys/arch/amd64/amd64/pmap.c | 4 +-- sys/arch/amd64/include/atomic.h | 62 ++++++++++++++++++++++++--------- 3 files changed, 50 insertions(+), 20 deletions(-) diff --git a/sys/arch/amd64/amd64/ipi.c b/sys/arch/amd64/amd64/ipi.c index 6f568411e08..48090bb79da 100644 --- a/sys/arch/amd64/amd64/ipi.c +++ b/sys/arch/amd64/amd64/ipi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipi.c,v 1.11 2012/12/05 23:20:10 deraadt Exp $ */ +/* $OpenBSD: ipi.c,v 1.12 2015/01/06 00:38:32 dlg Exp $ */ /* $NetBSD: ipi.c,v 1.2 2003/03/01 13:05:37 fvdl Exp $ */ /*- @@ -103,7 +103,7 @@ x86_ipi_handler(void) u_int32_t pending; int bit; - pending = x86_atomic_testset_u32(&ci->ci_ipis, 0); + pending = atomic_swap_uint(&ci->ci_ipis, 0); for (bit = 0; bit < X86_NIPI && pending; bit++) { if (pending & (1<