summaryrefslogtreecommitdiffstats
path: root/src/kernel/start.S
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2015-11-24 20:27:09 -0600
committerPatrick Williams <iawillia@us.ibm.com>2015-12-11 15:30:27 -0600
commitd0edb877c861c146e97745604a2d1933a4844130 (patch)
tree91115d61a0d3faf8d131c49ac7a3b704ec3cb95c /src/kernel/start.S
parent105660534e02cb3223dcba7d4f7d6a1ad0433317 (diff)
downloadtalos-hostboot-d0edb877c861c146e97745604a2d1933a4844130.tar.gz
talos-hostboot-d0edb877c861c146e97745604a2d1933a4844130.zip
libc support for thread-local storage
RTC: 124148 Change-Id: I055885bc7d7cfc4ebd7cf1a662f677bdf4e28c62 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/22313 Tested-by: Jenkins Server Reviewed-by: Richard J. Knight <rjknight@us.ibm.com> Reviewed-by: Brian Silver <bsilver@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/kernel/start.S')
-rw-r--r--src/kernel/start.S22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/kernel/start.S b/src/kernel/start.S
index 6474a2ced..13351b893 100644
--- a/src/kernel/start.S
+++ b/src/kernel/start.S
@@ -5,7 +5,7 @@
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2010,2014
+# Contributors Listed Below - COPYRIGHT 2010,2015
# [+] International Business Machines Corp.
#
#
@@ -817,6 +817,26 @@ userspace_task_entry:
;// inserts garbage code into the task_end C function.
.global task_end_stub
task_end_stub:
+ // Check for a NULL stack pointer and skip TLS cleanup.
+ cmpi cr0, r1, 0
+ beq 1f
+ // Check for a NULL TLS-context and skip TLS cleanup.
+ ld r0, TASK_TLS_CONTEXT(r13)
+ cmpi cr0, r0, 0
+ beq 1f
+ // Save off r3.
+ mr r31, r3
+ // Set up TOC for __tls_cleanup
+ lis r2, __tls_cleanup@h
+ ori r2, r2, __tls_cleanup@l
+ ld r2, 8(r2)
+ // Call __tls_cleanup
+ mr r3, r0
+ bl __tls_cleanup
+ // Restore r3.
+ mr r3, r31
+1:
+ // Call task-end syscall.
mr r4, r3 ;// Move current rc (r3) to status value (r4)
li r3, 2 ;// TASK_END -> r3 (syscall number)
sc
OpenPOWER on IntegriCloud