VirtualBox

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

Last change on this file since 31176 was 31176, checked in by vboxsync, 15 years ago

REM: fix logging

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

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