Patchwork [08/14] tcg-sparc: Do not use a global register for AREG0.

login
register
mail settings
Submitter Richard Henderson
Date April 19, 2012, 1:33 p.m.
Message ID <1334842395-31819-9-git-send-email-rth@twiddle.net>
Download mbox | patch
Permalink /patch/153798/
State New
Headers show

Comments

Richard Henderson - April 19, 2012, 1:33 p.m.
Use of "env" as a macro means constraining include file ordering a bit.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 dyngen-exec.h                |   17 +++++++----------
 target-m68k/op_helper.c      |    2 +-
 target-unicore32/op_helper.c |    2 +-
 target-xtensa/op_helper.c    |    4 ++--
 xtensa-semi.c                |    4 ++--
 5 files changed, 13 insertions(+), 16 deletions(-)

Patch

diff --git a/dyngen-exec.h b/dyngen-exec.h
index 65fcb43..97fd32c 100644
--- a/dyngen-exec.h
+++ b/dyngen-exec.h
@@ -41,13 +41,8 @@ 
 #elif defined(__mips__)
 #define AREG0 "s0"
 #elif defined(__sparc__)
-#ifdef CONFIG_SOLARIS
-#define AREG0 "g2"
-#elif HOST_LONG_BITS == 64
-#define AREG0 "g5"
-#else
-#define AREG0 "g6"
-#endif
+/* Don't use a global register.  Working around glibc clobbering these
+   global registers is more trouble than just using TLS.  */
 #elif defined(__s390__)
 #define AREG0 "r10"
 #elif defined(__alpha__)
@@ -62,11 +57,13 @@ 
 #error unsupported CPU
 #endif
 
-#if defined(AREG0)
+#ifdef AREG0
 register CPUArchState *env asm(AREG0);
 #else
-/* TODO: Try env = cpu_single_env. */
-extern CPUArchState *env;
+/* Without a hard register, we can use the TLS variable instead.  Note that
+   this macro interferes with the use of "env" in DEF_HELPER_N, thus targets
+   should always include "helper.h" before "dyngen-exec.h".  */
+#define env cpu_single_env
 #endif
 
 #endif /* !CONFIG_TCG_PASS_AREG0 */
diff --git a/target-m68k/op_helper.c b/target-m68k/op_helper.c
index 1971a57..048c131 100644
--- a/target-m68k/op_helper.c
+++ b/target-m68k/op_helper.c
@@ -17,8 +17,8 @@ 
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 #include "cpu.h"
-#include "dyngen-exec.h"
 #include "helpers.h"
+#include "dyngen-exec.h"
 
 #if defined(CONFIG_USER_ONLY)
 
diff --git a/target-unicore32/op_helper.c b/target-unicore32/op_helper.c
index b954c30..08dbc76 100644
--- a/target-unicore32/op_helper.c
+++ b/target-unicore32/op_helper.c
@@ -9,8 +9,8 @@ 
  * later version. See the COPYING file in the top-level directory.
  */
 #include "cpu.h"
-#include "dyngen-exec.h"
 #include "helper.h"
+#include "dyngen-exec.h"
 
 #define SIGNBIT (uint32_t)0x80000000
 #define SIGNBIT64 ((uint64_t)1 << 63)
diff --git a/target-xtensa/op_helper.c b/target-xtensa/op_helper.c
index 364dc19..d098be3 100644
--- a/target-xtensa/op_helper.c
+++ b/target-xtensa/op_helper.c
@@ -26,9 +26,9 @@ 
  */
 
 #include "cpu.h"
-#include "dyngen-exec.h"
-#include "helper.h"
 #include "host-utils.h"
+#include "helper.h"
+#include "dyngen-exec.h"
 
 static void do_unaligned_access(target_ulong addr, int is_write, int is_user,
                                 uintptr_t retaddr);
diff --git a/xtensa-semi.c b/xtensa-semi.c
index b7c8c34..42df6af 100644
--- a/xtensa-semi.c
+++ b/xtensa-semi.c
@@ -30,9 +30,9 @@ 
 #include <string.h>
 #include <stddef.h>
 #include "cpu.h"
-#include "dyngen-exec.h"
-#include "helper.h"
 #include "qemu-log.h"
+#include "helper.h"
+#include "dyngen-exec.h"
 
 enum {
     TARGET_SYS_exit = 1,