[FFmpeg-cvslog] h264: manually save/restore XMM registers for functions using INIT_MMX.

Ronald S. Bultje git at videolan.org
Thu Feb 9 01:46:11 CET 2012


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Tue Feb  7 12:46:59 2012 -0800| [ce1e250ee903392114cb2f1653aa4a722dc3dd03] | committer: Ronald S. Bultje

h264: manually save/restore XMM registers for functions using INIT_MMX.

On Win64, these registers are callee-save, so not saving/restoring them
correctly is a violation of ABI and can lead to crashes or corrupt data.

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

 libavcodec/x86/h264_idct.asm      |    3 +++
 libavcodec/x86/h264_intrapred.asm |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/libavcodec/x86/h264_idct.asm b/libavcodec/x86/h264_idct.asm
index a132480..5e8c0ed 100644
--- a/libavcodec/x86/h264_idct.asm
+++ b/libavcodec/x86/h264_idct.asm
@@ -968,6 +968,9 @@ cglobal h264_idct_add8_8_sse2, 5, 7, 8
 
 %macro IDCT_DC_DEQUANT 2
 cglobal h264_luma_dc_dequant_idct_%1, 3,4,%2
+    ; manually spill XMM registers for Win64 because
+    ; the code here is initialized with INIT_MMX
+    WIN64_SPILL_XMM %2
     movq        m3, [r1+24]
     movq        m2, [r1+16]
     movq        m1, [r1+ 8]
diff --git a/libavcodec/x86/h264_intrapred.asm b/libavcodec/x86/h264_intrapred.asm
index 61c69c6..c6b4386 100644
--- a/libavcodec/x86/h264_intrapred.asm
+++ b/libavcodec/x86/h264_intrapred.asm
@@ -1931,6 +1931,9 @@ cglobal pred8x8l_vertical_right_mmxext, 4,5
 
 %macro PRED8x8L_VERTICAL_RIGHT 1
 cglobal pred8x8l_vertical_right_%1, 4,5,7
+    ; manually spill XMM registers for Win64 because
+    ; the code here is initialized with INIT_MMX
+    WIN64_SPILL_XMM 7
     sub          r0, r3
     lea          r4, [r0+r3*2]
     movq        mm0, [r0+r3*1-8]



More information about the ffmpeg-cvslog mailing list