VirtualBox

source: vbox/trunk/src/recompiler_new/qemu-common.h@ 16977

最後變更 在這個檔案從16977是 14542,由 vboxsync 提交於 16 年 前

Export new recompiler to OSE

檔案大小: 3.9 KB
 
1/* Common header file that is included by all of qemu. */
2#ifndef QEMU_COMMON_H
3#define QEMU_COMMON_H
4
5#ifdef VBOX
6
7#include <string.h>
8
9void pstrcpy(char *buf, int buf_size, const char *str);
10char *pstrcat(char *buf, int buf_size, const char *s);
11#define snprintf RTStrPrintf
12#ifndef PRId32
13#define PRId32 "I32d"
14#define PRIx32 "I32x"
15#define PRIu32 "I32u"
16#define PRIo32 "I32o"
17#define PRId64 "I64d"
18#define PRIx64 "I64x"
19#define PRIu64 "I64u"
20#define PRIo64 "I64o"
21#endif
22
23#else
24/* we put basic includes here to avoid repeating them in device drivers */
25#include <stdlib.h>
26#include <stdio.h>
27#include <stdarg.h>
28#include <string.h>
29#include <inttypes.h>
30#include <limits.h>
31#include <time.h>
32#include <ctype.h>
33#include <errno.h>
34#include <unistd.h>
35#include <fcntl.h>
36#include <sys/stat.h>
37
38#ifndef O_LARGEFILE
39#define O_LARGEFILE 0
40#endif
41#ifndef O_BINARY
42#define O_BINARY 0
43#endif
44
45#ifndef ENOMEDIUM
46#define ENOMEDIUM ENODEV
47#endif
48
49#ifdef _WIN32
50#define WIN32_LEAN_AND_MEAN
51#include <windows.h>
52#define fsync _commit
53#define lseek _lseeki64
54#define ENOTSUP 4096
55extern int qemu_ftruncate64(int, int64_t);
56#define ftruncate qemu_ftruncate64
57
58
59static inline char *realpath(const char *path, char *resolved_path)
60{
61 _fullpath(resolved_path, path, _MAX_PATH);
62 return resolved_path;
63}
64
65#define PRId64 "I64d"
66#define PRIx64 "I64x"
67#define PRIu64 "I64u"
68#define PRIo64 "I64o"
69#endif
70
71/* FIXME: Remove NEED_CPU_H. */
72#ifndef NEED_CPU_H
73
74#include "config-host.h"
75#include <setjmp.h>
76#include "osdep.h"
77#include "bswap.h"
78
79#else
80
81#include "cpu.h"
82
83#endif /* !defined(NEED_CPU_H) */
84
85/* bottom halves */
86typedef struct QEMUBH QEMUBH;
87
88typedef void QEMUBHFunc(void *opaque);
89
90QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque);
91void qemu_bh_schedule(QEMUBH *bh);
92void qemu_bh_cancel(QEMUBH *bh);
93void qemu_bh_delete(QEMUBH *bh);
94int qemu_bh_poll(void);
95
96uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);
97
98void qemu_get_timedate(struct tm *tm, int offset);
99int qemu_timedate_diff(struct tm *tm);
100
101/* cutils.c */
102void pstrcpy(char *buf, int buf_size, const char *str);
103char *pstrcat(char *buf, int buf_size, const char *s);
104int strstart(const char *str, const char *val, const char **ptr);
105int stristart(const char *str, const char *val, const char **ptr);
106time_t mktimegm(struct tm *tm);
107
108void *qemu_malloc(size_t size);
109void *qemu_realloc(void *ptr, size_t size);
110void *qemu_mallocz(size_t size);
111void qemu_free(void *ptr);
112char *qemu_strdup(const char *str);
113
114void *get_mmap_addr(unsigned long size);
115
116
117/* Error handling. */
118
119void hw_error(const char *fmt, ...)
120 __attribute__ ((__format__ (__printf__, 1, 2)))
121 __attribute__ ((__noreturn__));
122
123/* IO callbacks. */
124typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size);
125typedef int IOCanRWHandler(void *opaque);
126typedef void IOHandler(void *opaque);
127
128struct ParallelIOArg {
129 void *buffer;
130 int count;
131};
132
133typedef int (*DMA_transfer_handler) (void *opaque, int nchan, int pos, int size);
134
135/* A load of opaque types so that device init declarations don't have to
136 pull in all the real definitions. */
137typedef struct NICInfo NICInfo;
138typedef struct HCIInfo HCIInfo;
139typedef struct AudioState AudioState;
140typedef struct BlockDriverState BlockDriverState;
141typedef struct DisplayState DisplayState;
142typedef struct TextConsole TextConsole;
143typedef TextConsole QEMUConsole;
144typedef struct CharDriverState CharDriverState;
145typedef struct VLANState VLANState;
146typedef struct QEMUFile QEMUFile;
147typedef struct i2c_bus i2c_bus;
148typedef struct i2c_slave i2c_slave;
149typedef struct SMBusDevice SMBusDevice;
150typedef struct QEMUTimer QEMUTimer;
151typedef struct PCIBus PCIBus;
152typedef struct PCIDevice PCIDevice;
153typedef struct SerialState SerialState;
154typedef struct IRQState *qemu_irq;
155struct pcmcia_card_s;
156
157/* CPU save/load. */
158void cpu_save(QEMUFile *f, void *opaque);
159int cpu_load(QEMUFile *f, void *opaque, int version_id);
160
161/* Force QEMU to stop what it's doing and service IO */
162void qemu_service_io(void);
163#endif // !VBOX
164
165#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette