kvm: bios: add vapic support
[qemu-kvm/fedora.git] / qemu-common.h
bloba383f4fb5b5ef7cfa193dbe8443fa764f64566fd
1 /* Common header file that is included by all of qemu. */
2 #ifndef QEMU_COMMON_H
3 #define QEMU_COMMON_H
5 /* we put basic includes here to avoid repeating them in device drivers */
6 #include <stdlib.h>
7 #include <stdio.h>
8 #include <stdarg.h>
9 #include <string.h>
10 #include <inttypes.h>
11 #include <limits.h>
12 #include <time.h>
13 #include <ctype.h>
14 #include <errno.h>
15 #include <unistd.h>
16 #include <fcntl.h>
17 #include <sys/stat.h>
19 #ifndef O_LARGEFILE
20 #define O_LARGEFILE 0
21 #endif
22 #ifndef O_BINARY
23 #define O_BINARY 0
24 #endif
26 #ifndef ENOMEDIUM
27 #define ENOMEDIUM ENODEV
28 #endif
30 #ifdef _WIN32
31 #include <windows.h>
32 #define fsync _commit
33 #define lseek _lseeki64
34 #define ENOTSUP 4096
35 extern int qemu_ftruncate64(int, int64_t);
36 #define ftruncate qemu_ftruncate64
39 static inline char *realpath(const char *path, char *resolved_path)
41 _fullpath(resolved_path, path, _MAX_PATH);
42 return resolved_path;
45 #define PRId64 "I64d"
46 #define PRIx64 "I64x"
47 #define PRIu64 "I64u"
48 #define PRIo64 "I64o"
49 #endif
51 /* FIXME: Remove NEED_CPU_H. */
52 #ifndef NEED_CPU_H
54 #include "config-host.h"
55 #include <setjmp.h>
56 #include "osdep.h"
57 #include "bswap.h"
59 #else
61 #include "cpu.h"
63 #endif /* !defined(NEED_CPU_H) */
65 /* bottom halves */
66 typedef struct QEMUBH QEMUBH;
68 typedef void QEMUBHFunc(void *opaque);
70 QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque);
71 void qemu_bh_schedule(QEMUBH *bh);
72 void qemu_bh_cancel(QEMUBH *bh);
73 void qemu_bh_delete(QEMUBH *bh);
74 int qemu_bh_poll(void);
76 uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);
78 /* cutils.c */
79 void pstrcpy(char *buf, int buf_size, const char *str);
80 char *pstrcat(char *buf, int buf_size, const char *s);
81 int strstart(const char *str, const char *val, const char **ptr);
82 int stristart(const char *str, const char *val, const char **ptr);
83 time_t mktimegm(struct tm *tm);
84 int hex2bin(char ch);
85 char *urldecode(const char *ptr);
87 /* Error handling. */
89 void hw_error(const char *fmt, ...)
90 __attribute__ ((__format__ (__printf__, 1, 2)))
91 __attribute__ ((__noreturn__));
93 /* IO callbacks. */
94 typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size);
95 typedef int IOCanRWHandler(void *opaque);
96 typedef void IOHandler(void *opaque);
98 struct ParallelIOArg {
99 void *buffer;
100 int count;
103 typedef int (*DMA_transfer_handler) (void *opaque, int nchan, int pos, int size);
105 /* A load of opaque types so that device init declarations don't have to
106 pull in all the real definitions. */
107 typedef struct NICInfo NICInfo;
108 typedef struct AudioState AudioState;
109 typedef struct BlockDriverState BlockDriverState;
110 typedef struct DisplayState DisplayState;
111 typedef struct TextConsole TextConsole;
112 typedef struct CharDriverState CharDriverState;
113 typedef struct VLANState VLANState;
114 typedef struct QEMUFile QEMUFile;
115 typedef struct i2c_bus i2c_bus;
116 typedef struct i2c_slave i2c_slave;
117 typedef struct SMBusDevice SMBusDevice;
118 typedef struct QEMUTimer QEMUTimer;
119 typedef struct PCIBus PCIBus;
120 typedef struct PCIDevice PCIDevice;
121 typedef struct SerialState SerialState;
122 typedef struct IRQState *qemu_irq;
123 struct pcmcia_card_s;
125 #endif