diff options
author | Haibo Xu <haibo.xu@arm.com> | 2020-01-13 07:44:58 +0000 |
---|---|---|
committer | Haibo Xu <haibo.xu@arm.com> | 2020-03-09 01:04:55 +0000 |
commit | c04958e2fa456587277baef361868bddc0df9e49 (patch) | |
tree | e22cd529a5bcdf62ff3042d1236b516eab2e5e4f /pkg/sentry/arch/arch_arm64.go | |
parent | ddfc7239be94fa9711df877a66a9718aabff8b96 (diff) |
Enable thread local storage support on arm64.
Linux use the task.thread.uw.tp_value field to store the
TLS pointer on arm64 platform, and we use a similar way
in gvisor to store it in the arch/State struct.
Signed-off-by: Haibo Xu <haibo.xu@arm.com>
Change-Id: Ie76b5c6d109bc27ccfd594008a96753806db7764
Diffstat (limited to 'pkg/sentry/arch/arch_arm64.go')
-rw-r--r-- | pkg/sentry/arch/arch_arm64.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/pkg/sentry/arch/arch_arm64.go b/pkg/sentry/arch/arch_arm64.go index 885115ae2..db99c5acb 100644 --- a/pkg/sentry/arch/arch_arm64.go +++ b/pkg/sentry/arch/arch_arm64.go @@ -140,16 +140,17 @@ func (c *context64) SetStack(value uintptr) { // TLS returns the current TLS pointer. func (c *context64) TLS() uintptr { - // TODO(gvisor.dev/issue/1238): TLS is not supported. - // MRS_TPIDR_EL0 - return 0 + return uintptr(c.TPValue) } // SetTLS sets the current TLS pointer. Returns false if value is invalid. func (c *context64) SetTLS(value uintptr) bool { - // TODO(gvisor.dev/issue/1238): TLS is not supported. - // MSR_TPIDR_EL0 - return false + if value >= uintptr(maxAddr64) { + return false + } + + c.TPValue = uint64(value) + return true } // SetOldRSeqInterruptedIP implements Context.SetOldRSeqInterruptedIP. |