VirtualBox

source: vbox/trunk/src/recompiler/qemu-common.h@ 24345

Last change on this file since 24345 was 18472, checked in by vboxsync, 16 years ago

qemu-common.h: Fixed incorrect PRI* macros. (caused warnings on 64-bit windows)

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

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