Commit b14fa557 authored by Ronald S. Bultje's avatar Ronald S. Bultje Committed by Reinhard Tartler

swscale: fix crash in fast_bilinear code when compiled with -mred-zone.

Additional comments from Måns Rullgard have been integrated
by Reinhard Tartler.
Signed-off-by: 's avatarReinhard Tartler <siretart@tauware.de>
parent cd445216
...@@ -1513,12 +1513,24 @@ static void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst, ...@@ -1513,12 +1513,24 @@ static void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst,
void *mmx2FilterCode= c->lumMmx2FilterCode; void *mmx2FilterCode= c->lumMmx2FilterCode;
int i; int i;
#if defined(PIC) #if defined(PIC)
DECLARE_ALIGNED(8, uint64_t, ebxsave); uint64_t ebxsave;
#endif
#if ARCH_X86_64
uint64_t retsave;
#endif #endif
__asm__ volatile( __asm__ volatile(
#if defined(PIC) #if defined(PIC)
"mov %%"REG_b", %5 \n\t" "mov %%"REG_b", %5 \n\t"
#if ARCH_X86_64
"mov -8(%%rsp), %%"REG_a" \n\t"
"mov %%"REG_a", %6 \n\t"
#endif
#else
#if ARCH_X86_64
"mov -8(%%rsp), %%"REG_a" \n\t"
"mov %%"REG_a", %5 \n\t"
#endif
#endif #endif
"pxor %%mm7, %%mm7 \n\t" "pxor %%mm7, %%mm7 \n\t"
"mov %0, %%"REG_c" \n\t" "mov %0, %%"REG_c" \n\t"
...@@ -1560,11 +1572,23 @@ static void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst, ...@@ -1560,11 +1572,23 @@ static void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst,
#if defined(PIC) #if defined(PIC)
"mov %5, %%"REG_b" \n\t" "mov %5, %%"REG_b" \n\t"
#if ARCH_X86_64
"mov %6, %%"REG_a" \n\t"
"mov %%"REG_a", -8(%%rsp) \n\t"
#endif
#else
#if ARCH_X86_64
"mov %5, %%"REG_a" \n\t"
"mov %%"REG_a", -8(%%rsp) \n\t"
#endif
#endif #endif
:: "m" (src), "m" (dst), "m" (filter), "m" (filterPos), :: "m" (src), "m" (dst), "m" (filter), "m" (filterPos),
"m" (mmx2FilterCode) "m" (mmx2FilterCode)
#if defined(PIC) #if defined(PIC)
,"m" (ebxsave) ,"m" (ebxsave)
#endif
#if ARCH_X86_64
,"m"(retsave)
#endif #endif
: "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D
#if !defined(PIC) #if !defined(PIC)
...@@ -1587,10 +1611,22 @@ static void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst1, int16_t *dst2, ...@@ -1587,10 +1611,22 @@ static void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst1, int16_t *dst2,
#if defined(PIC) #if defined(PIC)
DECLARE_ALIGNED(8, uint64_t, ebxsave); DECLARE_ALIGNED(8, uint64_t, ebxsave);
#endif #endif
#if ARCH_X86_64
DECLARE_ALIGNED(8, uint64_t, retsave);
#endif
__asm__ volatile( __asm__ volatile(
#if defined(PIC) #if defined(PIC)
"mov %%"REG_b", %7 \n\t" "mov %%"REG_b", %7 \n\t"
#if ARCH_X86_64
"mov -8(%%rsp), %%"REG_a" \n\t"
"mov %%"REG_a", %8 \n\t"
#endif
#else
#if ARCH_X86_64
"mov -8(%%rsp), %%"REG_a" \n\t"
"mov %%"REG_a", %7 \n\t"
#endif
#endif #endif
"pxor %%mm7, %%mm7 \n\t" "pxor %%mm7, %%mm7 \n\t"
"mov %0, %%"REG_c" \n\t" "mov %0, %%"REG_c" \n\t"
...@@ -1620,11 +1656,23 @@ static void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst1, int16_t *dst2, ...@@ -1620,11 +1656,23 @@ static void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst1, int16_t *dst2,
#if defined(PIC) #if defined(PIC)
"mov %7, %%"REG_b" \n\t" "mov %7, %%"REG_b" \n\t"
#if ARCH_X86_64
"mov %8, %%"REG_a" \n\t"
"mov %%"REG_a", -8(%%rsp) \n\t"
#endif
#else
#if ARCH_X86_64
"mov %7, %%"REG_a" \n\t"
"mov %%"REG_a", -8(%%rsp) \n\t"
#endif
#endif #endif
:: "m" (src1), "m" (dst1), "m" (filter), "m" (filterPos), :: "m" (src1), "m" (dst1), "m" (filter), "m" (filterPos),
"m" (mmx2FilterCode), "m" (src2), "m"(dst2) "m" (mmx2FilterCode), "m" (src2), "m"(dst2)
#if defined(PIC) #if defined(PIC)
,"m" (ebxsave) ,"m" (ebxsave)
#endif
#if ARCH_X86_64
,"m"(retsave)
#endif #endif
: "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D
#if !defined(PIC) #if !defined(PIC)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment