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

Martin Storsjö git at videolan.org
Thu Dec 1 21:01:43 CET 2016


x264 | branch: master | Martin Storsjö <martin at martin.st> | Mon Nov 14 23:54:51 2016 +0200| [c996ed202e2d17d1d8ae42c42d0707e51c29bb93] | committer: Henrik Gramner

checkasm: arm/aarch64: Fix the amount of space reserved for stack parameters

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.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=c996ed202e2d17d1d8ae42c42d0707e51c29bb93
---

 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



More information about the x264-devel mailing list