summaryrefslogtreecommitdiff
path: root/arch/mips/atomic.h
AgeCommit message (Collapse)AuthorLines
2014-07-28fix missing barrier instructions in mips atomic asmRich Felker-14/+18
previously I had wrongly assumed the ll/sc instructions also provided memory synchronization; apparently they do not. this commit adds sync instructions before and after each atomic operation and changes the atomic store to simply use sync before and after a plain store, rather than a useless compare-and-swap. (cherry picked from commit bcad48439494820989f5867c3f8ccfa6aae2909f)
2014-07-28use memory constraints for mips atomic asmRich Felker-24/+24
despite lacking the semantic content that the asm accesses the pointed-to object rather than just using its address as a value, the mips asm was not actually broken. the asm blocks were declared volatile, meaning that the compiler must treat them as having unknown side effects. however changing the asm to use memory constraints is desirable not just from a semantic correctness and consistency standpoint, but also produces better code. the compiler is able to use base/offset addressing expressions for the atomic object's address rather than having to load the address into a single register. this improves access to global locks in static libc, and access to non-zero-offset atomic fields in synchronization primitives, etc. (cherry picked from commit a294f539c78c6ba0a2786ef3c5b2a1210a33864e)
2013-08-11add missing a_or_l to atomic.h for non-x86 archsRich Felker-0/+5
this is needed for recently committed sigaction code
2012-08-11avoid need for -march=mips2 to compile mips atomic.h asmRich Felker-0/+8
linux guarantees ll/sc are always available. on mips1, they will be emulated by the kernel. thus they are part of the linux mips1 abi and safe to use.
2012-07-12fix broken mips a_fetch_addRich Felker-7/+7
sc was overwriting the result
2012-07-11initial version of mips (o32) port, based on work by Richard Pennington (rdp)Rich Felker-0/+191
basically, this version of the code was obtained by starting with rdp's work from his ellcc source tree, adapting it to musl's build system and coding style, auditing the bits headers for discrepencies with kernel definitions or glibc/LSB ABI or large file issues, fixing up incompatibility with the old binutils from aboriginal linux, and adding some new special cases to deal with the oddities of sigaction and pipe syscall interfaces on mips. at present, minimal test programs work, but some interfaces are broken or missing. threaded programs probably will not link.