linux/include
Andi Kleen 6e44f12ba6 [PATCH] i386: add memory clobbers to syscall macros
As noted by matz@suse.de

The problem is, that on i386 the syscallN
macro is defined like so:

  long __res; \
  __asm__ volatile ("int $0x80" \
        : "=a" (__res) \
        : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
          "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \

If one of the arguments (in the _llseek syscall it's the arg4) is a pointer
which the syscall is expected to write to (to the memory pointed to by this
ptr), then this side-effect is not captured in the asm.

If anyone uses this macro to define it's own version of the syscall
(sometimes necessary when not using glibc) and it's inlined, then GCC
doesn't know that this asm write to "*dest", when called like so for instance:

  out = 1;
  llseek (fd, bla, blubb, &out, trara)
  use (out);

Here nobody tells GCC that "out" actually is written to (just a pointer to it
is passed to the asm).  Hence GCC might (and in the above bug did)
copy-propagate "1" into the second use of "out".

The easiest solution would be to add a "memory" clobber to the definition
of this syscall macro.  As this is a syscall, it shouldn't inhibit too many
optimizations.

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-12 10:50:55 -07:00
..
acpi
asm-alpha [PATCH] spinlock consolidation 2005-09-10 10:06:21 -07:00
asm-arm Merge master.kernel.org:/home/rmk/linux-2.6-arm 2005-09-10 10:16:47 -07:00
asm-arm26 [PATCH] include/asm-arm26/hardirq.h: remove #define irq_enter() 2005-09-10 10:06:30 -07:00
asm-cris
asm-frv
asm-generic [PATCH] x86-64: Increase TLB flush array size 2005-09-12 10:49:58 -07:00
asm-h8300
asm-i386 [PATCH] i386: add memory clobbers to syscall macros 2005-09-12 10:50:55 -07:00
asm-ia64 Pull sn-features into release branch 2005-09-11 14:34:23 -07:00
asm-m32r [PATCH] spinlock consolidation 2005-09-10 10:06:21 -07:00
asm-m68k
asm-m68knommu [PATCH] m68knommu: allow for SDRAM and GPIO differences on 5270/1 and 5274/5 processors 2005-09-11 20:43:47 -07:00
asm-mips [PATCH] spinlock consolidation 2005-09-10 10:06:21 -07:00
asm-parisc [PATCH] spinlock consolidation 2005-09-10 10:06:21 -07:00
asm-powerpc [PATCH] ppc64: Add definitions for new PTRACE calls 2005-09-12 17:19:12 +10:00
asm-ppc [PATCH] ppc64: Add definitions for new PTRACE calls 2005-09-12 17:19:12 +10:00
asm-ppc64 [PATCH] ppc64: Remove unused code 2005-09-12 17:19:12 +10:00
asm-s390 [PATCH] spinlock consolidation 2005-09-10 10:06:21 -07:00
asm-sh [PATCH] spinlock consolidation 2005-09-10 10:06:21 -07:00
asm-sh64
asm-sparc [PATCH] spinlock consolidation 2005-09-10 10:06:21 -07:00
asm-sparc64 [PATCH] spinlock consolidation 2005-09-10 10:06:21 -07:00
asm-um [PATCH] uml spinlock breakage 2005-09-10 16:50:01 -07:00
asm-v850
asm-x86_64 [PATCH] x86-64: Increase TLB flush array size 2005-09-12 10:49:58 -07:00
asm-xtensa
linux [PATCH] x86-64: Some cleanup and optimization to the processor data area. 2005-09-12 10:49:58 -07:00
math-emu
media
mtd
net
pcmcia
rdma [PATCH] IB CM: support CM redir 2005-09-09 18:23:32 -07:00
rxrpc
scsi
sound [PATCH] DocBook: fix kernel-api documentation generation 2005-09-09 14:03:43 -07:00
video [PATCH] framebuffer: new driver for cyberblade/i1 graphics core 2005-09-09 13:58:02 -07:00