Skip to contentSkip to conversation

[5954] linux-user: Move abi_* typedefs into qemu-types.h

Qemu-devel Aurelien Jarno 3 participants 4 messages Dec 8, 2008 – Dec 12, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 5954

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5954
Author:   aurel32
Date:     2008-12-08 18:12:04 +0000 (Mon, 08 Dec 2008)

Log Message:
-----------
linux-user: Move abi_* typedefs into qemu-types.h

Modified Paths:
--------------
trunk/bsd-user/qemu.h
trunk/linux-user/qemu.h

Added Paths:
-----------
trunk/bsd-user/qemu-types.h
trunk/linux-user/qemu-types.h

Added: trunk/bsd-user/qemu-types.h
===================================================================

bsd-user/qemu-types.h +24 -0
@@ -0,0 +1,24 @@
+#ifndef QEMU_TYPES_H
+#define QEMU_TYPES_H
+#include "cpu.h"
+
+#ifdef TARGET_ABI32
+typedef uint32_t abi_ulong;
+typedef int32_t abi_long;
+#define TARGET_ABI_FMT_lx "%08x"
+#define TARGET_ABI_FMT_ld "%d"
+#define TARGET_ABI_FMT_lu "%u"
+#define TARGET_ABI_BITS 32
+#else
+typedef target_ulong abi_ulong;
+typedef target_long abi_long;
+#define TARGET_ABI_FMT_lx TARGET_FMT_lx
+#define TARGET_ABI_FMT_ld TARGET_FMT_ld
+#define TARGET_ABI_FMT_lu TARGET_FMT_lu
+#define TARGET_ABI_BITS TARGET_LONG_BITS
+/* for consistency, define ABI32 too */
+#if TARGET_ABI_BITS == 32
+#define TARGET_ABI32 1
+#endif
+#endif
+#endif

Modified: trunk/bsd-user/qemu.h
===================================================================

bsd-user/qemu.h +1 -19
@@ -11,25 +11,7 @@
 #include <stdlib.h>
 #endif /* DEBUG_REMAP */
 
-#ifdef TARGET_ABI32
-typedef uint32_t abi_ulong;
-typedef int32_t abi_long;
-#define TARGET_ABI_FMT_lx "%08x"
-#define TARGET_ABI_FMT_ld "%d"
-#define TARGET_ABI_FMT_lu "%u"
-#define TARGET_ABI_BITS 32
-#else
-typedef target_ulong abi_ulong;
-typedef target_long abi_long;
-#define TARGET_ABI_FMT_lx TARGET_FMT_lx
-#define TARGET_ABI_FMT_ld TARGET_FMT_ld
-#define TARGET_ABI_FMT_lu TARGET_FMT_lu
-#define TARGET_ABI_BITS TARGET_LONG_BITS
-/* for consistency, define ABI32 too */
-#if TARGET_ABI_BITS == 32
-#define TARGET_ABI32 1
-#endif
-#endif
+#include "qemu-types.h"
 
 enum BSDType {
     target_freebsd,

Added: trunk/linux-user/qemu-types.h
===================================================================

linux-user/qemu-types.h +24 -0
@@ -0,0 +1,24 @@
+#ifndef QEMU_TYPES_H
+#define QEMU_TYPES_H
+#include "cpu.h"
+
+#ifdef TARGET_ABI32
+typedef uint32_t abi_ulong;
+typedef int32_t abi_long;
+#define TARGET_ABI_FMT_lx "%08x"
+#define TARGET_ABI_FMT_ld "%d"
+#define TARGET_ABI_FMT_lu "%u"
+#define TARGET_ABI_BITS 32
+#else
+typedef target_ulong abi_ulong;
+typedef target_long abi_long;
+#define TARGET_ABI_FMT_lx TARGET_FMT_lx
+#define TARGET_ABI_FMT_ld TARGET_FMT_ld
+#define TARGET_ABI_FMT_lu TARGET_FMT_lu
+#define TARGET_ABI_BITS TARGET_LONG_BITS
+/* for consistency, define ABI32 too */
+#if TARGET_ABI_BITS == 32
+#define TARGET_ABI32 1
+#endif
+#endif
+#endif

Modified: trunk/linux-user/qemu.h
===================================================================

linux-user/qemu.h +1 -19
@@ -11,25 +11,7 @@
 #include <stdlib.h>
 #endif /* DEBUG_REMAP */
 
-#ifdef TARGET_ABI32
-typedef uint32_t abi_ulong;
-typedef int32_t abi_long;
-#define TARGET_ABI_FMT_lx "%08x"
-#define TARGET_ABI_FMT_ld "%d"
-#define TARGET_ABI_FMT_lu "%u"
-#define TARGET_ABI_BITS 32
-#else
-typedef target_ulong abi_ulong;
-typedef target_long abi_long;
-#define TARGET_ABI_FMT_lx TARGET_FMT_lx
-#define TARGET_ABI_FMT_ld TARGET_FMT_ld
-#define TARGET_ABI_FMT_lu TARGET_FMT_lu
-#define TARGET_ABI_BITS TARGET_LONG_BITS
-/* for consistency, define ABI32 too */
-#if TARGET_ABI_BITS == 32
-#define TARGET_ABI32 1
-#endif
-#endif
+#include "qemu-types.h"
 
 #include "thunk.h"
 #include "syscall_defs.h"
#1 lore raw
Quoted 6 lines · Aurelien Jarno

linux-user: Move abi_* typedefs into qemu-types.h

Added Paths:
-----------
trunk/bsd-user/qemu-types.h
trunk/linux-user/qemu-types.h

Sorry if I'm a little late with this comment, but might it be better if bsd-user and linux-user emulation shared the same header, here? (It seems likely that any changes would have to be made to both files, and there might be the possibility of other user emulation targets appearing in the future.)

BTW, it does seem strange to me that the types are named 'target_long' and 'abi_long'. The 'long' type would seem to me to be an ABI concept by definition, so I would have expected target_long to match the target ABI's long type, and something with a name similar to target_word to refer to the target CPU's 'word size' (whatever that really means...)

I guess the approach that was taken was to replace target_longs with abi_longs in the relatively small number of places where abi_longs were needed, as the other approach would have been much more disruptive...

Cheers,

Signature · 1 line
Stuart Brady
#2 lore raw

Am 12.12.2008 um 23:40 schrieb Stuart Brady:

Quoted 10 lines · Aurelien Jarno
Quoted 6 lines

linux-user: Move abi_* typedefs into qemu-types.h

Added Paths:
-----------
trunk/bsd-user/qemu-types.h
trunk/linux-user/qemu-types.h

Sorry if I'm a little late with this comment, but might it be better if bsd-user and linux-user emulation shared the same header, here?

Fabrice was said to be against sharing code between the various user emulators.

Andreas

#3 lore raw
Quoted 6 lines · Andreas Färber

Am 12.12.2008 um 23:40 schrieb Stuart Brady:

Quoted 2 lines

Sorry if I'm a little late with this comment, but might it be better if bsd-user and linux-user emulation shared the same header, here?

Fabrice was said to be against sharing code between the various user emulators.

Hmm, good point -- but these definitions seem so fundamental that I wonder whether that still applies. I.e. should each user emulator have its own definitions of target_long, etc. too? (Well, obviously not...)

Signature · 1 line
Stuart Brady