2007-11-17 20:14:51 +03:00
|
|
|
/* Declarations for use by hardware emulation. */
|
|
|
|
#ifndef QEMU_HW_H
|
|
|
|
#define QEMU_HW_H
|
|
|
|
|
|
|
|
#include "qemu-common.h"
|
2009-05-19 19:17:58 +04:00
|
|
|
|
|
|
|
#if defined(TARGET_PHYS_ADDR_BITS) && !defined(NEED_CPU_H)
|
|
|
|
#include "cpu-common.h"
|
|
|
|
#endif
|
|
|
|
|
2009-07-02 14:32:06 +04:00
|
|
|
#include "ioport.h"
|
2007-11-17 20:14:51 +03:00
|
|
|
#include "irq.h"
|
|
|
|
|
|
|
|
/* VM Load/Save */
|
|
|
|
|
2008-09-29 20:25:16 +04:00
|
|
|
/* This function writes a chunk of data to a file at the given position.
|
|
|
|
* The pos argument can be ignored if the file is only being used for
|
|
|
|
* streaming. The handler should try to write all of the data it can.
|
|
|
|
*/
|
2008-10-13 07:07:56 +04:00
|
|
|
typedef int (QEMUFilePutBufferFunc)(void *opaque, const uint8_t *buf,
|
|
|
|
int64_t pos, int size);
|
2008-09-29 20:25:16 +04:00
|
|
|
|
|
|
|
/* Read a chunk of data from a file at the given position. The pos argument
|
|
|
|
* can be ignored if the file is only be used for streaming. The number of
|
|
|
|
* bytes actually read should be returned.
|
|
|
|
*/
|
|
|
|
typedef int (QEMUFileGetBufferFunc)(void *opaque, uint8_t *buf,
|
|
|
|
int64_t pos, int size);
|
|
|
|
|
|
|
|
/* Close a file and return an error code */
|
|
|
|
typedef int (QEMUFileCloseFunc)(void *opaque);
|
|
|
|
|
|
|
|
/* Called to determine if the file has exceeded it's bandwidth allocation. The
|
|
|
|
* bandwidth capping is a soft limit, not a hard limit.
|
|
|
|
*/
|
|
|
|
typedef int (QEMUFileRateLimit)(void *opaque);
|
|
|
|
|
2009-05-21 02:26:57 +04:00
|
|
|
/* Called to change the current bandwidth allocation. This function must return
|
|
|
|
* the new actual bandwidth. It should be new_rate if everything goes ok, and
|
|
|
|
* the old rate otherwise
|
|
|
|
*/
|
2010-11-23 20:05:54 +03:00
|
|
|
typedef int64_t (QEMUFileSetRateLimit)(void *opaque, int64_t new_rate);
|
|
|
|
typedef int64_t (QEMUFileGetRateLimit)(void *opaque);
|
2009-05-21 02:26:57 +04:00
|
|
|
|
2008-09-29 20:25:16 +04:00
|
|
|
QEMUFile *qemu_fopen_ops(void *opaque, QEMUFilePutBufferFunc *put_buffer,
|
|
|
|
QEMUFileGetBufferFunc *get_buffer,
|
|
|
|
QEMUFileCloseFunc *close,
|
2009-05-21 02:26:57 +04:00
|
|
|
QEMUFileRateLimit *rate_limit,
|
2009-11-02 16:40:58 +03:00
|
|
|
QEMUFileSetRateLimit *set_rate_limit,
|
|
|
|
QEMUFileGetRateLimit *get_rate_limit);
|
2007-11-17 20:14:51 +03:00
|
|
|
QEMUFile *qemu_fopen(const char *filename, const char *mode);
|
2009-08-18 17:56:25 +04:00
|
|
|
QEMUFile *qemu_fdopen(int fd, const char *mode);
|
2008-10-25 01:55:17 +04:00
|
|
|
QEMUFile *qemu_fopen_socket(int fd);
|
2008-11-11 19:46:33 +03:00
|
|
|
QEMUFile *qemu_popen(FILE *popen_file, const char *mode);
|
|
|
|
QEMUFile *qemu_popen_cmd(const char *command, const char *mode);
|
2009-08-12 16:17:35 +04:00
|
|
|
int qemu_stdio_fd(QEMUFile *f);
|
2007-11-17 20:14:51 +03:00
|
|
|
void qemu_fflush(QEMUFile *f);
|
2008-09-29 20:25:16 +04:00
|
|
|
int qemu_fclose(QEMUFile *f);
|
2008-09-26 00:24:19 +04:00
|
|
|
void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size);
|
|
|
|
void qemu_put_byte(QEMUFile *f, int v);
|
2008-10-02 23:14:17 +04:00
|
|
|
|
|
|
|
static inline void qemu_put_ubyte(QEMUFile *f, unsigned int v)
|
|
|
|
{
|
|
|
|
qemu_put_byte(f, (int)v);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define qemu_put_sbyte qemu_put_byte
|
|
|
|
|
2008-09-26 00:24:19 +04:00
|
|
|
void qemu_put_be16(QEMUFile *f, unsigned int v);
|
|
|
|
void qemu_put_be32(QEMUFile *f, unsigned int v);
|
2007-11-17 20:14:51 +03:00
|
|
|
void qemu_put_be64(QEMUFile *f, uint64_t v);
|
2008-09-26 00:24:19 +04:00
|
|
|
int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size);
|
|
|
|
int qemu_get_byte(QEMUFile *f);
|
2008-10-02 23:14:17 +04:00
|
|
|
|
|
|
|
static inline unsigned int qemu_get_ubyte(QEMUFile *f)
|
|
|
|
{
|
|
|
|
return (unsigned int)qemu_get_byte(f);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define qemu_get_sbyte qemu_get_byte
|
|
|
|
|
2008-09-26 00:24:19 +04:00
|
|
|
unsigned int qemu_get_be16(QEMUFile *f);
|
|
|
|
unsigned int qemu_get_be32(QEMUFile *f);
|
2007-11-17 20:14:51 +03:00
|
|
|
uint64_t qemu_get_be64(QEMUFile *f);
|
2008-09-29 20:25:16 +04:00
|
|
|
int qemu_file_rate_limit(QEMUFile *f);
|
2010-11-23 20:05:54 +03:00
|
|
|
int64_t qemu_file_set_rate_limit(QEMUFile *f, int64_t new_rate);
|
|
|
|
int64_t qemu_file_get_rate_limit(QEMUFile *f);
|
2008-10-13 07:07:56 +04:00
|
|
|
int qemu_file_has_error(QEMUFile *f);
|
2009-04-05 23:30:51 +04:00
|
|
|
void qemu_file_set_error(QEMUFile *f);
|
2008-09-29 20:25:16 +04:00
|
|
|
|
|
|
|
/* Try to send any outstanding data. This function is useful when output is
|
|
|
|
* halted due to rate limiting or EAGAIN errors occur as it can be used to
|
|
|
|
* resume output. */
|
|
|
|
void qemu_file_put_notify(QEMUFile *f);
|
2007-11-17 20:14:51 +03:00
|
|
|
|
|
|
|
static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv)
|
|
|
|
{
|
|
|
|
qemu_put_be64(f, *pv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qemu_put_be32s(QEMUFile *f, const uint32_t *pv)
|
|
|
|
{
|
|
|
|
qemu_put_be32(f, *pv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qemu_put_be16s(QEMUFile *f, const uint16_t *pv)
|
|
|
|
{
|
|
|
|
qemu_put_be16(f, *pv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qemu_put_8s(QEMUFile *f, const uint8_t *pv)
|
|
|
|
{
|
|
|
|
qemu_put_byte(f, *pv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qemu_get_be64s(QEMUFile *f, uint64_t *pv)
|
|
|
|
{
|
|
|
|
*pv = qemu_get_be64(f);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qemu_get_be32s(QEMUFile *f, uint32_t *pv)
|
|
|
|
{
|
|
|
|
*pv = qemu_get_be32(f);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qemu_get_be16s(QEMUFile *f, uint16_t *pv)
|
|
|
|
{
|
|
|
|
*pv = qemu_get_be16(f);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qemu_get_8s(QEMUFile *f, uint8_t *pv)
|
|
|
|
{
|
|
|
|
*pv = qemu_get_byte(f);
|
|
|
|
}
|
|
|
|
|
2008-10-02 23:14:17 +04:00
|
|
|
// Signed versions for type safety
|
|
|
|
static inline void qemu_put_sbuffer(QEMUFile *f, const int8_t *buf, int size)
|
|
|
|
{
|
|
|
|
qemu_put_buffer(f, (const uint8_t *)buf, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qemu_put_sbe16(QEMUFile *f, int v)
|
|
|
|
{
|
|
|
|
qemu_put_be16(f, (unsigned int)v);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qemu_put_sbe32(QEMUFile *f, int v)
|
|
|
|
{
|
|
|
|
qemu_put_be32(f, (unsigned int)v);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qemu_put_sbe64(QEMUFile *f, int64_t v)
|
|
|
|
{
|
|
|
|
qemu_put_be64(f, (uint64_t)v);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline size_t qemu_get_sbuffer(QEMUFile *f, int8_t *buf, int size)
|
|
|
|
{
|
|
|
|
return qemu_get_buffer(f, (uint8_t *)buf, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int qemu_get_sbe16(QEMUFile *f)
|
|
|
|
{
|
|
|
|
return (int)qemu_get_be16(f);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int qemu_get_sbe32(QEMUFile *f)
|
|
|
|
{
|
|
|
|
return (int)qemu_get_be32(f);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int64_t qemu_get_sbe64(QEMUFile *f)
|
|
|
|
{
|
|
|
|
return (int64_t)qemu_get_be64(f);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qemu_put_s8s(QEMUFile *f, const int8_t *pv)
|
|
|
|
{
|
|
|
|
qemu_put_8s(f, (const uint8_t *)pv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qemu_put_sbe16s(QEMUFile *f, const int16_t *pv)
|
|
|
|
{
|
|
|
|
qemu_put_be16s(f, (const uint16_t *)pv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qemu_put_sbe32s(QEMUFile *f, const int32_t *pv)
|
|
|
|
{
|
|
|
|
qemu_put_be32s(f, (const uint32_t *)pv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qemu_put_sbe64s(QEMUFile *f, const int64_t *pv)
|
|
|
|
{
|
|
|
|
qemu_put_be64s(f, (const uint64_t *)pv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qemu_get_s8s(QEMUFile *f, int8_t *pv)
|
|
|
|
{
|
|
|
|
qemu_get_8s(f, (uint8_t *)pv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qemu_get_sbe16s(QEMUFile *f, int16_t *pv)
|
|
|
|
{
|
|
|
|
qemu_get_be16s(f, (uint16_t *)pv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qemu_get_sbe32s(QEMUFile *f, int32_t *pv)
|
|
|
|
{
|
|
|
|
qemu_get_be32s(f, (uint32_t *)pv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qemu_get_sbe64s(QEMUFile *f, int64_t *pv)
|
|
|
|
{
|
|
|
|
qemu_get_be64s(f, (uint64_t *)pv);
|
|
|
|
}
|
|
|
|
|
2007-11-17 20:14:51 +03:00
|
|
|
#ifdef NEED_CPU_H
|
|
|
|
#if TARGET_LONG_BITS == 64
|
|
|
|
#define qemu_put_betl qemu_put_be64
|
|
|
|
#define qemu_get_betl qemu_get_be64
|
|
|
|
#define qemu_put_betls qemu_put_be64s
|
|
|
|
#define qemu_get_betls qemu_get_be64s
|
2008-10-02 23:14:17 +04:00
|
|
|
#define qemu_put_sbetl qemu_put_sbe64
|
|
|
|
#define qemu_get_sbetl qemu_get_sbe64
|
|
|
|
#define qemu_put_sbetls qemu_put_sbe64s
|
|
|
|
#define qemu_get_sbetls qemu_get_sbe64s
|
2007-11-17 20:14:51 +03:00
|
|
|
#else
|
|
|
|
#define qemu_put_betl qemu_put_be32
|
|
|
|
#define qemu_get_betl qemu_get_be32
|
|
|
|
#define qemu_put_betls qemu_put_be32s
|
|
|
|
#define qemu_get_betls qemu_get_be32s
|
2008-10-02 23:14:17 +04:00
|
|
|
#define qemu_put_sbetl qemu_put_sbe32
|
|
|
|
#define qemu_get_sbetl qemu_get_sbe32
|
|
|
|
#define qemu_put_sbetls qemu_put_sbe32s
|
|
|
|
#define qemu_get_sbetls qemu_get_sbe32s
|
2007-11-17 20:14:51 +03:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int64_t qemu_ftell(QEMUFile *f);
|
|
|
|
int64_t qemu_fseek(QEMUFile *f, int64_t pos, int whence);
|
|
|
|
|
2009-11-02 16:40:58 +03:00
|
|
|
typedef void SaveSetParamsHandler(int blk_enable, int shared, void * opaque);
|
2007-11-17 20:14:51 +03:00
|
|
|
typedef void SaveStateHandler(QEMUFile *f, void *opaque);
|
2009-11-30 20:21:21 +03:00
|
|
|
typedef int SaveLiveStateHandler(Monitor *mon, QEMUFile *f, int stage,
|
|
|
|
void *opaque);
|
2007-11-17 20:14:51 +03:00
|
|
|
typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
|
|
|
|
|
2010-06-25 21:09:07 +04:00
|
|
|
int register_savevm(DeviceState *dev,
|
|
|
|
const char *idstr,
|
2007-11-17 20:14:51 +03:00
|
|
|
int instance_id,
|
|
|
|
int version_id,
|
|
|
|
SaveStateHandler *save_state,
|
|
|
|
LoadStateHandler *load_state,
|
|
|
|
void *opaque);
|
|
|
|
|
2010-06-25 21:09:07 +04:00
|
|
|
int register_savevm_live(DeviceState *dev,
|
|
|
|
const char *idstr,
|
2008-10-06 18:53:52 +04:00
|
|
|
int instance_id,
|
|
|
|
int version_id,
|
2009-11-02 16:40:58 +03:00
|
|
|
SaveSetParamsHandler *set_params,
|
|
|
|
SaveLiveStateHandler *save_live_state,
|
2008-10-06 18:53:52 +04:00
|
|
|
SaveStateHandler *save_state,
|
|
|
|
LoadStateHandler *load_state,
|
|
|
|
void *opaque);
|
|
|
|
|
2010-06-25 21:09:07 +04:00
|
|
|
void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque);
|
2010-07-27 04:11:00 +04:00
|
|
|
void register_device_unmigratable(DeviceState *dev, const char *idstr,
|
|
|
|
void *opaque);
|
2009-04-17 21:10:59 +04:00
|
|
|
|
2007-11-17 20:14:51 +03:00
|
|
|
typedef void QEMUResetHandler(void *opaque);
|
|
|
|
|
2009-06-27 11:25:07 +04:00
|
|
|
void qemu_register_reset(QEMUResetHandler *func, void *opaque);
|
2009-07-02 02:19:02 +04:00
|
|
|
void qemu_unregister_reset(QEMUResetHandler *func, void *opaque);
|
2007-11-17 20:14:51 +03:00
|
|
|
|
2009-07-02 02:19:02 +04:00
|
|
|
/* handler to set the boot_device order for a specific type of QEMUMachine */
|
2008-05-05 00:11:34 +04:00
|
|
|
/* return 0 if success */
|
2009-07-02 02:19:02 +04:00
|
|
|
typedef int QEMUBootSetHandler(void *opaque, const char *boot_devices);
|
2008-06-20 20:25:06 +04:00
|
|
|
void qemu_register_boot_set(QEMUBootSetHandler *func, void *opaque);
|
2009-07-02 02:19:02 +04:00
|
|
|
int qemu_boot_set(const char *boot_devices);
|
2008-05-05 00:11:34 +04:00
|
|
|
|
2009-08-20 21:42:25 +04:00
|
|
|
typedef struct VMStateInfo VMStateInfo;
|
|
|
|
typedef struct VMStateDescription VMStateDescription;
|
|
|
|
|
|
|
|
struct VMStateInfo {
|
|
|
|
const char *name;
|
|
|
|
int (*get)(QEMUFile *f, void *pv, size_t size);
|
2009-09-30 00:48:20 +04:00
|
|
|
void (*put)(QEMUFile *f, void *pv, size_t size);
|
2009-08-20 21:42:25 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum VMStateFlags {
|
2009-10-16 13:29:03 +04:00
|
|
|
VMS_SINGLE = 0x001,
|
|
|
|
VMS_POINTER = 0x002,
|
|
|
|
VMS_ARRAY = 0x004,
|
|
|
|
VMS_STRUCT = 0x008,
|
2009-10-16 13:35:18 +04:00
|
|
|
VMS_VARRAY_INT32 = 0x010, /* Array with size in int32_t field*/
|
2009-10-16 13:29:03 +04:00
|
|
|
VMS_BUFFER = 0x020, /* static sized buffer */
|
2009-09-30 00:48:41 +04:00
|
|
|
VMS_ARRAY_OF_POINTER = 0x040,
|
2009-10-16 13:35:18 +04:00
|
|
|
VMS_VARRAY_UINT16 = 0x080, /* Array with size in uint16_t field */
|
2009-12-02 14:36:38 +03:00
|
|
|
VMS_VBUFFER = 0x100, /* Buffer with size in int32_t field */
|
2009-12-02 14:36:43 +03:00
|
|
|
VMS_MULTIPLY = 0x200, /* multiply "size" field by field_size */
|
2009-08-20 21:42:25 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
const char *name;
|
|
|
|
size_t offset;
|
|
|
|
size_t size;
|
2009-12-02 14:36:38 +03:00
|
|
|
size_t start;
|
2009-08-20 21:42:27 +04:00
|
|
|
int num;
|
2009-08-20 21:42:33 +04:00
|
|
|
size_t num_offset;
|
2009-12-02 14:36:38 +03:00
|
|
|
size_t size_offset;
|
2009-08-20 21:42:25 +04:00
|
|
|
const VMStateInfo *info;
|
|
|
|
enum VMStateFlags flags;
|
2009-08-20 21:42:29 +04:00
|
|
|
const VMStateDescription *vmsd;
|
2009-08-20 21:42:25 +04:00
|
|
|
int version_id;
|
2009-09-30 00:49:07 +04:00
|
|
|
bool (*field_exists)(void *opaque, int version_id);
|
2009-08-20 21:42:25 +04:00
|
|
|
} VMStateField;
|
|
|
|
|
2010-07-26 23:38:43 +04:00
|
|
|
typedef struct VMStateSubsection {
|
|
|
|
const VMStateDescription *vmsd;
|
|
|
|
bool (*needed)(void *opaque);
|
|
|
|
} VMStateSubsection;
|
|
|
|
|
2009-08-20 21:42:25 +04:00
|
|
|
struct VMStateDescription {
|
|
|
|
const char *name;
|
|
|
|
int version_id;
|
|
|
|
int minimum_version_id;
|
|
|
|
int minimum_version_id_old;
|
|
|
|
LoadStateHandler *load_state_old;
|
2009-09-10 05:04:31 +04:00
|
|
|
int (*pre_load)(void *opaque);
|
2009-09-30 00:48:21 +04:00
|
|
|
int (*post_load)(void *opaque, int version_id);
|
2009-09-30 00:48:22 +04:00
|
|
|
void (*pre_save)(void *opaque);
|
2009-08-20 21:42:25 +04:00
|
|
|
VMStateField *fields;
|
2010-07-26 23:38:43 +04:00
|
|
|
const VMStateSubsection *subsections;
|
2009-08-20 21:42:25 +04:00
|
|
|
};
|
|
|
|
|
2010-11-01 17:51:54 +03:00
|
|
|
extern const VMStateInfo vmstate_info_bool;
|
|
|
|
|
2009-08-20 21:42:25 +04:00
|
|
|
extern const VMStateInfo vmstate_info_int8;
|
|
|
|
extern const VMStateInfo vmstate_info_int16;
|
|
|
|
extern const VMStateInfo vmstate_info_int32;
|
|
|
|
extern const VMStateInfo vmstate_info_int64;
|
|
|
|
|
2009-09-10 05:04:36 +04:00
|
|
|
extern const VMStateInfo vmstate_info_uint8_equal;
|
2009-10-16 01:16:13 +04:00
|
|
|
extern const VMStateInfo vmstate_info_uint16_equal;
|
2009-08-20 21:42:32 +04:00
|
|
|
extern const VMStateInfo vmstate_info_int32_equal;
|
2009-08-20 21:42:37 +04:00
|
|
|
extern const VMStateInfo vmstate_info_int32_le;
|
2009-08-20 21:42:32 +04:00
|
|
|
|
2009-08-20 21:42:25 +04:00
|
|
|
extern const VMStateInfo vmstate_info_uint8;
|
|
|
|
extern const VMStateInfo vmstate_info_uint16;
|
|
|
|
extern const VMStateInfo vmstate_info_uint32;
|
|
|
|
extern const VMStateInfo vmstate_info_uint64;
|
|
|
|
|
2009-08-20 21:42:26 +04:00
|
|
|
extern const VMStateInfo vmstate_info_timer;
|
2009-08-31 23:30:15 +04:00
|
|
|
extern const VMStateInfo vmstate_info_ptimer;
|
2009-08-20 21:42:35 +04:00
|
|
|
extern const VMStateInfo vmstate_info_buffer;
|
2009-10-19 17:46:28 +04:00
|
|
|
extern const VMStateInfo vmstate_info_unused_buffer;
|
2009-08-20 21:42:26 +04:00
|
|
|
|
2009-08-20 21:42:27 +04:00
|
|
|
#define type_check_array(t1,t2,n) ((t1(*)[n])0 - (t2*)0)
|
2009-08-20 21:42:33 +04:00
|
|
|
#define type_check_pointer(t1,t2) ((t1**)0 - (t2*)0)
|
2009-08-20 21:42:27 +04:00
|
|
|
|
2009-10-16 14:34:01 +04:00
|
|
|
#define vmstate_offset_value(_state, _field, _type) \
|
|
|
|
(offsetof(_state, _field) + \
|
|
|
|
type_check(_type, typeof_field(_state, _field)))
|
|
|
|
|
2009-10-16 14:35:27 +04:00
|
|
|
#define vmstate_offset_pointer(_state, _field, _type) \
|
|
|
|
(offsetof(_state, _field) + \
|
|
|
|
type_check_pointer(_type, typeof_field(_state, _field)))
|
|
|
|
|
2009-10-16 14:41:15 +04:00
|
|
|
#define vmstate_offset_array(_state, _field, _type, _num) \
|
|
|
|
(offsetof(_state, _field) + \
|
|
|
|
type_check_array(_type, typeof_field(_state, _field), _num))
|
|
|
|
|
2009-10-19 22:00:36 +04:00
|
|
|
#define vmstate_offset_sub_array(_state, _field, _type, _start) \
|
|
|
|
(offsetof(_state, _field[_start]))
|
|
|
|
|
2009-10-16 14:53:07 +04:00
|
|
|
#define vmstate_offset_buffer(_state, _field) \
|
|
|
|
vmstate_offset_array(_state, _field, uint8_t, \
|
|
|
|
sizeof(typeof_field(_state, _field)))
|
|
|
|
|
2009-10-16 17:26:53 +04:00
|
|
|
#define VMSTATE_SINGLE_TEST(_field, _state, _test, _version, _info, _type) { \
|
2009-09-30 00:49:07 +04:00
|
|
|
.name = (stringify(_field)), \
|
2009-10-16 17:26:53 +04:00
|
|
|
.version_id = (_version), \
|
2009-09-30 00:49:07 +04:00
|
|
|
.field_exists = (_test), \
|
|
|
|
.size = sizeof(_type), \
|
|
|
|
.info = &(_info), \
|
|
|
|
.flags = VMS_SINGLE, \
|
2009-10-16 14:34:01 +04:00
|
|
|
.offset = vmstate_offset_value(_state, _field, _type), \
|
2009-09-30 00:49:07 +04:00
|
|
|
}
|
|
|
|
|
2009-08-20 21:42:26 +04:00
|
|
|
#define VMSTATE_POINTER(_field, _state, _version, _info, _type) { \
|
|
|
|
.name = (stringify(_field)), \
|
|
|
|
.version_id = (_version), \
|
|
|
|
.info = &(_info), \
|
|
|
|
.size = sizeof(_type), \
|
|
|
|
.flags = VMS_SINGLE|VMS_POINTER, \
|
2009-10-16 14:34:01 +04:00
|
|
|
.offset = vmstate_offset_value(_state, _field, _type), \
|
2009-08-20 21:42:26 +04:00
|
|
|
}
|
|
|
|
|
2009-08-20 21:42:27 +04:00
|
|
|
#define VMSTATE_ARRAY(_field, _state, _num, _version, _info, _type) {\
|
|
|
|
.name = (stringify(_field)), \
|
|
|
|
.version_id = (_version), \
|
|
|
|
.num = (_num), \
|
|
|
|
.info = &(_info), \
|
|
|
|
.size = sizeof(_type), \
|
|
|
|
.flags = VMS_ARRAY, \
|
2009-10-16 14:41:15 +04:00
|
|
|
.offset = vmstate_offset_array(_state, _field, _type, _num), \
|
2009-08-20 21:42:27 +04:00
|
|
|
}
|
|
|
|
|
2009-09-30 00:49:07 +04:00
|
|
|
#define VMSTATE_ARRAY_TEST(_field, _state, _num, _test, _info, _type) {\
|
|
|
|
.name = (stringify(_field)), \
|
|
|
|
.field_exists = (_test), \
|
|
|
|
.num = (_num), \
|
|
|
|
.info = &(_info), \
|
|
|
|
.size = sizeof(_type), \
|
|
|
|
.flags = VMS_ARRAY, \
|
2009-10-16 14:41:15 +04:00
|
|
|
.offset = vmstate_offset_array(_state, _field, _type, _num),\
|
2009-09-30 00:49:07 +04:00
|
|
|
}
|
|
|
|
|
2009-10-19 22:00:36 +04:00
|
|
|
#define VMSTATE_SUB_ARRAY(_field, _state, _start, _num, _version, _info, _type) { \
|
|
|
|
.name = (stringify(_field)), \
|
|
|
|
.version_id = (_version), \
|
|
|
|
.num = (_num), \
|
|
|
|
.info = &(_info), \
|
|
|
|
.size = sizeof(_type), \
|
|
|
|
.flags = VMS_ARRAY, \
|
|
|
|
.offset = vmstate_offset_sub_array(_state, _field, _type, _start), \
|
|
|
|
}
|
|
|
|
|
2009-10-16 13:27:17 +04:00
|
|
|
#define VMSTATE_VARRAY_INT32(_field, _state, _field_num, _version, _info, _type) {\
|
2009-08-20 21:42:33 +04:00
|
|
|
.name = (stringify(_field)), \
|
|
|
|
.version_id = (_version), \
|
2009-10-16 14:34:01 +04:00
|
|
|
.num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
|
2009-08-20 21:42:33 +04:00
|
|
|
.info = &(_info), \
|
|
|
|
.size = sizeof(_type), \
|
2009-10-16 13:27:17 +04:00
|
|
|
.flags = VMS_VARRAY_INT32|VMS_POINTER, \
|
2009-10-16 14:35:27 +04:00
|
|
|
.offset = vmstate_offset_pointer(_state, _field, _type), \
|
2009-08-20 21:42:33 +04:00
|
|
|
}
|
|
|
|
|
2009-10-16 13:35:18 +04:00
|
|
|
#define VMSTATE_VARRAY_UINT16_UNSAFE(_field, _state, _field_num, _version, _info, _type) {\
|
|
|
|
.name = (stringify(_field)), \
|
|
|
|
.version_id = (_version), \
|
|
|
|
.num_offset = vmstate_offset_value(_state, _field_num, uint16_t),\
|
|
|
|
.info = &(_info), \
|
|
|
|
.size = sizeof(_type), \
|
|
|
|
.flags = VMS_VARRAY_UINT16, \
|
|
|
|
.offset = offsetof(_state, _field), \
|
|
|
|
}
|
|
|
|
|
2009-12-02 14:36:39 +03:00
|
|
|
#define VMSTATE_STRUCT_TEST(_field, _state, _test, _version, _vmsd, _type) { \
|
|
|
|
.name = (stringify(_field)), \
|
|
|
|
.version_id = (_version), \
|
|
|
|
.field_exists = (_test), \
|
|
|
|
.vmsd = &(_vmsd), \
|
|
|
|
.size = sizeof(_type), \
|
|
|
|
.flags = VMS_STRUCT, \
|
|
|
|
.offset = vmstate_offset_value(_state, _field, _type), \
|
2009-08-20 21:42:29 +04:00
|
|
|
}
|
|
|
|
|
2009-12-02 14:36:40 +03:00
|
|
|
#define VMSTATE_STRUCT_POINTER_TEST(_field, _state, _test, _vmsd, _type) { \
|
|
|
|
.name = (stringify(_field)), \
|
|
|
|
.field_exists = (_test), \
|
|
|
|
.vmsd = &(_vmsd), \
|
|
|
|
.size = sizeof(_type), \
|
|
|
|
.flags = VMS_STRUCT|VMS_POINTER, \
|
|
|
|
.offset = vmstate_offset_value(_state, _field, _type), \
|
2009-09-30 00:48:33 +04:00
|
|
|
}
|
|
|
|
|
2009-09-30 00:48:41 +04:00
|
|
|
#define VMSTATE_ARRAY_OF_POINTER(_field, _state, _num, _version, _info, _type) {\
|
|
|
|
.name = (stringify(_field)), \
|
|
|
|
.version_id = (_version), \
|
|
|
|
.num = (_num), \
|
|
|
|
.info = &(_info), \
|
|
|
|
.size = sizeof(_type), \
|
|
|
|
.flags = VMS_ARRAY|VMS_ARRAY_OF_POINTER, \
|
2009-10-16 14:41:15 +04:00
|
|
|
.offset = vmstate_offset_array(_state, _field, _type, _num), \
|
2009-09-30 00:48:41 +04:00
|
|
|
}
|
|
|
|
|
2009-08-20 21:42:30 +04:00
|
|
|
#define VMSTATE_STRUCT_ARRAY(_field, _state, _num, _version, _vmsd, _type) { \
|
|
|
|
.name = (stringify(_field)), \
|
|
|
|
.num = (_num), \
|
|
|
|
.version_id = (_version), \
|
|
|
|
.vmsd = &(_vmsd), \
|
|
|
|
.size = sizeof(_type), \
|
|
|
|
.flags = VMS_STRUCT|VMS_ARRAY, \
|
2009-10-16 14:41:15 +04:00
|
|
|
.offset = vmstate_offset_array(_state, _field, _type, _num), \
|
2009-08-20 21:42:30 +04:00
|
|
|
}
|
|
|
|
|
2010-06-13 16:15:43 +04:00
|
|
|
#define VMSTATE_STRUCT_VARRAY_UINT8(_field, _state, _field_num, _version, _vmsd, _type) { \
|
|
|
|
.name = (stringify(_field)), \
|
|
|
|
.num_offset = vmstate_offset_value(_state, _field_num, uint8_t), \
|
|
|
|
.version_id = (_version), \
|
|
|
|
.vmsd = &(_vmsd), \
|
|
|
|
.size = sizeof(_type), \
|
|
|
|
.flags = VMS_STRUCT|VMS_VARRAY_INT32, \
|
|
|
|
.offset = offsetof(_state, _field), \
|
|
|
|
}
|
|
|
|
|
2009-10-16 15:05:14 +04:00
|
|
|
#define VMSTATE_STATIC_BUFFER(_field, _state, _version, _test, _start, _size) { \
|
2009-10-07 19:59:31 +04:00
|
|
|
.name = (stringify(_field)), \
|
2009-10-16 15:05:14 +04:00
|
|
|
.version_id = (_version), \
|
2009-10-07 19:59:31 +04:00
|
|
|
.field_exists = (_test), \
|
2009-10-16 15:05:14 +04:00
|
|
|
.size = (_size - _start), \
|
2009-10-07 19:59:31 +04:00
|
|
|
.info = &vmstate_info_buffer, \
|
|
|
|
.flags = VMS_BUFFER, \
|
2009-10-16 15:05:14 +04:00
|
|
|
.offset = vmstate_offset_buffer(_state, _field) + _start, \
|
2009-09-10 05:04:47 +04:00
|
|
|
}
|
|
|
|
|
2009-12-02 14:36:43 +03:00
|
|
|
#define VMSTATE_BUFFER_MULTIPLY(_field, _state, _version, _test, _start, _field_size, _multiply) { \
|
|
|
|
.name = (stringify(_field)), \
|
|
|
|
.version_id = (_version), \
|
|
|
|
.field_exists = (_test), \
|
|
|
|
.size_offset = vmstate_offset_value(_state, _field_size, uint32_t),\
|
|
|
|
.size = (_multiply), \
|
|
|
|
.info = &vmstate_info_buffer, \
|
|
|
|
.flags = VMS_VBUFFER|VMS_MULTIPLY, \
|
|
|
|
.offset = offsetof(_state, _field), \
|
|
|
|
.start = (_start), \
|
|
|
|
}
|
|
|
|
|
2009-12-02 14:36:38 +03:00
|
|
|
#define VMSTATE_VBUFFER(_field, _state, _version, _test, _start, _field_size) { \
|
|
|
|
.name = (stringify(_field)), \
|
|
|
|
.version_id = (_version), \
|
|
|
|
.field_exists = (_test), \
|
|
|
|
.size_offset = vmstate_offset_value(_state, _field_size, int32_t),\
|
|
|
|
.info = &vmstate_info_buffer, \
|
|
|
|
.flags = VMS_VBUFFER|VMS_POINTER, \
|
|
|
|
.offset = offsetof(_state, _field), \
|
|
|
|
.start = (_start), \
|
|
|
|
}
|
|
|
|
|
2010-04-27 13:50:11 +04:00
|
|
|
#define VMSTATE_VBUFFER_UINT32(_field, _state, _version, _test, _start, _field_size) { \
|
|
|
|
.name = (stringify(_field)), \
|
|
|
|
.version_id = (_version), \
|
|
|
|
.field_exists = (_test), \
|
|
|
|
.size_offset = vmstate_offset_value(_state, _field_size, uint32_t),\
|
|
|
|
.info = &vmstate_info_buffer, \
|
|
|
|
.flags = VMS_VBUFFER|VMS_POINTER, \
|
|
|
|
.offset = offsetof(_state, _field), \
|
|
|
|
.start = (_start), \
|
|
|
|
}
|
|
|
|
|
2009-10-30 15:21:17 +03:00
|
|
|
#define VMSTATE_BUFFER_UNSAFE_INFO(_field, _state, _version, _info, _size) { \
|
2009-10-20 19:56:13 +04:00
|
|
|
.name = (stringify(_field)), \
|
|
|
|
.version_id = (_version), \
|
|
|
|
.size = (_size), \
|
2009-10-30 15:21:17 +03:00
|
|
|
.info = &(_info), \
|
2009-10-20 19:56:13 +04:00
|
|
|
.flags = VMS_BUFFER, \
|
|
|
|
.offset = offsetof(_state, _field), \
|
|
|
|
}
|
|
|
|
|
2009-10-19 17:46:28 +04:00
|
|
|
#define VMSTATE_UNUSED_BUFFER(_test, _version, _size) { \
|
|
|
|
.name = "unused", \
|
|
|
|
.field_exists = (_test), \
|
|
|
|
.version_id = (_version), \
|
|
|
|
.size = (_size), \
|
|
|
|
.info = &vmstate_info_unused_buffer, \
|
|
|
|
.flags = VMS_BUFFER, \
|
|
|
|
}
|
2009-08-20 21:42:39 +04:00
|
|
|
extern const VMStateDescription vmstate_pci_device;
|
|
|
|
|
|
|
|
#define VMSTATE_PCI_DEVICE(_field, _state) { \
|
|
|
|
.name = (stringify(_field)), \
|
|
|
|
.size = sizeof(PCIDevice), \
|
|
|
|
.vmsd = &vmstate_pci_device, \
|
|
|
|
.flags = VMS_STRUCT, \
|
2009-10-16 14:34:01 +04:00
|
|
|
.offset = vmstate_offset_value(_state, _field, PCIDevice), \
|
2009-08-20 21:42:39 +04:00
|
|
|
}
|
|
|
|
|
2009-10-30 15:21:18 +03:00
|
|
|
extern const VMStateDescription vmstate_pcie_device;
|
|
|
|
|
|
|
|
#define VMSTATE_PCIE_DEVICE(_field, _state) { \
|
|
|
|
.name = (stringify(_field)), \
|
|
|
|
.version_id = 2, \
|
|
|
|
.size = sizeof(PCIDevice), \
|
|
|
|
.vmsd = &vmstate_pcie_device, \
|
|
|
|
.flags = VMS_STRUCT, \
|
|
|
|
.offset = vmstate_offset_value(_state, _field, PCIDevice), \
|
|
|
|
}
|
|
|
|
|
2009-09-30 00:48:30 +04:00
|
|
|
extern const VMStateDescription vmstate_i2c_slave;
|
|
|
|
|
|
|
|
#define VMSTATE_I2C_SLAVE(_field, _state) { \
|
|
|
|
.name = (stringify(_field)), \
|
|
|
|
.size = sizeof(i2c_slave), \
|
|
|
|
.vmsd = &vmstate_i2c_slave, \
|
|
|
|
.flags = VMS_STRUCT, \
|
2009-10-16 14:34:01 +04:00
|
|
|
.offset = vmstate_offset_value(_state, _field, i2c_slave), \
|
2009-09-30 00:48:30 +04:00
|
|
|
}
|
|
|
|
|
2009-10-22 22:50:06 +04:00
|
|
|
#define vmstate_offset_macaddr(_state, _field) \
|
|
|
|
vmstate_offset_array(_state, _field.a, uint8_t, \
|
|
|
|
sizeof(typeof_field(_state, _field)))
|
|
|
|
|
|
|
|
#define VMSTATE_MACADDR(_field, _state) { \
|
|
|
|
.name = (stringify(_field)), \
|
|
|
|
.size = sizeof(MACAddr), \
|
2009-12-02 14:36:36 +03:00
|
|
|
.info = &vmstate_info_buffer, \
|
2009-10-22 22:50:06 +04:00
|
|
|
.flags = VMS_BUFFER, \
|
|
|
|
.offset = vmstate_offset_macaddr(_state, _field), \
|
|
|
|
}
|
|
|
|
|
2009-08-20 21:42:25 +04:00
|
|
|
/* _f : field name
|
2009-08-20 21:42:33 +04:00
|
|
|
_f_n : num of elements field_name
|
2009-08-20 21:42:27 +04:00
|
|
|
_n : num of elements
|
2009-08-20 21:42:25 +04:00
|
|
|
_s : struct state name
|
|
|
|
_v : version
|
|
|
|
*/
|
|
|
|
|
2009-10-16 17:26:53 +04:00
|
|
|
#define VMSTATE_SINGLE(_field, _state, _version, _info, _type) \
|
|
|
|
VMSTATE_SINGLE_TEST(_field, _state, NULL, _version, _info, _type)
|
|
|
|
|
2009-12-02 14:36:39 +03:00
|
|
|
#define VMSTATE_STRUCT(_field, _state, _version, _vmsd, _type) \
|
|
|
|
VMSTATE_STRUCT_TEST(_field, _state, NULL, _version, _vmsd, _type)
|
|
|
|
|
2009-12-02 14:36:40 +03:00
|
|
|
#define VMSTATE_STRUCT_POINTER(_field, _state, _vmsd, _type) \
|
|
|
|
VMSTATE_STRUCT_POINTER_TEST(_field, _state, NULL, _vmsd, _type)
|
|
|
|
|
2010-11-01 17:51:54 +03:00
|
|
|
#define VMSTATE_BOOL_V(_f, _s, _v) \
|
|
|
|
VMSTATE_SINGLE(_f, _s, _v, vmstate_info_bool, bool)
|
|
|
|
|
2009-08-20 21:42:25 +04:00
|
|
|
#define VMSTATE_INT8_V(_f, _s, _v) \
|
|
|
|
VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int8, int8_t)
|
|
|
|
#define VMSTATE_INT16_V(_f, _s, _v) \
|
|
|
|
VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int16, int16_t)
|
|
|
|
#define VMSTATE_INT32_V(_f, _s, _v) \
|
|
|
|
VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int32, int32_t)
|
|
|
|
#define VMSTATE_INT64_V(_f, _s, _v) \
|
|
|
|
VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int64, int64_t)
|
|
|
|
|
|
|
|
#define VMSTATE_UINT8_V(_f, _s, _v) \
|
|
|
|
VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint8, uint8_t)
|
|
|
|
#define VMSTATE_UINT16_V(_f, _s, _v) \
|
|
|
|
VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint16, uint16_t)
|
|
|
|
#define VMSTATE_UINT32_V(_f, _s, _v) \
|
|
|
|
VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint32, uint32_t)
|
|
|
|
#define VMSTATE_UINT64_V(_f, _s, _v) \
|
|
|
|
VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint64, uint64_t)
|
|
|
|
|
2010-11-01 17:51:54 +03:00
|
|
|
#define VMSTATE_BOOL(_f, _s) \
|
|
|
|
VMSTATE_BOOL_V(_f, _s, 0)
|
|
|
|
|
2009-08-20 21:42:25 +04:00
|
|
|
#define VMSTATE_INT8(_f, _s) \
|
|
|
|
VMSTATE_INT8_V(_f, _s, 0)
|
|
|
|
#define VMSTATE_INT16(_f, _s) \
|
|
|
|
VMSTATE_INT16_V(_f, _s, 0)
|
|
|
|
#define VMSTATE_INT32(_f, _s) \
|
|
|
|
VMSTATE_INT32_V(_f, _s, 0)
|
|
|
|
#define VMSTATE_INT64(_f, _s) \
|
|
|
|
VMSTATE_INT64_V(_f, _s, 0)
|
|
|
|
|
|
|
|
#define VMSTATE_UINT8(_f, _s) \
|
|
|
|
VMSTATE_UINT8_V(_f, _s, 0)
|
|
|
|
#define VMSTATE_UINT16(_f, _s) \
|
|
|
|
VMSTATE_UINT16_V(_f, _s, 0)
|
|
|
|
#define VMSTATE_UINT32(_f, _s) \
|
|
|
|
VMSTATE_UINT32_V(_f, _s, 0)
|
|
|
|
#define VMSTATE_UINT64(_f, _s) \
|
|
|
|
VMSTATE_UINT64_V(_f, _s, 0)
|
|
|
|
|
2009-09-10 05:04:36 +04:00
|
|
|
#define VMSTATE_UINT8_EQUAL(_f, _s) \
|
|
|
|
VMSTATE_SINGLE(_f, _s, 0, vmstate_info_uint8_equal, uint8_t)
|
|
|
|
|
2009-10-16 01:16:13 +04:00
|
|
|
#define VMSTATE_UINT16_EQUAL(_f, _s) \
|
|
|
|
VMSTATE_SINGLE(_f, _s, 0, vmstate_info_uint16_equal, uint16_t)
|
|
|
|
|
|
|
|
#define VMSTATE_UINT16_EQUAL_V(_f, _s, _v) \
|
|
|
|
VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint16_equal, uint16_t)
|
|
|
|
|
2009-08-20 21:42:32 +04:00
|
|
|
#define VMSTATE_INT32_EQUAL(_f, _s) \
|
|
|
|
VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_equal, int32_t)
|
|
|
|
|
2009-08-20 21:42:37 +04:00
|
|
|
#define VMSTATE_INT32_LE(_f, _s) \
|
|
|
|
VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_le, int32_t)
|
|
|
|
|
2009-12-02 14:36:41 +03:00
|
|
|
#define VMSTATE_UINT16_TEST(_f, _s, _t) \
|
|
|
|
VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint16, uint16_t)
|
|
|
|
|
2009-09-30 00:49:07 +04:00
|
|
|
#define VMSTATE_UINT32_TEST(_f, _s, _t) \
|
2009-10-16 17:26:53 +04:00
|
|
|
VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint32, uint32_t)
|
2009-09-30 00:49:07 +04:00
|
|
|
|
2009-08-20 21:42:26 +04:00
|
|
|
#define VMSTATE_TIMER_V(_f, _s, _v) \
|
|
|
|
VMSTATE_POINTER(_f, _s, _v, vmstate_info_timer, QEMUTimer *)
|
|
|
|
|
|
|
|
#define VMSTATE_TIMER(_f, _s) \
|
|
|
|
VMSTATE_TIMER_V(_f, _s, 0)
|
|
|
|
|
2009-09-30 00:48:41 +04:00
|
|
|
#define VMSTATE_TIMER_ARRAY(_f, _s, _n) \
|
|
|
|
VMSTATE_ARRAY_OF_POINTER(_f, _s, _n, 0, vmstate_info_timer, QEMUTimer *)
|
|
|
|
|
2009-08-31 23:30:15 +04:00
|
|
|
#define VMSTATE_PTIMER_V(_f, _s, _v) \
|
|
|
|
VMSTATE_POINTER(_f, _s, _v, vmstate_info_ptimer, ptimer_state *)
|
|
|
|
|
|
|
|
#define VMSTATE_PTIMER(_f, _s) \
|
|
|
|
VMSTATE_PTIMER_V(_f, _s, 0)
|
|
|
|
|
2010-11-01 17:51:54 +03:00
|
|
|
#define VMSTATE_BOOL_ARRAY_V(_f, _s, _n, _v) \
|
|
|
|
VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_bool, bool)
|
|
|
|
|
|
|
|
#define VMSTATE_BOOL_ARRAY(_f, _s, _n) \
|
|
|
|
VMSTATE_BOOL_ARRAY_V(_f, _s, _n, 0)
|
|
|
|
|
2009-09-10 05:04:38 +04:00
|
|
|
#define VMSTATE_UINT16_ARRAY_V(_f, _s, _n, _v) \
|
|
|
|
VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint16, uint16_t)
|
|
|
|
|
|
|
|
#define VMSTATE_UINT16_ARRAY(_f, _s, _n) \
|
|
|
|
VMSTATE_UINT16_ARRAY_V(_f, _s, _n, 0)
|
|
|
|
|
2009-09-30 00:48:29 +04:00
|
|
|
#define VMSTATE_UINT8_ARRAY_V(_f, _s, _n, _v) \
|
|
|
|
VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint8, uint8_t)
|
|
|
|
|
|
|
|
#define VMSTATE_UINT8_ARRAY(_f, _s, _n) \
|
|
|
|
VMSTATE_UINT8_ARRAY_V(_f, _s, _n, 0)
|
|
|
|
|
2009-08-20 21:42:27 +04:00
|
|
|
#define VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v) \
|
|
|
|
VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint32, uint32_t)
|
|
|
|
|
|
|
|
#define VMSTATE_UINT32_ARRAY(_f, _s, _n) \
|
|
|
|
VMSTATE_UINT32_ARRAY_V(_f, _s, _n, 0)
|
|
|
|
|
2009-09-10 05:04:42 +04:00
|
|
|
#define VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v) \
|
|
|
|
VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint64, uint64_t)
|
|
|
|
|
|
|
|
#define VMSTATE_UINT64_ARRAY(_f, _s, _n) \
|
|
|
|
VMSTATE_UINT64_ARRAY_V(_f, _s, _n, 0)
|
|
|
|
|
2009-09-30 00:48:36 +04:00
|
|
|
#define VMSTATE_INT16_ARRAY_V(_f, _s, _n, _v) \
|
|
|
|
VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int16, int16_t)
|
|
|
|
|
|
|
|
#define VMSTATE_INT16_ARRAY(_f, _s, _n) \
|
|
|
|
VMSTATE_INT16_ARRAY_V(_f, _s, _n, 0)
|
|
|
|
|
2009-08-20 21:42:27 +04:00
|
|
|
#define VMSTATE_INT32_ARRAY_V(_f, _s, _n, _v) \
|
|
|
|
VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int32, int32_t)
|
|
|
|
|
|
|
|
#define VMSTATE_INT32_ARRAY(_f, _s, _n) \
|
|
|
|
VMSTATE_INT32_ARRAY_V(_f, _s, _n, 0)
|
|
|
|
|
2009-10-19 22:00:36 +04:00
|
|
|
#define VMSTATE_UINT32_SUB_ARRAY(_f, _s, _start, _num) \
|
|
|
|
VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint32, uint32_t)
|
|
|
|
|
|
|
|
#define VMSTATE_UINT32_ARRAY(_f, _s, _n) \
|
|
|
|
VMSTATE_UINT32_ARRAY_V(_f, _s, _n, 0)
|
|
|
|
|
2009-08-20 21:42:35 +04:00
|
|
|
#define VMSTATE_BUFFER_V(_f, _s, _v) \
|
2009-10-16 15:05:14 +04:00
|
|
|
VMSTATE_STATIC_BUFFER(_f, _s, _v, NULL, 0, sizeof(typeof_field(_s, _f)))
|
2009-08-20 21:42:35 +04:00
|
|
|
|
|
|
|
#define VMSTATE_BUFFER(_f, _s) \
|
2009-10-16 15:05:14 +04:00
|
|
|
VMSTATE_BUFFER_V(_f, _s, 0)
|
|
|
|
|
|
|
|
#define VMSTATE_PARTIAL_BUFFER(_f, _s, _size) \
|
|
|
|
VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, 0, _size)
|
|
|
|
|
|
|
|
#define VMSTATE_BUFFER_START_MIDDLE(_f, _s, _start) \
|
|
|
|
VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, _start, sizeof(typeof_field(_s, _f)))
|
2009-08-20 21:42:35 +04:00
|
|
|
|
2009-12-02 14:36:38 +03:00
|
|
|
#define VMSTATE_PARTIAL_VBUFFER(_f, _s, _size) \
|
|
|
|
VMSTATE_VBUFFER(_f, _s, 0, NULL, 0, _size)
|
|
|
|
|
2010-04-27 13:50:11 +04:00
|
|
|
#define VMSTATE_PARTIAL_VBUFFER_UINT32(_f, _s, _size) \
|
|
|
|
VMSTATE_VBUFFER_UINT32(_f, _s, 0, NULL, 0, _size)
|
|
|
|
|
2009-12-02 14:36:38 +03:00
|
|
|
#define VMSTATE_SUB_VBUFFER(_f, _s, _start, _size) \
|
|
|
|
VMSTATE_VBUFFER(_f, _s, 0, NULL, _start, _size)
|
|
|
|
|
2009-10-16 15:05:14 +04:00
|
|
|
#define VMSTATE_BUFFER_TEST(_f, _s, _test) \
|
|
|
|
VMSTATE_STATIC_BUFFER(_f, _s, 0, _test, 0, sizeof(typeof_field(_s, _f)))
|
2009-10-07 19:59:31 +04:00
|
|
|
|
2009-10-30 15:21:17 +03:00
|
|
|
#define VMSTATE_BUFFER_UNSAFE(_field, _state, _version, _size) \
|
|
|
|
VMSTATE_BUFFER_UNSAFE_INFO(_field, _state, _version, vmstate_info_buffer, _size)
|
|
|
|
|
2009-10-19 17:46:28 +04:00
|
|
|
#define VMSTATE_UNUSED_V(_v, _size) \
|
|
|
|
VMSTATE_UNUSED_BUFFER(NULL, _v, _size)
|
|
|
|
|
|
|
|
#define VMSTATE_UNUSED(_size) \
|
|
|
|
VMSTATE_UNUSED_V(0, _size)
|
|
|
|
|
|
|
|
#define VMSTATE_UNUSED_TEST(_test, _size) \
|
|
|
|
VMSTATE_UNUSED_BUFFER(_test, 0, _size)
|
|
|
|
|
2009-09-30 00:49:00 +04:00
|
|
|
#ifdef NEED_CPU_H
|
|
|
|
#if TARGET_LONG_BITS == 64
|
|
|
|
#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)
|
|
|
|
#else
|
|
|
|
#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)
|
|
|
|
#endif
|
|
|
|
#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)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2009-08-20 21:42:25 +04:00
|
|
|
#define VMSTATE_END_OF_LIST() \
|
|
|
|
{}
|
|
|
|
|
|
|
|
extern int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
|
|
|
|
void *opaque, int version_id);
|
|
|
|
extern void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
|
2009-09-30 00:48:20 +04:00
|
|
|
void *opaque);
|
2010-06-25 21:09:07 +04:00
|
|
|
extern int vmstate_register(DeviceState *dev, int instance_id,
|
|
|
|
const VMStateDescription *vmsd, void *base);
|
|
|
|
extern int vmstate_register_with_alias_id(DeviceState *dev,
|
|
|
|
int instance_id,
|
2010-05-15 15:32:40 +04:00
|
|
|
const VMStateDescription *vmsd,
|
|
|
|
void *base, int alias_id,
|
|
|
|
int required_for_version);
|
2010-06-25 21:09:07 +04:00
|
|
|
void vmstate_unregister(DeviceState *dev, const VMStateDescription *vmsd,
|
|
|
|
void *opaque);
|
2007-11-17 20:14:51 +03:00
|
|
|
#endif
|