Commit Graph

21 Commits

Author SHA1 Message Date
Bernd Walter
69b40f4db3 MFp4: Add missing atomic functions
Based on a patch by: des
2007-01-05 02:50:27 +00:00
Olivier Houchard
2c7b82c9dd Add atomic_cmpset_acq_32. 2006-11-07 11:53:44 +00:00
Olivier Houchard
ec21307611 Add definitions for atomic_subtract_rel_32, atomic_add_rel_32 and
atomic_load_acq_32, needed for hwpmc.
2006-05-15 13:08:12 +00:00
Olivier Houchard
b8986f5675 Disable/enable fiqs as well as irqs. 2006-04-13 14:25:28 +00:00
Olivier Houchard
123f34932c Use memory clobbers, to be on the safe side.
Suggested by:	jhb
2006-02-06 18:29:05 +00:00
Olivier Houchard
697e7cb715 Backout rev 1.12. It would have been a good thing, if gcc was smart enough
not to generate bad code.
2006-02-05 22:06:12 +00:00
Olivier Houchard
b34658e8a9 A #define is not enough, we need to cast from u_long * to uint32_t *. 2005-12-09 22:58:07 +00:00
Olivier Houchard
858b811f34 Define atomic_whatever_long 2005-12-09 22:33:20 +00:00
John Baldwin
21aa010bb5 Whitespace. 2005-10-14 18:36:49 +00:00
John Baldwin
43e2ef2bb6 Change the userland atomic operations on arm to use memory operands for
the modified memory rather than using register operands that held a pointer
to the memory.  The biggest effect is that we now correctly tell the
compiler that these functions change the memory that these functions
modify.

Reviewed by:	cognet
2005-10-14 18:07:45 +00:00
John Baldwin
3c2bc2bf26 Add a new atomic_fetchadd() primitive that atomically adds a value to a
variable and returns the previous value of the variable.

Tested on:	i386, alpha, sparc64, arm (cognet)
Reviewed by:	arch@
Submitted by:	cognet (arm)
MFC after:	1 week
2005-09-27 17:39:11 +00:00
John Baldwin
d9610574a2 Add extra constraints to tell the compiler that the memory be modified
in the arm __swp() and sparc64 casa() and casax() functions is actually
being used as an input and output and not just the value of the register
that points to the memory location.  This was the underlying source of
the mbuf refcount problems on sparc64 a while back.  For arm this should be
a nop because __swp() has a constraint to clobber all memory which can
probably be removed now.

Reviewed by:	alc, cognet
MFC after:	1 week
2005-07-27 20:01:45 +00:00
John Baldwin
122eceef61 Convert the atomic_ptr() operations over to operating on uintptr_t
variables rather than void * variables.  This makes it easier and simpler
to get asm constraints and volatile keywords correct.

MFC after:	3 days
Tested on:	i386, alpha, sparc64
Compiled on:	ia64, powerpc, amd64
Kernel toolchain busted on:	arm
2005-07-15 18:17:59 +00:00
John Baldwin
dc802c0628 Fix a typo.
Approved by:	re (scottl)
2005-06-23 21:54:17 +00:00
Olivier Houchard
fa7e20fdd4 Make sure we clean the RAS start address once we're done.
This fixes the random segfaults which occurs at high interrupts rate.
2005-05-24 21:42:31 +00:00
Olivier Houchard
2d93998b00 Import a basic implementation of the restartable atomic sequences to provide
atomic operations to userland (this is OK for UP only, but SMP is still so
far away).
2005-04-07 22:03:04 +00:00
Warner Losh
d8315c79d9 Start all license statements with /*- 2005-01-05 21:58:49 +00:00
Olivier Houchard
31e3e209b1 Make sure gcc doesn't generate something such as swp r3, r4, [r3] for __swp,
as it has unpredictable results.
2004-12-18 17:43:01 +00:00
Olivier Houchard
432f5e3ab9 Disable interrupts for atomic_cmpset_32, this one is just not atomic.
Don't export it to userland.
2004-11-05 23:48:12 +00:00
Olivier Houchard
a61369085e Try to implement atomic operations using swp, instead of disabling interrupts. 2004-11-04 19:14:50 +00:00
Olivier Houchard
6fc729af63 Import FreeBSD/arm kernel bits.
It only supports sa1110 (on simics) right now, but xscale support should come
soon.
Some of the initial work has been provided by :
Stephane Potvin <sepotvin at videotron.ca>
Most of this comes from NetBSD.
2004-05-14 11:46:45 +00:00