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(-)
@@ -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
@@ -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=""
@@ -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)
@@ -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)
{
@@ -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)
{
@@ -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)
{
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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)
{
@@ -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
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(-)