root / qemu-common.h @ 0fead125
History | View | Annotate | Download (3.2 kB)
1 | faf07963 | pbrook | /* Common header file that is included by all of qemu. */
|
---|---|---|---|
2 | faf07963 | pbrook | #ifndef QEMU_COMMON_H
|
3 | faf07963 | pbrook | #define QEMU_COMMON_H
|
4 | faf07963 | pbrook | |
5 | faf07963 | pbrook | /* we put basic includes here to avoid repeating them in device drivers */
|
6 | faf07963 | pbrook | #include <stdlib.h> |
7 | faf07963 | pbrook | #include <stdio.h> |
8 | faf07963 | pbrook | #include <stdarg.h> |
9 | faf07963 | pbrook | #include <string.h> |
10 | faf07963 | pbrook | #include <inttypes.h> |
11 | faf07963 | pbrook | #include <limits.h> |
12 | faf07963 | pbrook | #include <time.h> |
13 | faf07963 | pbrook | #include <ctype.h> |
14 | faf07963 | pbrook | #include <errno.h> |
15 | faf07963 | pbrook | #include <unistd.h> |
16 | faf07963 | pbrook | #include <fcntl.h> |
17 | faf07963 | pbrook | #include <sys/stat.h> |
18 | faf07963 | pbrook | |
19 | faf07963 | pbrook | #ifndef O_LARGEFILE
|
20 | faf07963 | pbrook | #define O_LARGEFILE 0 |
21 | faf07963 | pbrook | #endif
|
22 | faf07963 | pbrook | #ifndef O_BINARY
|
23 | faf07963 | pbrook | #define O_BINARY 0 |
24 | faf07963 | pbrook | #endif
|
25 | faf07963 | pbrook | |
26 | faf07963 | pbrook | #ifndef ENOMEDIUM
|
27 | faf07963 | pbrook | #define ENOMEDIUM ENODEV
|
28 | faf07963 | pbrook | #endif
|
29 | faf07963 | pbrook | |
30 | faf07963 | pbrook | #ifdef _WIN32
|
31 | 4fddf62a | ths | #define WIN32_LEAN_AND_MEAN
|
32 | faf07963 | pbrook | #include <windows.h> |
33 | faf07963 | pbrook | #define fsync _commit
|
34 | faf07963 | pbrook | #define lseek _lseeki64
|
35 | faf07963 | pbrook | #define ENOTSUP 4096 |
36 | faf07963 | pbrook | extern int qemu_ftruncate64(int, int64_t); |
37 | faf07963 | pbrook | #define ftruncate qemu_ftruncate64
|
38 | faf07963 | pbrook | |
39 | faf07963 | pbrook | |
40 | faf07963 | pbrook | static inline char *realpath(const char *path, char *resolved_path) |
41 | faf07963 | pbrook | { |
42 | faf07963 | pbrook | _fullpath(resolved_path, path, _MAX_PATH); |
43 | faf07963 | pbrook | return resolved_path;
|
44 | faf07963 | pbrook | } |
45 | faf07963 | pbrook | |
46 | faf07963 | pbrook | #define PRId64 "I64d" |
47 | faf07963 | pbrook | #define PRIx64 "I64x" |
48 | faf07963 | pbrook | #define PRIu64 "I64u" |
49 | faf07963 | pbrook | #define PRIo64 "I64o" |
50 | faf07963 | pbrook | #endif
|
51 | faf07963 | pbrook | |
52 | faf07963 | pbrook | /* FIXME: Remove NEED_CPU_H. */
|
53 | faf07963 | pbrook | #ifndef NEED_CPU_H
|
54 | faf07963 | pbrook | |
55 | faf07963 | pbrook | #include "config-host.h" |
56 | faf07963 | pbrook | #include <setjmp.h> |
57 | faf07963 | pbrook | #include "osdep.h" |
58 | faf07963 | pbrook | #include "bswap.h" |
59 | faf07963 | pbrook | |
60 | faf07963 | pbrook | #else
|
61 | faf07963 | pbrook | |
62 | faf07963 | pbrook | #include "cpu.h" |
63 | faf07963 | pbrook | |
64 | faf07963 | pbrook | #endif /* !defined(NEED_CPU_H) */ |
65 | faf07963 | pbrook | |
66 | faf07963 | pbrook | /* bottom halves */
|
67 | faf07963 | pbrook | typedef struct QEMUBH QEMUBH; |
68 | faf07963 | pbrook | |
69 | faf07963 | pbrook | typedef void QEMUBHFunc(void *opaque); |
70 | faf07963 | pbrook | |
71 | faf07963 | pbrook | QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque);
|
72 | faf07963 | pbrook | void qemu_bh_schedule(QEMUBH *bh);
|
73 | faf07963 | pbrook | void qemu_bh_cancel(QEMUBH *bh);
|
74 | faf07963 | pbrook | void qemu_bh_delete(QEMUBH *bh);
|
75 | faf07963 | pbrook | int qemu_bh_poll(void); |
76 | faf07963 | pbrook | |
77 | 87ecb68b | pbrook | uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c); |
78 | 87ecb68b | pbrook | |
79 | f6503059 | balrog | void qemu_get_timedate(struct tm *tm, int offset); |
80 | f6503059 | balrog | int qemu_timedate_diff(struct tm *tm); |
81 | f6503059 | balrog | |
82 | faf07963 | pbrook | /* cutils.c */
|
83 | faf07963 | pbrook | void pstrcpy(char *buf, int buf_size, const char *str); |
84 | faf07963 | pbrook | char *pstrcat(char *buf, int buf_size, const char *s); |
85 | faf07963 | pbrook | int strstart(const char *str, const char *val, const char **ptr); |
86 | faf07963 | pbrook | int stristart(const char *str, const char *val, const char **ptr); |
87 | faf07963 | pbrook | time_t mktimegm(struct tm *tm);
|
88 | faf07963 | pbrook | |
89 | ca10f867 | aurel32 | void *qemu_malloc(size_t size);
|
90 | ca10f867 | aurel32 | void *qemu_mallocz(size_t size);
|
91 | ca10f867 | aurel32 | void qemu_free(void *ptr); |
92 | ca10f867 | aurel32 | char *qemu_strdup(const char *str); |
93 | ca10f867 | aurel32 | |
94 | ca10f867 | aurel32 | void *get_mmap_addr(unsigned long size); |
95 | ca10f867 | aurel32 | |
96 | ca10f867 | aurel32 | |
97 | 87ecb68b | pbrook | /* Error handling. */
|
98 | 87ecb68b | pbrook | |
99 | 87ecb68b | pbrook | void hw_error(const char *fmt, ...) |
100 | 87ecb68b | pbrook | __attribute__ ((__format__ (__printf__, 1, 2))) |
101 | 87ecb68b | pbrook | __attribute__ ((__noreturn__)); |
102 | 87ecb68b | pbrook | |
103 | 87ecb68b | pbrook | /* IO callbacks. */
|
104 | 87ecb68b | pbrook | typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size); |
105 | 87ecb68b | pbrook | typedef int IOCanRWHandler(void *opaque); |
106 | 87ecb68b | pbrook | typedef void IOHandler(void *opaque); |
107 | 87ecb68b | pbrook | |
108 | 87ecb68b | pbrook | struct ParallelIOArg {
|
109 | 87ecb68b | pbrook | void *buffer;
|
110 | 87ecb68b | pbrook | int count;
|
111 | 87ecb68b | pbrook | }; |
112 | 87ecb68b | pbrook | |
113 | 87ecb68b | pbrook | typedef int (*DMA_transfer_handler) (void *opaque, int nchan, int pos, int size); |
114 | 87ecb68b | pbrook | |
115 | 87ecb68b | pbrook | /* A load of opaque types so that device init declarations don't have to
|
116 | 87ecb68b | pbrook | pull in all the real definitions. */
|
117 | 87ecb68b | pbrook | typedef struct NICInfo NICInfo; |
118 | 87ecb68b | pbrook | typedef struct AudioState AudioState; |
119 | 87ecb68b | pbrook | typedef struct BlockDriverState BlockDriverState; |
120 | 87ecb68b | pbrook | typedef struct DisplayState DisplayState; |
121 | 87ecb68b | pbrook | typedef struct TextConsole TextConsole; |
122 | 87ecb68b | pbrook | typedef struct CharDriverState CharDriverState; |
123 | 87ecb68b | pbrook | typedef struct VLANState VLANState; |
124 | 87ecb68b | pbrook | typedef struct QEMUFile QEMUFile; |
125 | 87ecb68b | pbrook | typedef struct i2c_bus i2c_bus; |
126 | 87ecb68b | pbrook | typedef struct i2c_slave i2c_slave; |
127 | 87ecb68b | pbrook | typedef struct SMBusDevice SMBusDevice; |
128 | 87ecb68b | pbrook | typedef struct QEMUTimer QEMUTimer; |
129 | 87ecb68b | pbrook | typedef struct PCIBus PCIBus; |
130 | 87ecb68b | pbrook | typedef struct PCIDevice PCIDevice; |
131 | 87ecb68b | pbrook | typedef struct SerialState SerialState; |
132 | 87ecb68b | pbrook | typedef struct IRQState *qemu_irq; |
133 | 87ecb68b | pbrook | struct pcmcia_card_s;
|
134 | 87ecb68b | pbrook | |
135 | faf07963 | pbrook | #endif |