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
34 #define lseek _lseeki64
36 extern int qemu_ftruncate64(int, int64_t);
37 #define ftruncate qemu_ftruncate64
40 static inline char *realpath(const char *path, char *resolved_path)
42 _fullpath(resolved_path, path, _MAX_PATH);
52 /* FIXME: Remove NEED_CPU_H. */
55 #include "config-host.h"
64 #endif /* !defined(NEED_CPU_H) */
67 typedef struct QEMUBH QEMUBH;
69 typedef void QEMUBHFunc(void *opaque);
71 QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque);
72 void qemu_bh_schedule(QEMUBH *bh);
73 void qemu_bh_schedule_idle(QEMUBH *bh);
74 void qemu_bh_cancel(QEMUBH *bh);
75 void qemu_bh_delete(QEMUBH *bh);
76 int qemu_bh_poll(void);
78 uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);
80 void qemu_get_timedate(struct tm *tm, int offset);
81 int qemu_timedate_diff(struct tm *tm);
84 void pstrcpy(char *buf, int buf_size, const char *str);
85 char *pstrcat(char *buf, int buf_size, const char *s);
86 char *pstrdup(const char *str, size_t buf_size);
87 int strstart(const char *str, const char *val, const char **ptr);
88 int stristart(const char *str, const char *val, const char **ptr);
89 time_t mktimegm(struct tm *tm);
91 void *qemu_malloc(size_t size);
92 void *qemu_realloc(void *ptr, size_t size);
93 void *qemu_mallocz(size_t size);
94 void qemu_free(void *ptr);
95 char *qemu_strdup(const char *str);
97 void *get_mmap_addr(unsigned long size);
100 /* Error handling. */
102 void hw_error(const char *fmt, ...)
103 __attribute__ ((__format__ (__printf__, 1, 2)))
104 __attribute__ ((__noreturn__));
107 typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size);
108 typedef int IOCanRWHandler(void *opaque);
109 typedef void IOHandler(void *opaque);
111 struct ParallelIOArg {
116 typedef int (*DMA_transfer_handler) (void *opaque, int nchan, int pos, int size);
118 /* A load of opaque types so that device init declarations don't have to
119 pull in all the real definitions. */
120 typedef struct NICInfo NICInfo;
121 typedef struct HCIInfo HCIInfo;
122 typedef struct AudioState AudioState;
123 typedef struct BlockDriverState BlockDriverState;
124 typedef struct DisplayState DisplayState;
125 typedef struct TextConsole TextConsole;
126 typedef TextConsole QEMUConsole;
127 typedef struct CharDriverState CharDriverState;
128 typedef struct VLANState VLANState;
129 typedef struct QEMUFile QEMUFile;
130 typedef struct i2c_bus i2c_bus;
131 typedef struct i2c_slave i2c_slave;
132 typedef struct SMBusDevice SMBusDevice;
133 typedef struct QEMUTimer QEMUTimer;
134 typedef struct PCIBus PCIBus;
135 typedef struct PCIDevice PCIDevice;
136 typedef struct SerialState SerialState;
137 typedef struct IRQState *qemu_irq;
138 struct pcmcia_card_s;
141 void cpu_save(QEMUFile *f, void *opaque);
142 int cpu_load(QEMUFile *f, void *opaque, int version_id);
144 /* Force QEMU to stop what it's doing and service IO */
145 void qemu_service_io(void);