1 /* Common header file that is included by all of qemu. */
5 /* we put basic includes here to avoid repeating them in device drivers */
27 #define ENOMEDIUM ENODEV
31 #define WIN32_LEAN_AND_MEAN
32 #define WINVER 0x0501 /* needed for ipv6 bits */
35 #define lseek _lseeki64
37 extern int qemu_ftruncate64(int, int64_t);
38 #define ftruncate qemu_ftruncate64
41 static inline char *realpath(const char *path, char *resolved_path)
43 _fullpath(resolved_path, path, _MAX_PATH);
53 /* FIXME: Remove NEED_CPU_H. */
56 #include "config-host.h"
65 #endif /* !defined(NEED_CPU_H) */
68 typedef struct QEMUBH QEMUBH;
70 typedef void QEMUBHFunc(void *opaque);
72 QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque);
73 void qemu_bh_schedule(QEMUBH *bh);
74 /* Bottom halfs that are scheduled from a bottom half handler are instantly
75 * invoked. This can create an infinite loop if a bottom half handler
76 * schedules itself. qemu_bh_schedule_idle() avoids this infinite loop by
77 * ensuring that the bottom half isn't executed until the next main loop
80 void qemu_bh_schedule_idle(QEMUBH *bh);
81 void qemu_bh_cancel(QEMUBH *bh);
82 void qemu_bh_delete(QEMUBH *bh);
83 int qemu_bh_poll(void);
85 uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);
87 void qemu_get_timedate(struct tm *tm, int offset);
88 int qemu_timedate_diff(struct tm *tm);
91 void pstrcpy(char *buf, int buf_size, const char *str);
92 char *pstrcat(char *buf, int buf_size, const char *s);
93 int strstart(const char *str, const char *val, const char **ptr);
94 int stristart(const char *str, const char *val, const char **ptr);
95 time_t mktimegm(struct tm *tm);
97 void *qemu_malloc(size_t size);
98 void *qemu_realloc(void *ptr, size_t size);
99 void *qemu_mallocz(size_t size);
100 void qemu_free(void *ptr);
101 char *qemu_strdup(const char *str);
102 char *qemu_strndup(const char *str, size_t size);
104 void *get_mmap_addr(unsigned long size);
107 /* Error handling. */
109 void hw_error(const char *fmt, ...)
110 __attribute__ ((__format__ (__printf__, 1, 2)))
111 __attribute__ ((__noreturn__));
114 typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size);
115 typedef int IOCanRWHandler(void *opaque);
116 typedef void IOHandler(void *opaque);
118 struct ParallelIOArg {
123 typedef int (*DMA_transfer_handler) (void *opaque, int nchan, int pos, int size);
125 /* A load of opaque types so that device init declarations don't have to
126 pull in all the real definitions. */
127 typedef struct NICInfo NICInfo;
128 typedef struct HCIInfo HCIInfo;
129 typedef struct AudioState AudioState;
130 typedef struct BlockDriverState BlockDriverState;
131 typedef struct DisplayState DisplayState;
132 typedef struct TextConsole TextConsole;
133 typedef TextConsole QEMUConsole;
134 typedef struct CharDriverState CharDriverState;
135 typedef struct VLANState VLANState;
136 typedef struct QEMUFile QEMUFile;
137 typedef struct i2c_bus i2c_bus;
138 typedef struct i2c_slave i2c_slave;
139 typedef struct SMBusDevice SMBusDevice;
140 typedef struct QEMUTimer QEMUTimer;
141 typedef struct PCIBus PCIBus;
142 typedef struct PCIDevice PCIDevice;
143 typedef struct SerialState SerialState;
144 typedef struct IRQState *qemu_irq;
145 struct pcmcia_card_s;
148 void cpu_save(QEMUFile *f, void *opaque);
149 int cpu_load(QEMUFile *f, void *opaque, int version_id);
151 /* Force QEMU to stop what it's doing and service IO */
152 void qemu_service_io(void);