summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2015-09-16 01:49:49 +0300
committerWaldemar Brodkorb <wbx@openadk.org>2015-10-08 20:31:24 +0200
commite78a0f58f23347c822c182d1c01f6eb9b9866d60 (patch)
tree723cfbcd2411d889fb4956adb7f2d11a6d766050 /test
parent9fae2ad9937279c9f7f40975ac14cb7b57f4a36d (diff)
xtensa: support call0 ABI
Most changes are mechanical replacement of 'retw' instruction with 'abi_ret' macro, defined to 'retw' or 'ret' according to ABI. Assembly code that makes calls is duplicated for call0 ABI with changed register numbers for parameters/return value and call instruction. 'entry' instructions are replaced with 'abi_entry' macro. More interesting changes: - non-leaf assembly functions (e.g. _dl_tlsdesc_dynamic, _dl_linux_resolve, SYSCALL_ERROR_HANDLER, PSEUDO) now need to preserve registers around intermediate calls they make, use temporary stack frame for that; - setjmp/longjmp only need to save and restore return address, stack pointer and callee-saved registers in the jmpbuf; - __clone and syscall functions had hardcoded offsets to parameter passed on stack, on call0 ABI they don't need stack frame, so the offset is different. Replace these offsets with FRAMESIZE macro. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/tls/tls-macros.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/tls/tls-macros.h b/test/tls/tls-macros.h
index 7d8927400..315f0e2b9 100644
--- a/test/tls/tls-macros.h
+++ b/test/tls/tls-macros.h
@@ -887,6 +887,7 @@ register void *__gp __asm__("$29");
#elif defined __xtensa__
+#if defined(__XTENSA_WINDOWED_ABI__)
#define TLS_GD(x) \
({ int *__l; \
__asm__ ("movi a8, " #x "@TLSFUNC\n\t" \
@@ -909,6 +910,32 @@ register void *__gp __asm__("$29");
: \
: "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15"); \
__l; })
+#elif defined(__XTENSA_CALL0_ABI__)
+#define TLS_GD(x) \
+ ({ int *__l; \
+ __asm__ ("movi a0, " #x "@TLSFUNC\n\t" \
+ "movi a2, " #x "@TLSARG\n\t" \
+ "callx0.tls a0, " #x "@TLSCALL\n\t" \
+ "mov %0, a2\n\t" \
+ : "=r" (__l) \
+ : \
+ : "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11");\
+ __l; })
+
+#define TLS_LD(x) \
+ ({ int *__l; \
+ __asm__ ("movi a0, _TLS_MODULE_BASE_@TLSFUNC\n\t" \
+ "movi a2, _TLS_MODULE_BASE_@TLSARG\n\t" \
+ "callx0.tls a0, _TLS_MODULE_BASE_@TLSCALL\n\t" \
+ "movi %0, " #x "@TPOFF\n\t" \
+ "add %0, %0, a2\n\t" \
+ : "=r" (__l) \
+ : \
+ : "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11");\
+ __l; })
+#else
+#error Unsupported Xtensa ABI
+#endif
#define TLS_IE(x) TLS_LE(x)