Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/include/linux Kludgey xchg.



details:   https://anonhg.NetBSD.org/src/rev/d5e6a99e8ecd
branches:  trunk
changeset: 1027986:d5e6a99e8ecd
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 01:25:21 2021 +0000

description:
Kludgey xchg.

diffstat:

 sys/external/bsd/drm2/include/linux/atomic.h |  7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diffs (21 lines):

diff -r 8b71dc916f81 -r d5e6a99e8ecd sys/external/bsd/drm2/include/linux/atomic.h
--- a/sys/external/bsd/drm2/include/linux/atomic.h      Sun Dec 19 01:25:13 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/atomic.h      Sun Dec 19 01:25:21 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic.h,v 1.22 2020/02/14 14:34:59 maya Exp $ */
+/*     $NetBSD: atomic.h,v 1.23 2021/12/19 01:25:21 riastradh Exp $    */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -46,6 +46,11 @@
 #  define      smp_mb__after_atomic()          __insn_barrier()
 #endif
 
+#define        xchg(P, V)                                                            \
+       (sizeof(*(P)) == 4 ? atomic_swap_32((volatile uint32_t *)P, V)        \
+           : sizeof(*(P)) == 8 ? atomic_swap_64((volatile uint64_t *)P, V)   \
+           : (__builtin_abort(), 0))
+
 /*
  * atomic (u)int operations
  *



Home | Main Index | Thread Index | Old Index