Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1521651 > unrolled thread
| Started by | Stafford Horne <shorne@gmail.com> |
|---|---|
| First post | 2016-11-14 14:40 +0100 |
| Last post | 2016-11-14 14:40 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v2 3/9] openrisc: Add thread-local storage (TLS) support Stafford Horne <shorne@gmail.com> - 2016-11-14 14:40 +0100
| From | Stafford Horne <shorne@gmail.com> |
|---|---|
| Date | 2016-11-14 14:40 +0100 |
| Subject | [PATCH v2 3/9] openrisc: Add thread-local storage (TLS) support |
| Message-ID | <sDpEm-7Av-39@gated-at.bofh.it> |
From: Christian Svensson <blue@cmd.nu> 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 <blue@cmd.nu> Signed-off-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi> Signed-off-by: Stafford Horne <shorne@gmail.com> Tested-by: Guenter Roeck <linux@roeck-us.net> --- arch/openrisc/kernel/process.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c index 7095dfe..277123b 100644 --- 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 */ -- 2.7.4
Back to top | Article view | linux.kernel
csiph-web