[FFmpeg-cvslog] checkasm/arm: preserve the stack alignment checkasm_checked_call

Janne Grunau git at videolan.org
Thu Nov 17 16:21:39 EET 2016


ffmpeg | branch: master | Janne Grunau <janne-libav at jannau.net> | Tue Jul 12 22:46:43 2016 +0200| [7b1ae0e73ab7f7c5eabc70dbe2e579127c6e154f] | committer: Janne Grunau

checkasm/arm: preserve the stack alignment checkasm_checked_call

The stack used by checkasm_checked_call_vfp was a multiple of 4 when the
checked function is called. AAPCS requires a double word (8 byte)
aligned stack public interfaces. Since both calls are public interfaces
the stack is misaligned when the checked is called.

Might fix the SIGBUS error in the armv7-linux-clang-3.7 fate config.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7b1ae0e73ab7f7c5eabc70dbe2e579127c6e154f
---

 tests/checkasm/arm/checkasm.S | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tests/checkasm/arm/checkasm.S b/tests/checkasm/arm/checkasm.S
index 199c96a..f004af3 100644
--- a/tests/checkasm/arm/checkasm.S
+++ b/tests/checkasm/arm/checkasm.S
@@ -42,6 +42,9 @@ endconst
 
 #define ARG_STACK 4*(MAX_ARGS - 2)
 
+@ align the used stack space to 8 to preserve the stack alignment
+#define ARG_STACK_A (((ARG_STACK + pushed + 7) & ~7) - pushed)
+
 .macro clobbercheck variant
 .equ pushed, 4*9
 function checkasm_checked_call_\variant, export=1
@@ -59,10 +62,10 @@ function checkasm_checked_call_\variant, export=1
 .endif
     ldm         r12, {r4-r11}
 
-    sub         sp,  sp,  #ARG_STACK
+    sub         sp,  sp,  #ARG_STACK_A
 .equ pos, 0
 .rept MAX_ARGS-2
-    ldr         r12, [sp, #ARG_STACK + pushed + 8 + pos]
+    ldr         r12, [sp, #ARG_STACK_A + pushed + 8 + pos]
     str         r12, [sp, #pos]
 .equ pos, pos + 4
 .endr
@@ -70,9 +73,9 @@ function checkasm_checked_call_\variant, export=1
     mov         r12, r0
     mov         r0,  r2
     mov         r1,  r3
-    ldrd        r2,  r3,  [sp, #ARG_STACK + pushed]
+    ldrd        r2,  r3,  [sp, #ARG_STACK_A + pushed]
     blx         r12
-    add         sp,  sp,  #ARG_STACK
+    add         sp,  sp,  #ARG_STACK_A
 
     push        {r0, r1}
     movrel      r12, register_init



More information about the ffmpeg-cvslog mailing list