[x264-devel] [PATCH 4/6] checkasm: arm/aarch64: Fix the amount of space reserved for stack parameters

Janne Grunau janne-x264 at jannau.net
Tue Nov 15 23:55:15 CET 2016


On 2016-11-14 23:54:51 +0200, Martin Storsjö wrote:
> Even if MAX_ARGS - 2 (for arm) or MAX_ARGS - 6 (for aarch64) parameters
> are passed on the stack to checkasm_checked_call, we actually only
> need to store MAX_ARGS - 4 (for arm) or MAX_ARGS - 8 (for aarch64)
> parameters on the stack when calling the tested function.
> ---
>  tools/checkasm-aarch64.S | 4 ++--
>  tools/checkasm-arm.S     | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/checkasm-aarch64.S b/tools/checkasm-aarch64.S
> index f96576b..af4ed31 100644
> --- a/tools/checkasm-aarch64.S
> +++ b/tools/checkasm-aarch64.S
> @@ -56,7 +56,7 @@ error_message:
>  // max number of args used by any x264 asm function.
>  #define MAX_ARGS 15
>  
> -#define ARG_STACK ((8*(MAX_ARGS - 6) + 15) & ~15)
> +#define ARG_STACK ((8*(MAX_ARGS - 8) + 15) & ~15)
>  
>  function x264_checkasm_call, export=1
>      stp         x29, x30, [sp, #-16]!
> @@ -87,7 +87,7 @@ function x264_checkasm_call, export=1
>      sub         sp,  sp,  #ARG_STACK
>  .equ pos, 0
>  // first two stacked args are copied to x6, x7
> -.rept MAX_ARGS-6
> +.rept MAX_ARGS-8
>      ldr         x9, [x29, #16 + 16 + pos]
>      str         x9, [sp, #pos]
>  .equ pos, pos + 8
> diff --git a/tools/checkasm-arm.S b/tools/checkasm-arm.S
> index 8242a58..8dd8c4a 100644
> --- a/tools/checkasm-arm.S
> +++ b/tools/checkasm-arm.S
> @@ -45,7 +45,7 @@ error_message:
>  @ max number of args used by any x264 asm function.
>  #define MAX_ARGS 15
>  
> -#define ARG_STACK 4*(MAX_ARGS - 2)
> +#define ARG_STACK 4*(MAX_ARGS - 4)
>  
>  @ align the used stack space to 8 to preserve the stack alignment
>  #define ARG_STACK_A (((ARG_STACK + pushed + 7) & ~7) - pushed)
> @@ -69,7 +69,7 @@ function x264_checkasm_call_\variant
>  
>      sub         sp,  sp,  #ARG_STACK_A
>  .equ pos, 0
> -.rept MAX_ARGS-2
> +.rept MAX_ARGS-4
>      ldr         r12, [sp, #ARG_STACK_A + pushed + 8 + pos]
>      str         r12, [sp, #pos]
>  .equ pos, pos + 4

ok

Janne


More information about the x264-devel mailing list