[FFmpeg-cvslog] Merge commit 'f1b3e131385176c3c9d9783b25047856a0dcebf6'

James Almer git at videolan.org
Thu Mar 23 22:37:56 EET 2017


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Thu Mar 23 17:36:53 2017 -0300| [a2d34cc51ba1e3c19928f1c5aedd7a2990593c47] | committer: James Almer

Merge commit 'f1b3e131385176c3c9d9783b25047856a0dcebf6'

* commit 'f1b3e131385176c3c9d9783b25047856a0dcebf6':
  checkasm: aarch64: Clobber the stack before calling functions

Merged-by: James Almer <jamrial at gmail.com>

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

 tests/checkasm/aarch64/checkasm.S | 13 +++++++++++++
 tests/checkasm/checkasm.h         |  6 +++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/tests/checkasm/aarch64/checkasm.S b/tests/checkasm/aarch64/checkasm.S
index f0a671e..8e4f8c3 100644
--- a/tests/checkasm/aarch64/checkasm.S
+++ b/tests/checkasm/aarch64/checkasm.S
@@ -52,6 +52,19 @@ endconst
 // max number of args used by any asm function.
 #define MAX_ARGS 15
 
+#define CLOBBER_STACK ((8*MAX_ARGS + 15) & ~15)
+
+function checkasm_stack_clobber, export=1
+    mov         x29, sp
+    mov         x2,  #CLOBBER_STACK
+1:
+    stp         x0,  x1,  [sp, #-16]!
+    subs        x2,  x2,  #16
+    b.gt        1b
+    mov         sp,  x29
+    ret
+endfunc
+
 #define ARG_STACK ((8*(MAX_ARGS - 8) + 15) & ~15)
 
 function checkasm_checked_call, export=1
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index 18f65e3..b3fa83a 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -139,9 +139,13 @@ extern void (*checkasm_checked_call)(void *func, int dummy, ...);
 #define declare_new(ret, ...) ret (*checked_call)(void *, int dummy, __VA_ARGS__) = (void *)checkasm_checked_call;
 #define call_new(...) checked_call(func_new, 0, __VA_ARGS__)
 #elif ARCH_AARCH64 && !defined(__APPLE__)
+void checkasm_stack_clobber(uint64_t clobber, ...);
 void checkasm_checked_call(void *func, ...);
 #define declare_new(ret, ...) ret (*checked_call)(void *, __VA_ARGS__) = (void *)checkasm_checked_call;
-#define call_new(...) checked_call(func_new, __VA_ARGS__)
+#define CLOB (UINT64_C(0xdeadbeefdeadbeef))
+#define call_new(...) (checkasm_stack_clobber(CLOB,CLOB,CLOB,CLOB,CLOB,CLOB,CLOB,CLOB,CLOB,CLOB,CLOB,CLOB,\
+                                              CLOB,CLOB,CLOB,CLOB,CLOB,CLOB,CLOB,CLOB,CLOB,CLOB,CLOB),\
+                      checked_call(func_new, __VA_ARGS__))
 #else
 #define declare_new(ret, ...)
 #define declare_new_emms(cpu_flags, ret, ...)


======================================================================




More information about the ffmpeg-cvslog mailing list