From 35b66fc4f9dd2c4c3fb8e26c5c1480965b81bbd4 Mon Sep 17 00:00:00 2001
From: bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Date: Sat, 24 Jan 2004 15:26:06 +0000
Subject: [PATCH] correct target_ulong definition

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@582 c046a42c-6fe2-441c-8c8c-71466251a162
---
 cpu-defs.h | 16 ++++++++++++++++
 exec-all.h |  5 -----
 thunk.h    | 17 +----------------
 3 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/cpu-defs.h b/cpu-defs.h
index 84b5e280e0..013076b4b2 100644
--- a/cpu-defs.h
+++ b/cpu-defs.h
@@ -23,6 +23,22 @@
 #include "config.h"
 #include <setjmp.h>
 
+#ifndef TARGET_LONG_BITS
+#error TARGET_LONG_BITS must be defined before including this header
+#endif
+
+#define TARGET_LONG_SIZE (TARGET_LONG_BITS / 8)
+
+#if TARGET_LONG_SIZE == 4
+typedef int32_t target_long;
+typedef uint32_t target_ulong;
+#elif TARGET_LONG_SIZE == 8
+typedef int64_t target_long;
+typedef uint64_t target_ulong;
+#else
+#error TARGET_LONG_SIZE undefined
+#endif
+
 #define EXCP_INTERRUPT 	256 /* async interruption */
 #define EXCP_HLT        257 /* hlt instruction reached */
 #define EXCP_DEBUG      258 /* cpu stopped after a breakpoint or singlestep */
diff --git a/exec-all.h b/exec-all.h
index fa407e94a6..9c7e5ed83f 100644
--- a/exec-all.h
+++ b/exec-all.h
@@ -28,11 +28,6 @@
 #define tostring(s)	#s
 #endif
 
-#ifndef THUNK_H
-/* horrible */
-typedef uint32_t target_ulong;
-#endif
-
 #if GCC_MAJOR < 3
 #define __builtin_expect(x, n) (x)
 #endif
diff --git a/thunk.h b/thunk.h
index 6b4c2c3673..b281319a5a 100644
--- a/thunk.h
+++ b/thunk.h
@@ -21,7 +21,7 @@
 #define THUNK_H
 
 #include <inttypes.h>
-#include "config.h"
+#include "cpu.h"
 
 #include "bswap.h"
 
@@ -29,11 +29,6 @@
 #define BSWAP_NEEDED
 #endif
 
-/* XXX: autoconf */
-#define TARGET_LONG_BITS 32
-
-#define TARGET_LONG_SIZE (TARGET_LONG_BITS / 8)
-
 #ifdef BSWAP_NEEDED
 
 static inline uint16_t tswap16(uint16_t s)
@@ -105,16 +100,6 @@ static inline void tswap64s(uint64_t *s)
 #define tswapls(s) tswap64s((uint64_t *)(s))
 #endif
 
-#if TARGET_LONG_SIZE == 4
-typedef int32_t target_long;
-typedef uint32_t target_ulong;
-#elif TARGET_LONG_SIZE == 8
-typedef int64_t target_long;
-typedef uint64_t target_ulong;
-#else
-#error TARGET_LONG_SIZE undefined
-#endif
-
 /* types enums definitions */
 
 typedef enum argtype {