Patchwork [2/7] target-ppc: add cpu_set_tls

login
register
mail settings
Submitter Nathan Froyd
Date Aug. 3, 2009, 3:43 p.m.
Message ID <1249314209-10230-3-git-send-email-froydnj@codesourcery.com>
Download mbox | patch
Permalink /patch/30651/
State Superseded
Headers show

Comments

Nathan Froyd - Aug. 3, 2009, 3:43 p.m.
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
---
 target-ppc/cpu.h |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

Patch

diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
index 148e8c3..fe2257d 100644
--- a/target-ppc/cpu.h
+++ b/target-ppc/cpu.h
@@ -1589,4 +1589,15 @@  static inline void cpu_get_tb_cpu_state(CPUState *env, target_ulong *pc,
     *flags = env->hflags;
 }
 
+static inline void cpu_set_tls(CPUState *env, target_ulong newtls)
+{
+#if defined(TARGET_PPC64)
+    /* The kernel checks TIF_32BIT here; we don't support loading 32-bit
+       binaries on PPC64 yet. */
+    env->gpr[13] = newtls;
+#else
+    env->gpr[2] = newtls;
+#endif
+}
+
 #endif /* !defined (__CPU_PPC_H__) */