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 /* Bottom halfs that are scheduled from a bottom half handler are instantly
74 * invoked. This can create an infinite loop if a bottom half handler
75 * schedules itself. qemu_bh_schedule_idle() avoids this infinite loop by
76 * ensuring that the bottom half isn't executed until the next main loop
79 void qemu_bh_schedule_idle(QEMUBH
*bh
);
80 void qemu_bh_cancel(QEMUBH
*bh
);
81 void qemu_bh_delete(QEMUBH
*bh
);
82 int qemu_bh_poll(void);
84 uint64_t muldiv64(uint64_t a
, uint32_t b
, uint32_t c
);
86 void qemu_get_timedate(struct tm
*tm
, int offset
);
87 int qemu_timedate_diff(struct tm
*tm
);
90 void pstrcpy(char *buf
, int buf_size
, const char *str
);
91 char *pstrcat(char *buf
, int buf_size
, const char *s
);
92 int strstart(const char *str
, const char *val
, const char **ptr
);
93 int stristart(const char *str
, const char *val
, const char **ptr
);
94 time_t mktimegm(struct tm
*tm
);
96 void *qemu_malloc(size_t size
);
97 void *qemu_realloc(void *ptr
, size_t size
);
98 void *qemu_mallocz(size_t size
);
99 void qemu_free(void *ptr
);
100 char *qemu_strdup(const char *str
);
102 void *get_mmap_addr(unsigned long size
);
105 /* Error handling. */
107 void hw_error(const char *fmt
, ...)
108 __attribute__ ((__format__ (__printf__
, 1, 2)))
109 __attribute__ ((__noreturn__
));
112 typedef void IOReadHandler(void *opaque
, const uint8_t *buf
, int size
);
113 typedef int IOCanRWHandler(void *opaque
);
114 typedef void IOHandler(void *opaque
);
116 struct ParallelIOArg
{
121 typedef int (*DMA_transfer_handler
) (void *opaque
, int nchan
, int pos
, int size
);
123 /* A load of opaque types so that device init declarations don't have to
124 pull in all the real definitions. */
125 typedef struct NICInfo NICInfo
;
126 typedef struct HCIInfo HCIInfo
;
127 typedef struct AudioState AudioState
;
128 typedef struct BlockDriverState BlockDriverState
;
129 typedef struct DisplayState DisplayState
;
130 typedef struct TextConsole TextConsole
;
131 typedef TextConsole QEMUConsole
;
132 typedef struct CharDriverState CharDriverState
;
133 typedef struct VLANState VLANState
;
134 typedef struct QEMUFile QEMUFile
;
135 typedef struct i2c_bus i2c_bus
;
136 typedef struct i2c_slave i2c_slave
;
137 typedef struct SMBusDevice SMBusDevice
;
138 typedef struct QEMUTimer QEMUTimer
;
139 typedef struct PCIBus PCIBus
;
140 typedef struct PCIDevice PCIDevice
;
141 typedef struct SerialState SerialState
;
142 typedef struct IRQState
*qemu_irq
;
143 struct pcmcia_card_s
;
146 void cpu_save(QEMUFile
*f
, void *opaque
);
147 int cpu_load(QEMUFile
*f
, void *opaque
, int version_id
);
149 /* Force QEMU to stop what it's doing and service IO */
150 void qemu_service_io(void);