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 linux: Just use __sync_*...
details: https://anonhg.NetBSD.org/src/rev/52c6216e62aa
branches: trunk
changeset: 1028620:52c6216e62aa
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 11:31:11 2021 +0000
description:
linux: Just use __sync_* for xchg and cmpxchg.
Easier than figuring out the dance with __builtin_choose_expr to make
these work with all types they need to work with.
diffstat:
sys/external/bsd/drm2/include/linux/atomic.h | 18 ++++--------------
1 files changed, 4 insertions(+), 14 deletions(-)
diffs (32 lines):
diff -r 4dd8885ffae8 -r 52c6216e62aa sys/external/bsd/drm2/include/linux/atomic.h
--- a/sys/external/bsd/drm2/include/linux/atomic.h Sun Dec 19 11:31:04 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/atomic.h Sun Dec 19 11:31:11 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic.h,v 1.38 2021/12/19 11:26:42 riastradh Exp $ */
+/* $NetBSD: atomic.h,v 1.39 2021/12/19 11:31:11 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -38,19 +38,9 @@
#include <asm/barrier.h>
-#define xchg(P, V) \
- (sizeof(*(P)) == 4 ? atomic_swap_32((volatile uint32_t *)(P), \
- (uint32_t)(V)) \
- : sizeof(*(P)) == 8 ? atomic_swap_64((volatile uint64_t *)(P), \
- (uint64_t)(V)) \
- : (__builtin_abort(), 0))
-
-#define cmpxchg(P, O, N) \
- (sizeof(*(P)) == 4 ? atomic_cas_32((volatile uint32_t *)(P), \
- (uint32_t)(O), (uint32_t)(N)) \
- : sizeof(*(P)) == 8 ? atomic_cas_64((volatile uint64_t *)(P), \
- (uint64_t)(O), (uint64_t)(N)) \
- : (__builtin_abort(), 0))
+/* XXX Hope the GCC __sync builtins work everywhere we care about! */
+#define xchg(P, V) __sync_lock_test_and_set(P, V)
+#define cmpxchg(P, O, N) __sync_val_compare_and_swap(P, O, N)
/*
* atomic (u)int operations
Home |
Main Index |
Thread Index |
Old Index