blob: b0e3dbfa8a493d84cbb34b7381eb2d1869f99ab4 [file] [log] [blame]
Patrick Williams864cc432023-02-09 14:54:44 -06001From a9795b9aadcbc04ad0404badf722acb83ef0ab7b Mon Sep 17 00:00:00 2001
Andrew Geissler82c905d2020-04-13 13:39:40 -05002From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 31 Dec 2015 14:35:35 -0800
Andrew Geisslerd1e89492021-02-12 15:35:20 -06004Subject: [PATCH] nativesdk-glibc: Allow 64 bit atomics for x86
Andrew Geissler82c905d2020-04-13 13:39:40 -05005
6The fix consist of allowing 64bit atomic ops for x86.
7This should be safe for i586 and newer CPUs.
8It also makes the synchronization more efficient.
9
10Upstream-Status: Inappropriate [OE-Specific]
11
12Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
13Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15---
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000016 sysdeps/x86/atomic-machine.h | 7 +------
17 1 file changed, 1 insertion(+), 6 deletions(-)
Andrew Geissler82c905d2020-04-13 13:39:40 -050018
19diff --git a/sysdeps/x86/atomic-machine.h b/sysdeps/x86/atomic-machine.h
Patrick Williams864cc432023-02-09 14:54:44 -060020index 95663099e4..4d81efc51a 100644
Andrew Geissler82c905d2020-04-13 13:39:40 -050021--- a/sysdeps/x86/atomic-machine.h
22+++ b/sysdeps/x86/atomic-machine.h
Patrick Williams92b42cb2022-09-03 06:53:57 -050023@@ -26,19 +26,14 @@
Andrew Geisslerd1e89492021-02-12 15:35:20 -060024 #define LOCK_PREFIX "lock;"
Andrew Geissler82c905d2020-04-13 13:39:40 -050025
26 #define USE_ATOMIC_COMPILER_BUILTINS 1
27+# define __HAVE_64B_ATOMICS 1
28
29 #ifdef __x86_64__
30-# define __HAVE_64B_ATOMICS 1
31 # define SP_REG "rsp"
32 # define SEG_REG "fs"
33 # define BR_CONSTRAINT "q"
34 # define IBR_CONSTRAINT "iq"
35 #else
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000036-/* Since the Pentium, i386 CPUs have supported 64-bit atomics, but the
37- i386 psABI supplement provides only 4-byte alignment for uint64_t
38- inside structs, so it is currently not possible to use 64-bit
39- atomics on this platform. */
Andrew Geissler82c905d2020-04-13 13:39:40 -050040-# define __HAVE_64B_ATOMICS 0
41 # define SP_REG "esp"
42 # define SEG_REG "gs"
43 # define BR_CONSTRAINT "r"