Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Gramner <henrik@gramner.com>2015-10-12 21:15:18 +0300
committerHenrik Gramner <henrik@gramner.com>2016-01-22 01:19:46 +0300
commitdfe771dc5a09286a2cfeb68bdb4c328ecfe1c551 (patch)
tree18c1a64620fd8c53157c286140e9a7f40e4d8bb6 /libavutil/x86
parentb1496008ee173a62c14b49627123ccd4cc486a53 (diff)
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.
Diffstat (limited to 'libavutil/x86')
-rw-r--r--libavutil/x86/x86inc.asm7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavutil/x86/x86inc.asm b/libavutil/x86/x86inc.asm
index da85400b2d..f5e40228a7 100644
--- a/libavutil/x86/x86inc.asm
+++ b/libavutil/x86/x86inc.asm
@@ -386,8 +386,11 @@ 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. For UNIX64 we also preserve r6 (rax)
+ ; since it's used as a hidden argument in vararg functions to specify the number of vector registers used.
+ %assign regs_used 5 + UNIX64 * 3
%endif
%endif
%endif