linux/include
Robert Jennings 434f98c48f [POWERPC] atomic_dec_if_positive sign extension fix
On 64-bit machines, if an atomic counter is explicitly set to a
negative value, the atomic_dec_if_positive function will decrement and
store the next smallest value in the atomic counter, contrary to its
intended operation.

The comparison to determine if the decrement will make the result
negative was done by the "addic." instruction, which operates on a
64-bit value, namely the zero-extended word loaded from the atomic
variable.  This patch uses an explicit word compare (cmpwi) and
changes the addic. to an addi (also changing "=&r" to "=&b" so that r0
isn't used, and addi doesn't become li).

This also fixes a bug for both 32-bit and 64-bit in that previously
0x80000000 was considered positive, since the result after
decrementing is positive.  Now it is considered negative.

Also, I clarify the return value in the comments just to make it clear
that the value returned is always the decremented value, even if that
value is not stored back to the atomic counter.

Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-01-22 21:27:36 +11:00
..
acpi ACPI: increase ACPI_MAX_REFERENCE_COUNT for larger systems 2007-01-02 00:18:52 -05:00
asm-alpha [PATCH] FD_ZERO build fix 2007-01-11 18:18:22 -08:00
asm-arm [ARM] Resolve fuse and direct-IO failures due to missing cache flushes 2007-01-08 19:49:58 +00:00
asm-arm26 [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-avr32 [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-cris [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-frv [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-generic [PATCH] change WARN_ON back to "BUG: at ..." 2006-12-30 10:55:54 -08:00
asm-h8300 [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-i386 [PATCH] i386: Restore CONFIG_PHYSICAL_START option 2007-01-05 23:55:23 -08:00
asm-ia64 [PATCH] FD_ZERO build fix 2007-01-11 18:18:22 -08:00
asm-m32r [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-m68k [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-m68knommu [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-mips [MIPS] SMTC build fix 2007-01-08 21:41:04 +00:00
asm-parisc [ARM] pass vma for flush_anon_page() 2007-01-08 19:49:54 +00:00
asm-powerpc [POWERPC] atomic_dec_if_positive sign extension fix 2007-01-22 21:27:36 +11:00
asm-ppc Merge branch 'for_paulus' of master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc 2006-12-11 16:31:42 +11:00
asm-s390 [PATCH] FD_ZERO build fix 2007-01-11 18:18:22 -08:00
asm-sh [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-sh64 [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-sparc [SPARC64]: Fix of_iounmap() region release. 2006-12-31 14:06:05 -08:00
asm-sparc64 [SPARC64]: Fix of_iounmap() region release. 2006-12-31 14:06:05 -08:00
asm-um [PATCH] UML: add generic BUG support 2006-12-08 08:28:39 -08:00
asm-v850 [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-x86_64 [PATCH] x86-64: Use different constraint for gcc < 4.1 in bitops.h 2007-01-11 01:52:44 +01:00
asm-xtensa [PATCH] FD_ZERO build fix 2007-01-11 18:18:22 -08:00
crypto [CRYPTO] lib: table driven multiplications in GF(2^128) 2006-12-06 18:38:55 -08:00
keys
linux Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6 2007-01-11 18:25:44 -08:00
math-emu
media V4L/DVB (5001): Add two required headers on kernel 2.6.20-rc1 2006-12-27 14:20:46 -02:00
mtd
net Merge branch 'upstream-fixes' of master.kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6 into upstream-fixes 2007-01-07 22:44:56 -05:00
pcmcia
rdma IB: Fix ib_dma_alloc_coherent() wrapper 2006-12-15 13:57:26 -08:00
rxrpc
scsi [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
sound [ALSA] version 1.0.14rc1 2007-01-09 10:57:25 +01:00
video [PATCH] sstfb: add sysfs interface 2006-12-13 09:05:55 -08:00
Kbuild