freebsd-ports/devel/sdl12/files/patch-include_SDL_stdinc.h
Diane Bruce a8648441fb - The x86 inline assembler version of the SDL macro SDL_revcpy() sets the
direction flag ("std"), but does not clear it ("cld").  This is invalid
  according to GCC (inline assembler, which sets the direction flag,
  must reset it[0]) and the SYS V ABI (functions must leave with the
  direction flag cleared[1]). The macro is (indirectly, exact call
  sequence below) used in SDL_BlitSurface(), so this call sometimes
  returns with the direction flag set. This happens for bliting a surface
  onto itself with the destination coordinates set right/down of the source
  coordinates (typical use of this is scrolling left/up).  Later on other
  parts of the code (like inlined memcpy()) cause memory corruption. [1]
- Give maintaintership to submitter (as discussed on irc)

PR:	ports/120052 [1]
2008-01-27 21:37:56 +00:00

10 lines
346 B
C

--- include/SDL_stdinc.h.orig 2006-06-27 00:48:32.000000000 -0400
+++ include/SDL_stdinc.h 2008-01-27 12:47:15.000000000 -0500
@@ -319,6 +319,7 @@
__asm__ __volatile__ ( \
"std\n\t" \
"rep ; movsl\n\t" \
+ "cld\n\t" \
: "=&c" (u0), "=&D" (u1), "=&S" (u2) \
: "0" (n >> 2), \
"1" (dstp+(n-4)), "2" (srcp+(n-4)) \