diff options
Diffstat (limited to 'meta/recipes-devtools/qemu/qemu-0.14.0/Detect-and-use-GCC-atomic-builtins-for-locking.patch')
-rw-r--r-- | meta/recipes-devtools/qemu/qemu-0.14.0/Detect-and-use-GCC-atomic-builtins-for-locking.patch | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu-0.14.0/Detect-and-use-GCC-atomic-builtins-for-locking.patch b/meta/recipes-devtools/qemu/qemu-0.14.0/Detect-and-use-GCC-atomic-builtins-for-locking.patch new file mode 100644 index 0000000000..dc69bfbbd5 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu-0.14.0/Detect-and-use-GCC-atomic-builtins-for-locking.patch | |||
@@ -0,0 +1,84 @@ | |||
1 | From de01f17a2cb88dc5ff53cc321342b888c33b120a Mon Sep 17 00:00:00 2001 | ||
2 | From: =?UTF-8?q?Lo=C3=AFc=20Minier?= <lool@dooz.org> | ||
3 | Date: Thu, 11 Feb 2010 17:42:33 +0100 | ||
4 | Subject: [PATCH] Detect and use GCC atomic builtins for locking | ||
5 | |||
6 | --- | ||
7 | configure | 17 +++++++++++++++++ | ||
8 | qemu-lock.h | 13 +++++++++++++ | ||
9 | 2 files changed, 30 insertions(+), 0 deletions(-) | ||
10 | |||
11 | Index: qemu-0.14.0/configure | ||
12 | =================================================================== | ||
13 | --- qemu-0.14.0.orig/configure | ||
14 | +++ qemu-0.14.0/configure | ||
15 | @@ -2243,6 +2243,20 @@ fi | ||
16 | ########################################## | ||
17 | |||
18 | ########################################## | ||
19 | +# check if we have gcc atomic built-ins | ||
20 | +gcc_atomic_builtins=no | ||
21 | +cat > $TMPC << EOF | ||
22 | +int main(void) { | ||
23 | + int i; | ||
24 | + __sync_lock_test_and_set(&i, 1); | ||
25 | + __sync_lock_release(&i); | ||
26 | +} | ||
27 | +EOF | ||
28 | +if compile_prog "" ""; then | ||
29 | + gcc_atomic_builtins=yes | ||
30 | +fi | ||
31 | + | ||
32 | +########################################## | ||
33 | # check if we have fdatasync | ||
34 | |||
35 | fdatasync=no | ||
36 | @@ -2731,6 +2745,9 @@ fi | ||
37 | if test "$gcc_attribute_warn_unused_result" = "yes" ; then | ||
38 | echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak | ||
39 | fi | ||
40 | +if test "$gcc_atomic_builtins" = "yes" ; then | ||
41 | + echo "CONFIG_GCC_ATOMIC_BUILTINS=y" >> $config_host_mak | ||
42 | +fi | ||
43 | if test "$fdatasync" = "yes" ; then | ||
44 | echo "CONFIG_FDATASYNC=y" >> $config_host_mak | ||
45 | fi | ||
46 | Index: qemu-0.14.0/qemu-lock.h | ||
47 | =================================================================== | ||
48 | --- qemu-0.14.0.orig/qemu-lock.h | ||
49 | +++ qemu-0.14.0/qemu-lock.h | ||
50 | @@ -33,6 +33,14 @@ | ||
51 | |||
52 | #else | ||
53 | |||
54 | +#ifdef CONFIG_GCC_ATOMIC_BUILTINS | ||
55 | +typedef int spinlock_t; | ||
56 | + | ||
57 | +#define SPIN_LOCK_UNLOCKED 0 | ||
58 | + | ||
59 | +#define resetlock(p) __sync_lock_release((p)) | ||
60 | +#else /* CONFIG_GCC_ATOMIC_BUILTINS */ | ||
61 | + | ||
62 | #if defined(__hppa__) | ||
63 | |||
64 | typedef int spinlock_t[4]; | ||
65 | @@ -56,7 +64,11 @@ static inline void resetlock (spinlock_t | ||
66 | } | ||
67 | |||
68 | #endif | ||
69 | +#endif /* !CONFIG_GCC_ATOMIC_BUILTINS */ | ||
70 | |||
71 | +#ifdef CONFIG_GCC_ATOMIC_BUILTINS | ||
72 | +#define testandset(p) __sync_lock_test_and_set((p), 1) | ||
73 | +#else /* CONFIG_GCC_ATOMIC_BUILTINS */ | ||
74 | #if defined(_ARCH_PPC) | ||
75 | static inline int testandset (int *p) | ||
76 | { | ||
77 | @@ -213,6 +225,7 @@ static inline int testandset (int *p) | ||
78 | #else | ||
79 | #error unimplemented CPU support | ||
80 | #endif | ||
81 | +#endif /* !CONFIG_GCC_ATOMIC_BUILTINS */ | ||
82 | |||
83 | #if defined(CONFIG_USER_ONLY) | ||
84 | static inline void spin_lock(spinlock_t *lock) | ||