[x264-devel] x86inc: Preserve arguments when allocating stack space

Henrik Gramner git at videolan.org
Sun Jan 17 22:17:53 CET 2016


x264 | branch: master | Henrik Gramner <henrik at gramner.com> | Mon Oct 12 20:15:18 2015 +0200| [963b99efaaf1f0628b155e52b8a7c102cd1d37ff] | committer: Henrik Gramner

x86inc: Preserve arguments when allocating stack space

When allocating stack space with a larger alignment than the known stack
alignment a temporary register is used for storing the stack pointer.
Ensure that this isn't one of the registers used for passing arguments.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=963b99efaaf1f0628b155e52b8a7c102cd1d37ff
---

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

diff --git a/common/x86/x86inc.asm b/common/x86/x86inc.asm
index 9e3e7b0..bde32c5 100644
--- a/common/x86/x86inc.asm
+++ b/common/x86/x86inc.asm
@@ -374,8 +374,10 @@ DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
         %if %1 != 0 && required_stack_alignment > STACK_ALIGNMENT
             %if %1 > 0
                 %assign regs_used (regs_used + 1)
-            %elif ARCH_X86_64 && regs_used == num_args && num_args <= 4 + UNIX64 * 2
-                %warning "Stack pointer will overwrite register argument"
+            %endif
+            %if ARCH_X86_64 && regs_used < 5 + UNIX64 * 3
+                ; Ensure that we don't clobber any registers containing arguments
+                %assign regs_used 5 + UNIX64 * 3
             %endif
         %endif
     %endif



More information about the x264-devel mailing list