diff mbox

[08/11] Add CONFIG_TARGET_NEEDS_AREG0

Message ID BANLkTineVEvqNjeDGj4MbsZxGtubDVmh9w@mail.gmail.com
State New
Headers show

Commit Message

Blue Swirl May 14, 2011, 7:41 p.m. UTC
In the future, targets may avoid using HELPER_CFLAGS when they are no
longer using the global CPUState register variable, env a.k.a. AREG0.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 Makefile.target        |    4 +++-
 configure              |    6 ++++++
 dyngen-exec.h          |    2 ++
 tcg/arm/tcg-target.h   |    4 ++++
 tcg/hppa/tcg-target.h  |    4 ++++
 tcg/i386/tcg-target.h  |    4 ++++
 tcg/ia64/tcg-target.h  |    4 ++++
 tcg/mips/tcg-target.h  |    4 ++++
 tcg/ppc/tcg-target.h   |    4 ++++
 tcg/ppc64/tcg-target.h |    4 ++++
 tcg/s390/tcg-target.h  |    4 ++++
 tcg/sparc/tcg-target.h |    4 ++++
 12 files changed, 47 insertions(+), 1 deletions(-)
diff mbox

Patch

From 0d7764b3fe5f13c79b8ee6b81871a2ecfab2adcf Mon Sep 17 00:00:00 2001
Message-Id: <0d7764b3fe5f13c79b8ee6b81871a2ecfab2adcf.1305401750.git.blauwirbel@gmail.com>
In-Reply-To: <6e21df8e369388a3152dcc7da30431c672e1ee37.1305401750.git.blauwirbel@gmail.com>
References: <6e21df8e369388a3152dcc7da30431c672e1ee37.1305401750.git.blauwirbel@gmail.com>
From: Blue Swirl <blauwirbel@gmail.com>
Date: Sun, 8 May 2011 16:54:36 +0000
Subject: [PATCH 08/11] Add CONFIG_TARGET_NEEDS_AREG0

In the future, targets may avoid using HELPER_CFLAGS when they are no
longer using the global CPUState register variable, env a.k.a. AREG0.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 Makefile.target        |    4 +++-
 configure              |    6 ++++++
 dyngen-exec.h          |    2 ++
 tcg/arm/tcg-target.h   |    4 ++++
 tcg/hppa/tcg-target.h  |    4 ++++
 tcg/i386/tcg-target.h  |    4 ++++
 tcg/ia64/tcg-target.h  |    4 ++++
 tcg/mips/tcg-target.h  |    4 ++++
 tcg/ppc/tcg-target.h   |    4 ++++
 tcg/ppc64/tcg-target.h |    4 ++++
 tcg/s390/tcg-target.h  |    4 ++++
 tcg/sparc/tcg-target.h |    4 ++++
 12 files changed, 47 insertions(+), 1 deletions(-)

diff --git a/Makefile.target b/Makefile.target
index 602d50d..52db0c3 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -92,13 +92,15 @@  translate-all.o: translate-all.c cpu.h
 
 tcg/tcg.o: cpu.h
 
-# HELPER_CFLAGS is used for all the code compiled with static register
+ifeq ($(CONFIG_TARGET_NEEDS_AREG0), y)
+# HELPER_CFLAGS is used for all the legacy code compiled with static register
 # variables
 %_helper.o cpu-exec.o user-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
 
 # Note: this is a workaround. The real fix is to avoid compiling
 # cpu_signal_handler() in user-exec.c.
 signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
+endif
 
 #########################################################
 # Linux user emulator target
diff --git a/configure b/configure
index 3ba6401..1215da2 100755
--- a/configure
+++ b/configure
@@ -3374,6 +3374,12 @@  if test "$target_bsd_user" = "yes" ; then
   echo "CONFIG_BSD_USER=y" >> $config_target_mak
 fi
 
+case "$ARCH" in
+  *)
+  echo "CONFIG_TARGET_NEEDS_AREG0=y" >> $config_target_mak
+  ;;
+esac
+
 # generate QEMU_CFLAGS/LDFLAGS for targets
 
 cflags=""
diff --git a/dyngen-exec.h b/dyngen-exec.h
index db00fba..96f85bb 100644
--- a/dyngen-exec.h
+++ b/dyngen-exec.h
@@ -28,6 +28,7 @@ 
 /* XXX: This may be wrong for 64-bit ILP32 hosts.  */
 typedef void * host_reg_t;
 
+#ifdef CONFIG_TARGET_NEEDS_AREG0
 #if defined(__i386__)
 #define AREG0 "ebp"
 #elif defined(__x86_64__)
@@ -63,6 +64,7 @@  typedef void * host_reg_t;
 #else
 #error unsupported CPU
 #endif
+#endif
 
 #define xglue(x, y) x ## y
 #define glue(x, y) xglue(x, y)
diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h
index d8d7d94..30d4f40 100644
--- a/tcg/arm/tcg-target.h
+++ b/tcg/arm/tcg-target.h
@@ -75,10 +75,14 @@  enum {
 
 #define TCG_TARGET_HAS_GUEST_BASE
 
+#ifdef CONFIG_TARGET_NEEDS_AREG0
 enum {
     /* Note: must be synced with dyngen-exec.h */
     TCG_AREG0 = TCG_REG_R7,
 };
+#else
+#error AREG0 free ops not implemented
+#endif
 
 static inline void flush_icache_range(unsigned long start, unsigned long stop)
 {
diff --git a/tcg/hppa/tcg-target.h b/tcg/hppa/tcg-target.h
index a5cc440..5a32fc8 100644
--- a/tcg/hppa/tcg-target.h
+++ b/tcg/hppa/tcg-target.h
@@ -102,8 +102,12 @@  enum {
 
 #define TCG_TARGET_HAS_GUEST_BASE
 
+#ifdef CONFIG_TARGET_NEEDS_AREG0
 /* Note: must be synced with dyngen-exec.h */
 #define TCG_AREG0 TCG_REG_R17
+#else
+#error AREG0 free ops not implemented
+#endif
 
 static inline void flush_icache_range(unsigned long start, unsigned long stop)
 {
diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h
index bfafbfc..2579686 100644
--- a/tcg/i386/tcg-target.h
+++ b/tcg/i386/tcg-target.h
@@ -114,12 +114,16 @@  enum {
 
 #define TCG_TARGET_HAS_GUEST_BASE
 
+#ifdef CONFIG_TARGET_NEEDS_AREG0
 /* Note: must be synced with dyngen-exec.h */
 #if TCG_TARGET_REG_BITS == 64
 # define TCG_AREG0 TCG_REG_R14
 #else
 # define TCG_AREG0 TCG_REG_EBP
 #endif
+#else
+#error AREG0 free ops not implemented
+#endif
 
 static inline void flush_icache_range(unsigned long start, unsigned long stop)
 {
diff --git a/tcg/ia64/tcg-target.h b/tcg/ia64/tcg-target.h
index e56e88f..8b46d96 100644
--- a/tcg/ia64/tcg-target.h
+++ b/tcg/ia64/tcg-target.h
@@ -138,8 +138,12 @@  enum {
 #undef TCG_TARGET_HAS_not_i32   /* xor r1, -1, r3 */
 #undef TCG_TARGET_HAS_not_i64   /* xor r1, -1, r3 */
 
+#ifdef CONFIG_TARGET_NEEDS_AREG0
 /* Note: must be synced with dyngen-exec.h */
 #define TCG_AREG0 TCG_REG_R7
+#else
+#error AREG0 free ops not implemented
+#endif
 
 /* Guest base is supported */
 #define TCG_TARGET_HAS_GUEST_BASE
diff --git a/tcg/mips/tcg-target.h b/tcg/mips/tcg-target.h
index 0028bfa..d9507a4 100644
--- a/tcg/mips/tcg-target.h
+++ b/tcg/mips/tcg-target.h
@@ -96,8 +96,12 @@  enum {
 #undef TCG_TARGET_HAS_ext8u_i32    /* andi rt, rs, 0xff   */
 #undef TCG_TARGET_HAS_ext16u_i32   /* andi rt, rs, 0xffff */
 
+#ifdef CONFIG_TARGET_NEEDS_AREG0
 /* Note: must be synced with dyngen-exec.h */
 #define TCG_AREG0 TCG_REG_S0
+#else
+#error AREG0 free ops not implemented
+#endif
 
 /* guest base is supported */
 #define TCG_TARGET_HAS_GUEST_BASE
diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h
index a1f8599..037935c 100644
--- a/tcg/ppc/tcg-target.h
+++ b/tcg/ppc/tcg-target.h
@@ -93,6 +93,10 @@  enum {
 #define TCG_TARGET_HAS_nand_i32
 #define TCG_TARGET_HAS_nor_i32
 
+#ifdef CONFIG_TARGET_NEEDS_AREG0
 #define TCG_AREG0 TCG_REG_R27
+#else
+#error AREG0 free ops not implemented
+#endif
 
 #define TCG_TARGET_HAS_GUEST_BASE
diff --git a/tcg/ppc64/tcg-target.h b/tcg/ppc64/tcg-target.h
index 8a6db11..0158c5b 100644
--- a/tcg/ppc64/tcg-target.h
+++ b/tcg/ppc64/tcg-target.h
@@ -103,7 +103,11 @@  enum {
 /* #define TCG_TARGET_HAS_nand_i64 */
 /* #define TCG_TARGET_HAS_nor_i64 */
 
+#ifdef CONFIG_TARGET_NEEDS_AREG0
 #define TCG_AREG0 TCG_REG_R27
+#else
+#error AREG0 free ops not implemented
+#endif
 
 #define TCG_TARGET_HAS_GUEST_BASE
 #define TCG_TARGET_EXTEND_ARGS 1
diff --git a/tcg/s390/tcg-target.h b/tcg/s390/tcg-target.h
index 4e45cf3..cbc3283 100644
--- a/tcg/s390/tcg-target.h
+++ b/tcg/s390/tcg-target.h
@@ -99,10 +99,14 @@  typedef enum TCGReg {
 
 #define TCG_TARGET_EXTEND_ARGS 1
 
+#ifdef CONFIG_TARGET_NEEDS_AREG0
 enum {
     /* Note: must be synced with dyngen-exec.h */
     TCG_AREG0 = TCG_REG_R10,
 };
+#else
+#error AREG0 free ops not implemented
+#endif
 
 static inline void flush_icache_range(unsigned long start, unsigned long stop)
 {
diff --git a/tcg/sparc/tcg-target.h b/tcg/sparc/tcg-target.h
index df0785e..ea718e0 100644
--- a/tcg/sparc/tcg-target.h
+++ b/tcg/sparc/tcg-target.h
@@ -129,6 +129,7 @@  enum {
 // #define TCG_TARGET_HAS_nor_i64
 #endif
 
+#ifdef CONFIG_TARGET_NEEDS_AREG0
 /* Note: must be synced with dyngen-exec.h */
 #ifdef CONFIG_SOLARIS
 #define TCG_AREG0 TCG_REG_G2
@@ -137,6 +138,9 @@  enum {
 #else
 #define TCG_AREG0 TCG_REG_G6
 #endif
+#else
+#error AREG0 free ops not implemented
+#endif
 
 static inline void flush_icache_range(unsigned long start, unsigned long stop)
 {
-- 
1.7.2.5