mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
checkasm/x86: Correctly handle variadic functions
The System V ABI on x86-64 specifies that the al register contains an upper bound of the number of arguments passed in vector registers when calling variadic functions, so we aren't allowed to clobber it. checkasm_fail_func() is a variadic function so also zero al before calling it. Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
parent
5405584b7b
commit
cc28552100
@ -77,8 +77,10 @@ cglobal stack_clobber, 1,2
|
|||||||
|
|
||||||
%if WIN64
|
%if WIN64
|
||||||
%assign free_regs 7
|
%assign free_regs 7
|
||||||
|
DECLARE_REG_TMP 4
|
||||||
%else
|
%else
|
||||||
%assign free_regs 9
|
%assign free_regs 9
|
||||||
|
DECLARE_REG_TMP 7
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
@ -86,7 +88,7 @@ cglobal stack_clobber, 1,2
|
|||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
INIT_XMM
|
INIT_XMM
|
||||||
cglobal checked_call, 2,15,16,max_args*8+8
|
cglobal checked_call, 2,15,16,max_args*8+8
|
||||||
mov r6, r0
|
mov t0, r0
|
||||||
|
|
||||||
; All arguments have been pushed on the stack instead of registers in order to
|
; All arguments have been pushed on the stack instead of registers in order to
|
||||||
; test for incorrect assumptions that 32-bit ints are zero-extended to 64-bit.
|
; test for incorrect assumptions that 32-bit ints are zero-extended to 64-bit.
|
||||||
@ -129,7 +131,7 @@ cglobal checked_call, 2,15,16,max_args*8+8
|
|||||||
mov r %+ i, [n %+ i]
|
mov r %+ i, [n %+ i]
|
||||||
%assign i i-1
|
%assign i i-1
|
||||||
%endrep
|
%endrep
|
||||||
call r6
|
call t0
|
||||||
%assign i 14
|
%assign i 14
|
||||||
%rep 15-free_regs
|
%rep 15-free_regs
|
||||||
xor r %+ i, [n %+ i]
|
xor r %+ i, [n %+ i]
|
||||||
@ -156,6 +158,7 @@ cglobal checked_call, 2,15,16,max_args*8+8
|
|||||||
mov r9, rax
|
mov r9, rax
|
||||||
mov r10, rdx
|
mov r10, rdx
|
||||||
lea r0, [error_message]
|
lea r0, [error_message]
|
||||||
|
xor eax, eax
|
||||||
call fail_func
|
call fail_func
|
||||||
mov rdx, r10
|
mov rdx, r10
|
||||||
mov rax, r9
|
mov rax, r9
|
||||||
|
Loading…
Reference in New Issue
Block a user