[FFmpeg-cvslog] x86inc: fix stack alignment on win64

Ronald S. Bultje git at videolan.org
Thu Dec 13 12:29:39 CET 2012


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Wed Dec 12 20:00:22 2012 +0100| [140367aff9284a913aaf207f949cb7b116e1b197] | committer: Martin Storsjö

x86inc: fix stack alignment on win64

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=140367aff9284a913aaf207f949cb7b116e1b197
---

 libavutil/x86/x86inc.asm |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavutil/x86/x86inc.asm b/libavutil/x86/x86inc.asm
index 483ae7b..de0f22c 100644
--- a/libavutil/x86/x86inc.asm
+++ b/libavutil/x86/x86inc.asm
@@ -428,7 +428,7 @@ DECLARE_REG 14, R15, 120
     %assign %%i xmm_regs_used
     %rep (xmm_regs_used-6)
         %assign %%i %%i-1
-        movdqa [rsp + (%%i-6)*16 + stack_size], xmm %+ %%i
+        movdqa [rsp + (%%i-6)*16 + stack_size + (~stack_offset&8)], xmm %+ %%i
     %endrep
 %endmacro
 
@@ -436,8 +436,7 @@ DECLARE_REG 14, R15, 120
     %assign xmm_regs_used %1
     ASSERT xmm_regs_used <= 16
     %if xmm_regs_used > 6
-        %assign stack_size_padded (xmm_regs_used-6)*16+16-gprsize-(stack_offset&15)
-        SUB rsp, stack_size_padded
+        SUB rsp, (xmm_regs_used-6)*16+16
         WIN64_PUSH_XMM
     %endif
 %endmacro
@@ -447,8 +446,11 @@ DECLARE_REG 14, R15, 120
         %assign %%i xmm_regs_used
         %rep (xmm_regs_used-6)
             %assign %%i %%i-1
-            movdqa xmm %+ %%i, [%1 + (%%i-6)*16+stack_size]
+            movdqa xmm %+ %%i, [%1 + (%%i-6)*16+stack_size+(~stack_offset&8)]
         %endrep
+        %if stack_size_padded == 0
+            add %1, (xmm_regs_used-6)*16+16
+        %endif
     %endif
     %if stack_size_padded > 0
         %if stack_size > 0 && (mmsize == 32 || HAVE_ALIGNED_STACK == 0)



More information about the ffmpeg-cvslog mailing list