diff options
author | Henrik Gramner <henrik@gramner.com> | 2016-01-21 00:05:15 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2016-01-23 20:41:59 +0100 |
commit | 91ed050f426ba9747ea42b14e762ed412a28da76 (patch) | |
tree | 36cad0bf64d0cd3b3e6b4c4ac4ecdfb10dbcf35d | |
parent | 715eb7ca24c9fda8aed88a3276f5d11567c355bc (diff) | |
download | ffmpeg-91ed050f426ba9747ea42b14e762ed412a28da76.tar.gz |
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.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
-rw-r--r-- | libavutil/x86/x86inc.asm | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavutil/x86/x86inc.asm b/libavutil/x86/x86inc.asm index fc58b74e2a..7d6c1713dd 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 |