[V2,4/5] vmstate: move VMSTATE_UINTTL* macros definitions to cpu-defs.h

Message ID 1330936245-2570-5-git-send-email-i.mitsyanko@samsung.com
State New
Headers show

Commit Message

Mitsyanko Igor March 5, 2012, 8:30 a.m.
VMSTATE_UINTTL* macros should be used only in files compiled with knowledge of
virtual address size of specific CPU. Currently this is achieved by protecting
VMSTATE_UINTTL* definitions with "#ifndef NEED_CPU_H" in hw/hw.h, but it would
be more appropriate to move these macros to cpu-defs.h header.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
 cpu-defs.h |   13 +++++++++++++
 hw/hw.h    |   19 -------------------
 2 files changed, 13 insertions(+), 19 deletions(-)


diff --git a/cpu-defs.h b/cpu-defs.h
index 4527cbf..10516e9 100644
--- a/cpu-defs.h
+++ b/cpu-defs.h
@@ -30,6 +30,8 @@ 
 #include "osdep.h"
 #include "qemu-queue.h"
 #include "targphys.h"
+#include "ioport.h"
+#include "vmstate.h"
 #error TARGET_LONG_BITS must be defined before including this header
@@ -50,12 +52,20 @@  typedef uint32_t target_ulong __attribute__((aligned(TARGET_LONG_ALIGNMENT)));
 #define TARGET_FMT_lx "%08x"
 #define TARGET_FMT_ld "%d"
 #define TARGET_FMT_lu "%u"
+#define VMSTATE_UINTTL_V(_f, _s, _v)                                  \
+    VMSTATE_UINT32_V(_f, _s, _v)
+#define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v)                        \
+    VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v)
 #elif TARGET_LONG_SIZE == 8
 typedef int64_t target_long __attribute__((aligned(TARGET_LONG_ALIGNMENT)));
 typedef uint64_t target_ulong __attribute__((aligned(TARGET_LONG_ALIGNMENT)));
 #define TARGET_FMT_lx "%016" PRIx64
 #define TARGET_FMT_ld "%" PRId64
 #define TARGET_FMT_lu "%" PRIu64
+#define VMSTATE_UINTTL_V(_f, _s, _v)                                  \
+    VMSTATE_UINT64_V(_f, _s, _v)
+#define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v)                        \
+    VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v)
 #error TARGET_LONG_SIZE undefined
@@ -68,6 +78,9 @@  typedef uint64_t target_ulong __attribute__((aligned(TARGET_LONG_ALIGNMENT)));
 #define TB_JMP_CACHE_BITS 12
+#define VMSTATE_UINTTL(_f, _s)           VMSTATE_UINTTL_V(_f, _s, 0)
+#define VMSTATE_UINTTL_ARRAY(_f, _s, _n) VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, 0)
 /* Only the bottom TB_JMP_PAGE_BITS of the jump cache hash bits vary for
    addresses on the same page.  The top bits are the same.  This allows
    TLB invalidation to quickly clear a subset of the hash table.  */
diff --git a/hw/hw.h b/hw/hw.h
index e5cb9bf..fb66156 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -46,23 +46,4 @@  typedef int QEMUBootSetHandler(void *opaque, const char *boot_devices);
 void qemu_register_boot_set(QEMUBootSetHandler *func, void *opaque);
 int qemu_boot_set(const char *boot_devices);
-#ifdef NEED_CPU_H
-#define VMSTATE_UINTTL_V(_f, _s, _v)                                  \
-    VMSTATE_UINT64_V(_f, _s, _v)
-#define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v)                        \
-    VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v)
-#define VMSTATE_UINTTL_V(_f, _s, _v)                                  \
-    VMSTATE_UINT32_V(_f, _s, _v)
-#define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v)                        \
-    VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v)
-#define VMSTATE_UINTTL(_f, _s)                                        \
-    VMSTATE_UINTTL_V(_f, _s, 0)
-#define VMSTATE_UINTTL_ARRAY(_f, _s, _n)                              \
-    VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, 0)