[x265] [PATCH 06 of 20] x86inc: Preserve arguments when allocating stack space

vignesh at multicorewareinc.com vignesh at multicorewareinc.com
Mon Jun 12 07:37:48 CEST 2017


# HG changeset patch
# User Vignesh Vijayakumar
# Date 1496742263 -19800
#      Tue Jun 06 15:14:23 2017 +0530
# Node ID bdf98aa6a337bfea485a310ab8ac69b6e45f857b
# Parent  2af3fa7671c10f40be66b09dd1a374b5daa13be5
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.

diff -r 2af3fa7671c1 -r bdf98aa6a337 source/common/x86/x86inc.asm
--- a/source/common/x86/x86inc.asm	Tue Jun 06 15:12:32 2017 +0530
+++ b/source/common/x86/x86inc.asm	Tue Jun 06 15:14:23 2017 +0530
@@ -366,8 +366,10 @@
         %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 x265-devel mailing list