projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c799021
)
openrisc: Add thread-local storage (TLS) support
author
Christian Svensson
<
[email protected]
>
Sat, 25 Jan 2014 15:48:54 +0000
(15:48 +0000)
committer
Stafford Horne
<
[email protected]
>
Mon, 12 Dec 2016 14:09:28 +0000
(23:09 +0900)
Historically OpenRISC GCC has reserved r10 which we now use to hold
the thread pointer for thread-local storage (TLS).
Signed-off-by: Christian Svensson <
[email protected]
>
Signed-off-by: Stefan Kristiansson <
[email protected]
>
Tested-by: Guenter Roeck <
[email protected]
>
Signed-off-by: Stafford Horne <
[email protected]
>
arch/openrisc/kernel/process.c
patch
|
blob
|
history
diff --git
a/arch/openrisc/kernel/process.c
b/arch/openrisc/kernel/process.c
index 7095dfe7666ba3dd55a0807ffd7d09b00af3ccc2..277123bb4bf8db9e2cb45b121c24e33290464699 100644
(file)
--- a/
arch/openrisc/kernel/process.c
+++ b/
arch/openrisc/kernel/process.c
@@
-173,6
+173,19
@@
copy_thread(unsigned long clone_flags, unsigned long usp,
if (usp)
userregs->sp = usp;
+
+ /*
+ * For CLONE_SETTLS set "tp" (r10) to the TLS pointer passed to sys_clone.
+ *
+ * The kernel entry is:
+ * int clone (long flags, void *child_stack, int *parent_tid,
+ * int *child_tid, struct void *tls)
+ *
+ * This makes the source r7 in the kernel registers.
+ */
+ if (clone_flags & CLONE_SETTLS)
+ userregs->gpr[10] = userregs->gpr[7];
+
userregs->gpr[11] = 0; /* Result from fork() */
kregs->gpr[20] = 0; /* Userspace thread */