Changeset 37675 in vbox for trunk/src/recompiler/qemu-common.h
- Timestamp:
- Jun 29, 2011 7:07:14 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/recompiler/qemu-common.h
r36175 r37675 3 3 #define QEMU_COMMON_H 4 4 5 #include "config-host.h" 6 5 7 #ifdef VBOX 6 8 7 # include < string.h>8 # include <i nttypes.h>9 # include <iprt/string.h> 10 # include <iprt/types.h> 9 11 # include <iprt/ctype.h> 10 11 #define QEMU_NORETURN __attribute__ ((__noreturn__))12 12 13 13 void pstrcpy(char *buf, int buf_size, const char *str); 14 14 char *pstrcat(char *buf, int buf_size, const char *s); 15 # define snprintf RTStrPrintf 16 17 #define qemu_isalnum(c) RT_C_IS_ALNUM((unsigned char)(c)) 18 #define qemu_isalpha(c) RT_C_IS_ALPHA((unsigned char)(c)) 19 #define qemu_iscntrl(c) RT_C_IS_CNTRL((unsigned char)(c)) 20 #define qemu_isdigit(c) RT_C_IS_DIGIT((unsigned char)(c)) 21 #define qemu_isgraph(c) RT_C_IS_GRAPH((unsigned char)(c)) 22 #define qemu_islower(c) RT_C_IS_LOWER((unsigned char)(c)) 23 #define qemu_isprint(c) RT_C_IS_PRINT((unsigned char)(c)) 24 #define qemu_ispunct(c) RT_C_IS_PUNCT((unsigned char)(c)) 25 #define qemu_isspace(c) RT_C_IS_SPACE((unsigned char)(c)) 26 #define qemu_isupper(c) RT_C_IS_UPPER((unsigned char)(c)) 27 #define qemu_isxdigit(c) RT_C_IS_XDIGIT((unsigned char)(c)) 28 #define qemu_tolower(c) RT_C_TO_LOWER((unsigned char)(c)) 29 #define qemu_toupper(c) RT_C_TO_UPPER((unsigned char)(c)) 30 #define qemu_isascii(c) RT_C_IS_ASCII((unsigned char)(c)) 31 #define qemu_toascii(c) RT_C_TO_ASCII((unsigned char)(c)) 32 33 #define qemu_init_vcpu(env) do { } while (0) /* we don't need this :-) */ 34 15 # define snprintf RTStrPrintf 16 17 # define qemu_isalnum(c) RT_C_IS_ALNUM((unsigned char)(c)) 18 # define qemu_isalpha(c) RT_C_IS_ALPHA((unsigned char)(c)) 19 # define qemu_iscntrl(c) RT_C_IS_CNTRL((unsigned char)(c)) 20 # define qemu_isdigit(c) RT_C_IS_DIGIT((unsigned char)(c)) 21 # define qemu_isgraph(c) RT_C_IS_GRAPH((unsigned char)(c)) 22 # define qemu_islower(c) RT_C_IS_LOWER((unsigned char)(c)) 23 # define qemu_isprint(c) RT_C_IS_PRINT((unsigned char)(c)) 24 # define qemu_ispunct(c) RT_C_IS_PUNCT((unsigned char)(c)) 25 # define qemu_isspace(c) RT_C_IS_SPACE((unsigned char)(c)) 26 # define qemu_isupper(c) RT_C_IS_UPPER((unsigned char)(c)) 27 # define qemu_isxdigit(c) RT_C_IS_XDIGIT((unsigned char)(c)) 28 # define qemu_tolower(c) RT_C_TO_LOWER((unsigned char)(c)) 29 # define qemu_toupper(c) RT_C_TO_UPPER((unsigned char)(c)) 30 # define qemu_isascii(c) RT_C_IS_ASCII((unsigned char)(c)) 31 # define qemu_toascii(c) RT_C_TO_ASCII((unsigned char)(c)) 32 33 # define qemu_init_vcpu(env) do { } while (0) /* we don't need this :-) */ 34 35 # define QEMU_NORETURN __attribute__((__noreturn__)) 36 # ifdef CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT 37 # define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) 38 # else 39 # define QEMU_WARN_UNUSED_RESULT 40 # endif 35 41 36 42 #else /* !VBOX */ … … 63 69 #include <sys/stat.h> 64 70 #include <assert.h> 65 #include "config-host.h"66 71 67 72 #ifndef O_LARGEFILE … … 71 76 #define O_BINARY 0 72 77 #endif 73 78 #ifndef MAP_ANONYMOUS 79 #define MAP_ANONYMOUS MAP_ANON 80 #endif 74 81 #ifndef ENOMEDIUM 75 82 #define ENOMEDIUM ENODEV 76 83 #endif 77 78 #ifndef HAVE_IOVEC 79 #define HAVE_IOVEC 84 #if !defined(ENOTSUP) 85 #define ENOTSUP 4096 86 #endif 87 88 #ifndef CONFIG_IOVEC 89 #define CONFIG_IOVEC 80 90 struct iovec { 81 91 void *iov_base; 82 92 size_t iov_len; 83 93 }; 94 /* 95 * Use the same value as Linux for now. 96 */ 97 #define IOV_MAX 1024 84 98 #else 85 99 #include <sys/uio.h> … … 89 103 #define fsync _commit 90 104 #define lseek _lseeki64 91 #define ENOTSUP 409692 105 extern int qemu_ftruncate64(int, int64_t); 93 106 #define ftruncate qemu_ftruncate64 94 95 107 96 108 static inline char *realpath(const char *path, char *resolved_path) … … 123 135 124 136 typedef void QEMUBHFunc(void *opaque); 137 138 void async_context_push(void); 139 void async_context_pop(void); 140 int get_async_context_id(void); 125 141 126 142 QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque); … … 136 152 void qemu_bh_delete(QEMUBH *bh); 137 153 int qemu_bh_poll(void); 154 void qemu_bh_update_timeout(int *timeout); 138 155 139 156 uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c); … … 150 167 time_t mktimegm(struct tm *tm); 151 168 int qemu_fls(int i); 169 int qemu_fdatasync(int fd); 170 171 /* path.c */ 172 void init_paths(const char *prefix); 173 const char *path(const char *pathname); 152 174 153 175 #define qemu_isalnum(c) isalnum((unsigned char)(c)) … … 177 199 178 200 201 void qemu_mutex_lock_iothread(void); 202 void qemu_mutex_unlock_iothread(void); 203 204 int qemu_open(const char *name, int flags, ...); 205 void qemu_set_cloexec(int fd); 206 207 #ifndef _WIN32 208 int qemu_pipe(int pipefd[2]); 209 #endif 210 179 211 /* Error handling. */ 180 212 … … 208 240 typedef TextConsole QEMUConsole; 209 241 typedef struct CharDriverState CharDriverState; 242 typedef struct MACAddr MACAddr; 210 243 typedef struct VLANState VLANState; 244 typedef struct VLANClientState VLANClientState; 211 245 typedef struct QEMUFile QEMUFile; 212 246 typedef struct i2c_bus i2c_bus; … … 214 248 typedef struct SMBusDevice SMBusDevice; 215 249 typedef struct QEMUTimer QEMUTimer; 250 typedef struct PCIHostState PCIHostState; 251 typedef struct PCIExpressHost PCIExpressHost; 216 252 typedef struct PCIBus PCIBus; 217 253 typedef struct PCIDevice PCIDevice; … … 255 291 void qemu_iovec_init_external(QEMUIOVector *qiov, struct iovec *iov, int niov); 256 292 void qemu_iovec_add(QEMUIOVector *qiov, void *base, size_t len); 293 void qemu_iovec_concat(QEMUIOVector *dst, QEMUIOVector *src, size_t size); 257 294 void qemu_iovec_destroy(QEMUIOVector *qiov); 258 295 void qemu_iovec_reset(QEMUIOVector *qiov); … … 263 300 typedef struct Monitor Monitor; 264 301 302 /* Convert a byte between binary and BCD. */ 303 static inline uint8_t to_bcd(uint8_t val) 304 { 305 return ((val / 10) << 4) | (val % 10); 306 } 307 308 static inline uint8_t from_bcd(uint8_t val) 309 { 310 return ((val >> 4) * 10) + (val & 0x0f); 311 } 312 265 313 #include "module.h" 266 314
Note:
See TracChangeset
for help on using the changeset viewer.