[PATCH] D40857: [AArch64][Darwin] Add new ARM64 stack probing function for Darwin
Amara Emerson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 5 14:35:32 PST 2017
aemerson created this revision.
Herald added subscribers: Sanitizers, kristof.beyls, javed.absar, mgorny, rengolin.
[AArch64][Darwin] Add new ARM64 stack probing function for Darwin.
This is the ARM64 equivalent of the Darwin x86 stack probing function and likewise it doesn't modify the stack pointer. However it does have a custom calling convention (uses registers X9-X11).
rdar://25859140
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D40857
Files:
lib/builtins/CMakeLists.txt
lib/builtins/aarch64/chkstk_darwin.S
lib/builtins/assembly.h
Index: lib/builtins/assembly.h
===================================================================
--- lib/builtins/assembly.h
+++ lib/builtins/assembly.h
@@ -18,6 +18,8 @@
#if defined(__POWERPC__) || defined(__powerpc__) || defined(__ppc__)
#define SEPARATOR @
+#elif defined(__aarch64__)
+#define SEPARATOR %%
#else
#define SEPARATOR ;
#endif
Index: lib/builtins/aarch64/chkstk_darwin.S
===================================================================
--- /dev/null
+++ lib/builtins/aarch64/chkstk_darwin.S
@@ -0,0 +1,33 @@
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+
+#include "../assembly.h"
+
+#ifdef __aarch64__
+
+#define PAGE_SZ 4096
+
+// ___chkstk_darwin - a generic stack probing function.
+// The number of bytes to probe is passed in w9.
+// This clobbers registers x9, x10 and x11.
+// Does not modify any memory or the stack pointer
+
+.balign 4
+DEFINE_COMPILERRT_FUNCTION(___chkstk_darwin)
+.weak_definition ___chkstk_darwin
+ cmp w9, #PAGE_SZ
+ mov x10, sp
+ b.lo Lend
+Lloop:
+ sub x10, x10, #PAGE_SZ
+ ldr x11, [x10]
+ sub w9, w9, #PAGE_SZ
+ cmp w9, #PAGE_SZ
+ b.hi Lloop
+Lend:
+ sub x10, x10, x9
+ ldr x11, [x10]
+ ret
+END_COMPILERRT_FUNCTION(___chkstk_darwin)
+
+#endif // __aarch64__
Index: lib/builtins/CMakeLists.txt
===================================================================
--- lib/builtins/CMakeLists.txt
+++ lib/builtins/CMakeLists.txt
@@ -444,6 +444,7 @@
endif()
set(aarch64_SOURCES
+ aarch64/chkstk_darwin.S
${GENERIC_TF_SOURCES}
${GENERIC_SOURCES})
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40857.125616.patch
Type: text/x-patch
Size: 1719 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171205/2d00f431/attachment.bin>
More information about the llvm-commits
mailing list