1
0
Fork 0

openrisc: Add thread-local storage (TLS) support

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>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Stafford Horne <shorne@gmail.com>
hifive-unleashed-5.1
Christian Svensson 2014-01-25 15:48:54 +00:00 committed by Stafford Horne
parent c79902190f
commit e60aa2fba4
1 changed files with 13 additions and 0 deletions

View File

@ -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 */