root / hw / hw.h @ 5228c2d3
History | View | Annotate | Download (2.6 kB)
1 |
/* Declarations for use by hardware emulation. */
|
---|---|
2 |
#ifndef QEMU_HW_H
|
3 |
#define QEMU_HW_H
|
4 |
|
5 |
#include "qemu-common.h" |
6 |
#include "irq.h" |
7 |
|
8 |
/* VM Load/Save */
|
9 |
|
10 |
QEMUFile *qemu_fopen(const char *filename, const char *mode); |
11 |
void qemu_fflush(QEMUFile *f);
|
12 |
void qemu_fclose(QEMUFile *f);
|
13 |
void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size); |
14 |
void qemu_put_byte(QEMUFile *f, int v); |
15 |
void qemu_put_be16(QEMUFile *f, unsigned int v); |
16 |
void qemu_put_be32(QEMUFile *f, unsigned int v); |
17 |
void qemu_put_be64(QEMUFile *f, uint64_t v);
|
18 |
int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size); |
19 |
int qemu_get_byte(QEMUFile *f);
|
20 |
unsigned int qemu_get_be16(QEMUFile *f); |
21 |
unsigned int qemu_get_be32(QEMUFile *f); |
22 |
uint64_t qemu_get_be64(QEMUFile *f); |
23 |
|
24 |
static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv) |
25 |
{ |
26 |
qemu_put_be64(f, *pv); |
27 |
} |
28 |
|
29 |
static inline void qemu_put_be32s(QEMUFile *f, const uint32_t *pv) |
30 |
{ |
31 |
qemu_put_be32(f, *pv); |
32 |
} |
33 |
|
34 |
static inline void qemu_put_be16s(QEMUFile *f, const uint16_t *pv) |
35 |
{ |
36 |
qemu_put_be16(f, *pv); |
37 |
} |
38 |
|
39 |
static inline void qemu_put_8s(QEMUFile *f, const uint8_t *pv) |
40 |
{ |
41 |
qemu_put_byte(f, *pv); |
42 |
} |
43 |
|
44 |
static inline void qemu_get_be64s(QEMUFile *f, uint64_t *pv) |
45 |
{ |
46 |
*pv = qemu_get_be64(f); |
47 |
} |
48 |
|
49 |
static inline void qemu_get_be32s(QEMUFile *f, uint32_t *pv) |
50 |
{ |
51 |
*pv = qemu_get_be32(f); |
52 |
} |
53 |
|
54 |
static inline void qemu_get_be16s(QEMUFile *f, uint16_t *pv) |
55 |
{ |
56 |
*pv = qemu_get_be16(f); |
57 |
} |
58 |
|
59 |
static inline void qemu_get_8s(QEMUFile *f, uint8_t *pv) |
60 |
{ |
61 |
*pv = qemu_get_byte(f); |
62 |
} |
63 |
|
64 |
#ifdef NEED_CPU_H
|
65 |
#if TARGET_LONG_BITS == 64 |
66 |
#define qemu_put_betl qemu_put_be64
|
67 |
#define qemu_get_betl qemu_get_be64
|
68 |
#define qemu_put_betls qemu_put_be64s
|
69 |
#define qemu_get_betls qemu_get_be64s
|
70 |
#else
|
71 |
#define qemu_put_betl qemu_put_be32
|
72 |
#define qemu_get_betl qemu_get_be32
|
73 |
#define qemu_put_betls qemu_put_be32s
|
74 |
#define qemu_get_betls qemu_get_be32s
|
75 |
#endif
|
76 |
#endif
|
77 |
|
78 |
int64_t qemu_ftell(QEMUFile *f); |
79 |
int64_t qemu_fseek(QEMUFile *f, int64_t pos, int whence);
|
80 |
|
81 |
typedef void SaveStateHandler(QEMUFile *f, void *opaque); |
82 |
typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id); |
83 |
|
84 |
int register_savevm(const char *idstr, |
85 |
int instance_id,
|
86 |
int version_id,
|
87 |
SaveStateHandler *save_state, |
88 |
LoadStateHandler *load_state, |
89 |
void *opaque);
|
90 |
|
91 |
typedef void QEMUResetHandler(void *opaque); |
92 |
|
93 |
void qemu_register_reset(QEMUResetHandler *func, void *opaque); |
94 |
|
95 |
/* These should really be in isa.h, but are here to make pc.h happy. */
|
96 |
typedef void (IOPortWriteFunc)(void *opaque, uint32_t address, uint32_t data); |
97 |
typedef uint32_t (IOPortReadFunc)(void *opaque, uint32_t address); |
98 |
|
99 |
#endif
|