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"
|
|
|
|
#include "irq.h"
|
|
|
|
|
|
|
|
/* VM Load/Save */
|
|
|
|
|
|
|
|
QEMUFile *qemu_fopen(const char *filename, const char *mode);
|
|
|
|
void qemu_fflush(QEMUFile *f);
|
|
|
|
void qemu_fclose(QEMUFile *f);
|
|
|
|
void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size);
|
|
|
|
void qemu_put_byte(QEMUFile *f, int v);
|
|
|
|
void qemu_put_be16(QEMUFile *f, unsigned int v);
|
|
|
|
void qemu_put_be32(QEMUFile *f, unsigned int v);
|
|
|
|
void qemu_put_be64(QEMUFile *f, uint64_t v);
|
|
|
|
int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size);
|
|
|
|
int qemu_get_byte(QEMUFile *f);
|
|
|
|
unsigned int qemu_get_be16(QEMUFile *f);
|
|
|
|
unsigned int qemu_get_be32(QEMUFile *f);
|
|
|
|
uint64_t qemu_get_be64(QEMUFile *f);
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
#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
|
|
|
|
#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
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int64_t qemu_ftell(QEMUFile *f);
|
|
|
|
int64_t qemu_fseek(QEMUFile *f, int64_t pos, int whence);
|
|
|
|
|
|
|
|
typedef void SaveStateHandler(QEMUFile *f, void *opaque);
|
|
|
|
typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
|
|
|
|
|
|
|
|
int register_savevm(const char *idstr,
|
|
|
|
int instance_id,
|
|
|
|
int version_id,
|
|
|
|
SaveStateHandler *save_state,
|
|
|
|
LoadStateHandler *load_state,
|
|
|
|
void *opaque);
|
|
|
|
|
|
|
|
typedef void QEMUResetHandler(void *opaque);
|
|
|
|
|
|
|
|
void qemu_register_reset(QEMUResetHandler *func, void *opaque);
|
|
|
|
|
2008-05-05 00:11:34 +04:00
|
|
|
/* handler to set the boot_device for a specific type of QEMUMachine */
|
|
|
|
/* return 0 if success */
|
2008-06-20 20:25:06 +04:00
|
|
|
typedef int QEMUBootSetHandler(void *opaque, const char *boot_device);
|
|
|
|
void qemu_register_boot_set(QEMUBootSetHandler *func, void *opaque);
|
2008-05-05 00:11:34 +04:00
|
|
|
|
2007-11-17 20:14:51 +03:00
|
|
|
/* These should really be in isa.h, but are here to make pc.h happy. */
|
|
|
|
typedef void (IOPortWriteFunc)(void *opaque, uint32_t address, uint32_t data);
|
|
|
|
typedef uint32_t (IOPortReadFunc)(void *opaque, uint32_t address);
|
|
|
|
|
|
|
|
#endif
|