summaryrefslogtreecommitdiff
path: root/libpthread/linuxthreads/sysdeps/arm/pt-machine.h
AgeCommit message (Collapse)Author
2022-07-20linuxthread/arm: Unlock ldrex/strex varsion of testandset for __ARM_ARCH >= 7Vladimir Murzin
Thomas has repored failure building ARM 32-bit systems for ARMv8 cores CC libpthread/linuxthreads/mutex.os /tmp/ccn8SFKU.s: Assembler messages: /tmp/ccn8SFKU.s:162: Error: swp{b} use is obsoleted for ARMv8 and later /tmp/ccn8SFKU.s:186: Error: swp{b} use is obsoleted for ARMv8 and later /tmp/ccn8SFKU.s:203: Error: swp{b} use is obsoleted for ARMv8 and later /tmp/ccn8SFKU.s:224: Error: swp{b} use is obsoleted for ARMv8 and later make[1]: *** [Makerules:369: libpthread/linuxthreads/mutex.os] Error 1 This is due to libpthread/linuxthreads/sysdeps/arm/pt-machine.h which uses the swp instruction that is not allowed on ARMv8. All __ARM_ARCH >= 7 support ldrex/strex instructions, so unlock testandset() varaint for them. Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
2022-07-20linuxthreads/arm: fix ldrex/strex loop when built with O0Vladimir Murzin
O0 build result in the following codegen 00000000 <ldrex>: 0: b480 push {r7} 2: b085 sub sp, #20 4: af00 add r7, sp, #0 6: 6078 str r0, [r7, #4] 8: 687b ldr r3, [r7, #4] a: e853 3f00 ldrex r3, [r3] e: 60fb str r3, [r7, #12] 10: 68fb ldr r3, [r7, #12] 12: 4618 mov r0, r3 14: 3714 adds r7, #20 16: 46bd mov sp, r7 18: f85d 7b04 ldr.w r7, [sp], #4 1c: 4770 bx lr 0000001e <strex>: 1e: b480 push {r7} 20: b085 sub sp, #20 22: af00 add r7, sp, #0 24: 6078 str r0, [r7, #4] 26: 6039 str r1, [r7, #0] 28: 687b ldr r3, [r7, #4] 2a: 683a ldr r2, [r7, #0] 2c: e842 3300 strex r3, r3, [r2] 30: 60fb str r3, [r7, #12] 32: 68fb ldr r3, [r7, #12] 34: 4618 mov r0, r3 36: 3714 adds r7, #20 38: 46bd mov sp, r7 3a: f85d 7b04 ldr.w r7, [sp], #4 3e: 4770 bx lr 00000040 <testandset>: 40: b590 push {r4, r7, lr} 42: b083 sub sp, #12 44: af00 add r7, sp, #0 46: 6078 str r0, [r7, #4] 48: 6878 ldr r0, [r7, #4] 4a: f7ff fffe bl 0 <ldrex> 4e: 4603 mov r3, r0 50: 461c mov r4, r3 52: 6879 ldr r1, [r7, #4] 54: 2001 movs r0, #1 56: f7ff fffe bl 1e <strex> 5a: 4603 mov r3, r0 5c: 2b00 cmp r3, #0 5e: d1f3 bne.n 48 <testandset+0x8> 60: 4623 mov r3, r4 62: 4618 mov r0, r3 64: 370c adds r7, #12 66: 46bd mov sp, r7 68: bd90 pop {r4, r7, pc} ARM ARM suggests that LoadExcl/StoreExcl loops are guaranteed to make forward progress only if, for any LoadExcl/StoreExcl loop within a single thread of execution, the software meets all of the following conditions: 1 Between the Load-Exclusive and the Store-Exclusive, there are no explicit memory accesses, preloads, direct or indirect System register writes, address translation instructions, cache or TLB maintenance instructions, exception generating instructions, exception returns, or indirect branches. ... Obviously condition is not met for O0 builds. O2 build (which is highly likely the most common setting) able to do the right thing resulting in 00000000 <ldrex>: 0: e850 0f00 ldrex r0, [r0] 4: 4770 bx lr 6: bf00 nop 00000008 <strex>: 8: e841 0000 strex r0, r0, [r1] c: 4770 bx lr e: bf00 nop 00000010 <testandset>: 10: 2101 movs r1, #1 12: 4603 mov r3, r0 14: e853 0f00 ldrex r0, [r3] 18: e843 1200 strex r2, r1, [r3] 1c: 2a00 cmp r2, #0 1e: d1f9 bne.n 14 <testandset+0x4> 20: 4770 bx lr 22: bf00 nop Rather than depending on level of optimisation implement whole ldrex/strex loop in inline assembly. Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
2016-05-18remove linuxthreads.new, rename linuxthreads.oldWaldemar Brodkorb
Linuxthreads.new isn't really useful with the existence of NPTL/TLS for well supported architectures. There is no reason to use LT.new for ARM/MIPS or other architectures supporting NPTL/TLS. It is not available for noMMU architectures like Blackfin or FR-V. To simplify the live of the few uClibc-ng developers, LT.new is removed and LT.old is renamed to LT. LINUXTHREADS_OLD -> UCLIBC_HAS_LINUXTHREADS
2015-02-14Revert "resolve merge"Waldemar Brodkorb
This reverts commit 6b6ede3d15f04fe825cfa9f697507457e3640344.
2015-02-14resolve mergeWaldemar Brodkorb
2012-11-18Replace FSF snail mail address with URLsMike Frysinger
This matches a similar change made to glibc. No functional changes here. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2008-01-06use the __extern_always_inline define from cdefs.h instead of duplicating ↵Mike Frysinger
gcc version checking in every pt-machine.h header ... while __extern_always_inline should work fine, i think what is intended is __extern_inline ... should double check later
2008-01-05- fixup gnu_inline vs. C99 inlineBernhard Reutner-Fischer
- add missing header guards while at it
2006-01-31initial import of latest linuxthreadsMike Frysinger
2005-11-15rename current stable linuxthreads to linuxthreads.old to prepare for import ↵Mike Frysinger
of latest glibc version
2005-08-15import thumb support from jbowler in Bug 385Mike Frysinger
2003-02-27Major update for pthreads, based in large part on improvementsEric Andersen
from glibc 2.3. This should make threads much more efficient. -Erik
2002-02-20Merge in the pthread library. This is the linuxthreads library taken fromEric Andersen
glibc 2.1.3 and ported to work with uClibc by Stefan Soucek and Erik Andersen (me). Stefan has hacked things up such that linuxthreads runs on MMU-less systems (tested only on arm-nommu). Erik cleaned things up and made it work properly as a shared library. -Erik