Changeset 37675 in vbox for trunk/src/recompiler/osdep.h
- Timestamp:
- Jun 29, 2011 7:07:14 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/recompiler/osdep.h
r36172 r37675 20 20 #define qemu_vprintf(pszFormat, args) \ 21 21 RTLogPrintfV((pszFormat), (args)) 22 #define qemu_printf RTLogPrintf 22 23 /**@todo the following macros belongs elsewhere */ 23 24 #define qemu_malloc(cb) RTMemAlloc(cb) 24 25 #define qemu_mallocz(cb) RTMemAllocZ(cb) 25 26 #define qemu_realloc(ptr, cb) RTMemRealloc(ptr, cb) 26 27 27 #define qemu_free(pv) RTMemFree(pv) 28 28 #define qemu_strdup(psz) RTStrDup(psz) 29 29 30 #define qemu_vmalloc(cb) RTMemPageAlloc(cb) 31 #define qemu_vfree(pv) RTMemPageFree(pv, missing_size_parameter) 32 33 #ifndef NULL 34 # define NULL 0 35 #endif 36 30 /* Misc wrappers */ 37 31 #define fflush(file) RTLogFlush(NULL) 38 32 #define printf(...) LogIt(LOG_INSTANCE, 0, LOG_GROUP_REM_PRINTF, (__VA_ARGS__)) … … 42 36 #endif 43 37 44 #define assert(cond) Assert(cond)38 #define assert(cond) Assert(cond) 45 39 46 40 #else /* !VBOX */ 47 41 48 42 #include <stdarg.h> 43 #include <stddef.h> 49 44 50 #define VBOX_ONLY(x) 51 45 #define VBOX_ONLY(x) /* nike */ 52 46 #define qemu_snprintf snprintf /* bird */ 53 47 #define qemu_vsnprintf vsnprintf /* bird */ 54 48 #define qemu_vprintf vprintf /* bird */ 55 56 #define qemu_printf printf57 58 void *qemu_malloc(size_t size);59 void *qemu_mallocz(size_t size);60 void qemu_free(void *ptr);61 char *qemu_strdup(const char *str);62 63 void *qemu_vmalloc(size_t size);64 void qemu_vfree(void *ptr);65 66 void *get_mmap_addr(unsigned long size);67 49 68 50 #endif /* !VBOX */ … … 95 77 #endif 96 78 97 #if ndef offsetof79 #ifdef CONFIG_NEED_OFFSETOF 98 80 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER) 99 81 #endif … … 103 85 (type *) ((char *) __mptr - offsetof(type, member));}) 104 86 #endif 87 88 /* Convert from a base type to a parent type, with compile time checking. */ 89 #ifdef __GNUC__ 90 #define DO_UPCAST(type, field, dev) ( __extension__ ( { \ 91 char __attribute__((unused)) offset_must_be_zero[ \ 92 -offsetof(type, field)]; \ 93 container_of(dev, type, field);})) 94 #else 95 #define DO_UPCAST(type, field, dev) container_of(dev, type, field) 96 #endif 97 98 #define typeof_field(type, field) typeof(((type *)0)->field) 99 #define type_check(t1,t2) ((t1*)0 - (t2*)0) 105 100 106 101 #ifndef MIN … … 116 111 117 112 #ifndef always_inline 118 #if (__GNUC__ < 3) || defined(__APPLE__) 119 #define always_inline inline 120 #else 121 #define always_inline __attribute__ (( always_inline )) __inline__ 113 #if !((__GNUC__ < 3) || defined(__APPLE__)) 122 114 #ifdef __OPTIMIZE__ 123 #define inline always_inline115 #define inline __attribute__ (( always_inline )) __inline__ 124 116 #endif 125 117 #endif … … 136 128 #ifndef VBOX 137 129 #define qemu_printf printf 138 #endif 130 #else /*VBOX*/ 131 #define qemu_printf RTLogPrintf 132 #endif /*VBOX*/ 139 133 140 134 #if defined (__GNUC__) && defined (__GNUC_MINOR__) … … 165 159 #endif /* !_WIN32 */ 166 160 #else /* VBOX */ 167 # define qemu_memalign(alignment, size) ( (alignment) <= PAGE_SIZE ? RTMemPageAlloc((size)) : NULL ) 161 # define qemu_memalign(alignment, size) ( (alignment) <= PAGE_SIZE ? RTMemPageAlloc((size)) : NULL ) 162 # define qemu_vfree(pv) RTMemPageFree(pv, missing_size_parameter) 163 # define qemu_vmalloc(cb) RTMemPageAlloc(cb) 168 164 #endif /* VBOX */ 169 165
Note:
See TracChangeset
for help on using the changeset viewer.