aboutsummaryrefslogtreecommitdiffstats
path: root/arch/xtensa/kernel/entry.S
diff options
context:
space:
mode:
authorChris Zankel <chris@zankel.net>2013-02-23 22:35:57 -0500
committerChris Zankel <chris@zankel.net>2013-02-23 22:35:57 -0500
commitc50842df47970eab459f13490c152aac85fc02f2 (patch)
treed2933b4d9641067002ba6d662b0abf6ee3011375 /arch/xtensa/kernel/entry.S
parentb0c438e642699f8c47b84de957f30cf586cdbebd (diff)
xtensa: add support for TLS
The Xtensa architecture provides a global register called THREADPTR for the purpose of Thread Local Storage (TLS) support. This allows us to use a fairly simple implementation, keeping the thread pointer in the regset and simply saving and restoring it upon entering/exiting the from user space. Signed-off-by: Chris Zankel <chris@zankel.net>
Diffstat (limited to 'arch/xtensa/kernel/entry.S')
-rw-r--r--arch/xtensa/kernel/entry.S12
1 files changed, 11 insertions, 1 deletions
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S
index 70d5a9e33573..63845f950792 100644
--- a/arch/xtensa/kernel/entry.S
+++ b/arch/xtensa/kernel/entry.S
@@ -130,6 +130,11 @@ _user_exception:
130 s32i a3, a1, PT_SAR 130 s32i a3, a1, PT_SAR
131 s32i a2, a1, PT_ICOUNTLEVEL 131 s32i a2, a1, PT_ICOUNTLEVEL
132 132
133#if XCHAL_HAVE_THREADPTR
134 rur a2, threadptr
135 s32i a2, a1, PT_THREADPTR
136#endif
137
133 /* Rotate ws so that the current windowbase is at bit0. */ 138 /* Rotate ws so that the current windowbase is at bit0. */
134 /* Assume ws = xxwww1yyyy. Rotate ws right, so that a2 = yyyyxxwww1 */ 139 /* Assume ws = xxwww1yyyy. Rotate ws right, so that a2 = yyyyxxwww1 */
135 140
@@ -510,6 +515,11 @@ user_exception_exit:
510 * (if we have restored WSBITS-1 frames). 515 * (if we have restored WSBITS-1 frames).
511 */ 516 */
512 517
518#if XCHAL_HAVE_THREADPTR
519 l32i a3, a1, PT_THREADPTR
520 wur a3, threadptr
521#endif
522
5132: j common_exception_exit 5232: j common_exception_exit
514 524
515 /* This is the kernel exception exit. 525 /* This is the kernel exception exit.
@@ -1955,7 +1965,7 @@ ENTRY(_switch_to)
1955 s32i a6, a3, EXC_TABLE_FIXUP 1965 s32i a6, a3, EXC_TABLE_FIXUP
1956 s32i a7, a3, EXC_TABLE_KSTK 1966 s32i a7, a3, EXC_TABLE_KSTK
1957 1967
1958 /* restore context of the task that 'next' addresses */ 1968 /* restore context of the task 'next' */
1959 1969
1960 l32i a0, a13, THREAD_RA # restore return address 1970 l32i a0, a13, THREAD_RA # restore return address
1961 l32i a1, a13, THREAD_SP # restore stack pointer 1971 l32i a1, a13, THREAD_SP # restore stack pointer