@@ -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 */
@@ -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)
@@ -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)
@@ -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);
@@ -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,
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(-)