~jderose/ubuntu/raring/qemu/vde-again

« back to all changes in this revision

Viewing changes to hw/hw.h

  • Committer: Bazaar Package Importer
  • Author(s): Aurelien Jarno, Aurelien Jarno
  • Date: 2009-03-07 06:20:34 UTC
  • mfrom: (1.1.9 upstream)
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: james.westby@ubuntu.com-20090307062034-i3pead4mw653v2el
Tags: 0.10.0-1
[ Aurelien Jarno ]
* New upstream release:
  - Fix fr-be keyboard mapping (closes: bug#514462).
  - Fix stat64 structure on ppc-linux-user (closes: bug#470231).
  - Add a chroot option (closes: bug#415996).
  - Add evdev support (closes: bug#513210).
  - Fix loop on symlinks in user mode (closes: bug#297572).
  - Bump depends on openbios-sparc.
  - Depends on openbios-ppc.
  - Update 12_signal_powerpc_support.patch.
  - Update 21_net_soopts.patch.
  - Drop 44_socklen_t_check.patch (merged upstream).
  - Drop 49_null_check.patch (merged upstream).
  - Update 64_ppc_asm_constraints.patch.
  - Drop security/CVE-2008-0928-fedora.patch (merged upstream).
  - Drop security/CVE-2007-5730.patch (merged upstream).
* patches/80_stable-branch.patch: add patches from stable branch:
  - Fix race condition between signal handler/execution loop (closes:
    bug#474386, bug#501731).
* debian/copyright: update.
* Compile and install .dtb files:
  - debian/control: build-depends on device-tree-compiler.
  - debian/patches/81_compile_dtb.patch: new patch from upstream.
  - debian/rules: compile and install bamboo.dtb and mpc8544.dtb.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 
8
8
/* VM Load/Save */
9
9
 
 
10
/* This function writes a chunk of data to a file at the given position.
 
11
 * The pos argument can be ignored if the file is only being used for
 
12
 * streaming.  The handler should try to write all of the data it can.
 
13
 */
 
14
typedef int (QEMUFilePutBufferFunc)(void *opaque, const uint8_t *buf,
 
15
                                    int64_t pos, int size);
 
16
 
 
17
/* Read a chunk of data from a file at the given position.  The pos argument
 
18
 * can be ignored if the file is only be used for streaming.  The number of
 
19
 * bytes actually read should be returned.
 
20
 */
 
21
typedef int (QEMUFileGetBufferFunc)(void *opaque, uint8_t *buf,
 
22
                                    int64_t pos, int size);
 
23
 
 
24
/* Close a file and return an error code */
 
25
typedef int (QEMUFileCloseFunc)(void *opaque);
 
26
 
 
27
/* Called to determine if the file has exceeded it's bandwidth allocation.  The
 
28
 * bandwidth capping is a soft limit, not a hard limit.
 
29
 */
 
30
typedef int (QEMUFileRateLimit)(void *opaque);
 
31
 
 
32
QEMUFile *qemu_fopen_ops(void *opaque, QEMUFilePutBufferFunc *put_buffer,
 
33
                         QEMUFileGetBufferFunc *get_buffer,
 
34
                         QEMUFileCloseFunc *close,
 
35
                         QEMUFileRateLimit *rate_limit);
10
36
QEMUFile *qemu_fopen(const char *filename, const char *mode);
 
37
QEMUFile *qemu_fopen_socket(int fd);
 
38
QEMUFile *qemu_popen(FILE *popen_file, const char *mode);
 
39
QEMUFile *qemu_popen_cmd(const char *command, const char *mode);
11
40
void qemu_fflush(QEMUFile *f);
12
 
void qemu_fclose(QEMUFile *f);
 
41
int qemu_fclose(QEMUFile *f);
13
42
void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size);
14
43
void qemu_put_byte(QEMUFile *f, int v);
 
44
 
 
45
static inline void qemu_put_ubyte(QEMUFile *f, unsigned int v)
 
46
{
 
47
    qemu_put_byte(f, (int)v);
 
48
}
 
49
 
 
50
#define qemu_put_sbyte qemu_put_byte
 
51
 
15
52
void qemu_put_be16(QEMUFile *f, unsigned int v);
16
53
void qemu_put_be32(QEMUFile *f, unsigned int v);
17
54
void qemu_put_be64(QEMUFile *f, uint64_t v);
18
55
int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size);
19
56
int qemu_get_byte(QEMUFile *f);
 
57
 
 
58
static inline unsigned int qemu_get_ubyte(QEMUFile *f)
 
59
{
 
60
    return (unsigned int)qemu_get_byte(f);
 
61
}
 
62
 
 
63
#define qemu_get_sbyte qemu_get_byte
 
64
 
20
65
unsigned int qemu_get_be16(QEMUFile *f);
21
66
unsigned int qemu_get_be32(QEMUFile *f);
22
67
uint64_t qemu_get_be64(QEMUFile *f);
 
68
int qemu_file_rate_limit(QEMUFile *f);
 
69
int qemu_file_has_error(QEMUFile *f);
 
70
 
 
71
/* Try to send any outstanding data.  This function is useful when output is
 
72
 * halted due to rate limiting or EAGAIN errors occur as it can be used to
 
73
 * resume output. */
 
74
void qemu_file_put_notify(QEMUFile *f);
23
75
 
24
76
static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv)
25
77
{
61
113
    *pv = qemu_get_byte(f);
62
114
}
63
115
 
 
116
// Signed versions for type safety
 
117
static inline void qemu_put_sbuffer(QEMUFile *f, const int8_t *buf, int size)
 
118
{
 
119
    qemu_put_buffer(f, (const uint8_t *)buf, size);
 
120
}
 
121
 
 
122
static inline void qemu_put_sbe16(QEMUFile *f, int v)
 
123
{
 
124
    qemu_put_be16(f, (unsigned int)v);
 
125
}
 
126
 
 
127
static inline void qemu_put_sbe32(QEMUFile *f, int v)
 
128
{
 
129
    qemu_put_be32(f, (unsigned int)v);
 
130
}
 
131
 
 
132
static inline void qemu_put_sbe64(QEMUFile *f, int64_t v)
 
133
{
 
134
    qemu_put_be64(f, (uint64_t)v);
 
135
}
 
136
 
 
137
static inline size_t qemu_get_sbuffer(QEMUFile *f, int8_t *buf, int size)
 
138
{
 
139
    return qemu_get_buffer(f, (uint8_t *)buf, size);
 
140
}
 
141
 
 
142
static inline int qemu_get_sbe16(QEMUFile *f)
 
143
{
 
144
    return (int)qemu_get_be16(f);
 
145
}
 
146
 
 
147
static inline int qemu_get_sbe32(QEMUFile *f)
 
148
{
 
149
    return (int)qemu_get_be32(f);
 
150
}
 
151
 
 
152
static inline int64_t qemu_get_sbe64(QEMUFile *f)
 
153
{
 
154
    return (int64_t)qemu_get_be64(f);
 
155
}
 
156
 
 
157
static inline void qemu_put_s8s(QEMUFile *f, const int8_t *pv)
 
158
{
 
159
    qemu_put_8s(f, (const uint8_t *)pv);
 
160
}
 
161
 
 
162
static inline void qemu_put_sbe16s(QEMUFile *f, const int16_t *pv)
 
163
{
 
164
    qemu_put_be16s(f, (const uint16_t *)pv);
 
165
}
 
166
 
 
167
static inline void qemu_put_sbe32s(QEMUFile *f, const int32_t *pv)
 
168
{
 
169
    qemu_put_be32s(f, (const uint32_t *)pv);
 
170
}
 
171
 
 
172
static inline void qemu_put_sbe64s(QEMUFile *f, const int64_t *pv)
 
173
{
 
174
    qemu_put_be64s(f, (const uint64_t *)pv);
 
175
}
 
176
 
 
177
static inline void qemu_get_s8s(QEMUFile *f, int8_t *pv)
 
178
{
 
179
    qemu_get_8s(f, (uint8_t *)pv);
 
180
}
 
181
 
 
182
static inline void qemu_get_sbe16s(QEMUFile *f, int16_t *pv)
 
183
{
 
184
    qemu_get_be16s(f, (uint16_t *)pv);
 
185
}
 
186
 
 
187
static inline void qemu_get_sbe32s(QEMUFile *f, int32_t *pv)
 
188
{
 
189
    qemu_get_be32s(f, (uint32_t *)pv);
 
190
}
 
191
 
 
192
static inline void qemu_get_sbe64s(QEMUFile *f, int64_t *pv)
 
193
{
 
194
    qemu_get_be64s(f, (uint64_t *)pv);
 
195
}
 
196
 
64
197
#ifdef NEED_CPU_H
65
198
#if TARGET_LONG_BITS == 64
66
199
#define qemu_put_betl qemu_put_be64
67
200
#define qemu_get_betl qemu_get_be64
68
201
#define qemu_put_betls qemu_put_be64s
69
202
#define qemu_get_betls qemu_get_be64s
 
203
#define qemu_put_sbetl qemu_put_sbe64
 
204
#define qemu_get_sbetl qemu_get_sbe64
 
205
#define qemu_put_sbetls qemu_put_sbe64s
 
206
#define qemu_get_sbetls qemu_get_sbe64s
70
207
#else
71
208
#define qemu_put_betl qemu_put_be32
72
209
#define qemu_get_betl qemu_get_be32
73
210
#define qemu_put_betls qemu_put_be32s
74
211
#define qemu_get_betls qemu_get_be32s
 
212
#define qemu_put_sbetl qemu_put_sbe32
 
213
#define qemu_get_sbetl qemu_get_sbe32
 
214
#define qemu_put_sbetls qemu_put_sbe32s
 
215
#define qemu_get_sbetls qemu_get_sbe32s
75
216
#endif
76
217
#endif
77
218
 
79
220
int64_t qemu_fseek(QEMUFile *f, int64_t pos, int whence);
80
221
 
81
222
typedef void SaveStateHandler(QEMUFile *f, void *opaque);
 
223
typedef int SaveLiveStateHandler(QEMUFile *f, int stage, void *opaque);
82
224
typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
83
225
 
84
226
int register_savevm(const char *idstr,
88
230
                    LoadStateHandler *load_state,
89
231
                    void *opaque);
90
232
 
 
233
int register_savevm_live(const char *idstr,
 
234
                         int instance_id,
 
235
                         int version_id,
 
236
                         SaveLiveStateHandler *save_live_state,
 
237
                         SaveStateHandler *save_state,
 
238
                         LoadStateHandler *load_state,
 
239
                         void *opaque);
 
240
 
91
241
typedef void QEMUResetHandler(void *opaque);
92
242
 
93
243
void qemu_register_reset(QEMUResetHandler *func, void *opaque);
94
244
 
 
245
/* handler to set the boot_device for a specific type of QEMUMachine */
 
246
/* return 0 if success */
 
247
typedef int QEMUBootSetHandler(void *opaque, const char *boot_device);
 
248
void qemu_register_boot_set(QEMUBootSetHandler *func, void *opaque);
 
249
 
95
250
/* These should really be in isa.h, but are here to make pc.h happy.  */
96
251
typedef void (IOPortWriteFunc)(void *opaque, uint32_t address, uint32_t data);
97
252
typedef uint32_t (IOPortReadFunc)(void *opaque, uint32_t address);