VirtualBox

Changeset 37675 in vbox for trunk/src/recompiler/osdep.h


Ignore:
Timestamp:
Jun 29, 2011 7:07:14 AM (13 years ago)
Author:
vboxsync
Message:

rem: Synced with v0.12.5.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/recompiler/osdep.h

    r36172 r37675  
    2020#define qemu_vprintf(pszFormat, args) \
    2121                                RTLogPrintfV((pszFormat), (args))
    22 #define qemu_printf             RTLogPrintf
     22
     23/**@todo the following macros belongs elsewhere */
    2324#define qemu_malloc(cb)         RTMemAlloc(cb)
    2425#define qemu_mallocz(cb)        RTMemAllocZ(cb)
    2526#define qemu_realloc(ptr, cb)   RTMemRealloc(ptr, cb)
    26 
    2727#define qemu_free(pv)           RTMemFree(pv)
    2828#define qemu_strdup(psz)        RTStrDup(psz)
    2929
    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 */
    3731#define fflush(file)            RTLogFlush(NULL)
    3832#define printf(...)             LogIt(LOG_INSTANCE, 0, LOG_GROUP_REM_PRINTF, (__VA_ARGS__))
     
    4236#endif
    4337
    44 #define assert(cond) Assert(cond)
     38#define assert(cond)            Assert(cond)
    4539
    4640#else /* !VBOX */
    4741
    4842#include <stdarg.h>
     43#include <stddef.h>
    4944
    50 #define VBOX_ONLY(x)
    51 
     45#define VBOX_ONLY(x)             /* nike */
    5246#define qemu_snprintf snprintf   /* bird */
    5347#define qemu_vsnprintf vsnprintf /* bird */
    5448#define qemu_vprintf vprintf     /* bird */
    55 
    56 #define qemu_printf printf
    57 
    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);
    6749
    6850#endif /* !VBOX */
     
    9577#endif
    9678
    97 #ifndef offsetof
     79#ifdef CONFIG_NEED_OFFSETOF
    9880#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER)
    9981#endif
     
    10385        (type *) ((char *) __mptr - offsetof(type, member));})
    10486#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)
    105100
    106101#ifndef MIN
     
    116111
    117112#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__))
    122114#ifdef __OPTIMIZE__
    123 #define inline always_inline
     115#define inline __attribute__ (( always_inline )) __inline__
    124116#endif
    125117#endif
     
    136128#ifndef VBOX
    137129#define qemu_printf printf
    138 #endif
     130#else  /*VBOX*/
     131#define qemu_printf RTLogPrintf
     132#endif /*VBOX*/
    139133
    140134#if defined (__GNUC__) && defined (__GNUC_MINOR__)
     
    165159#endif /* !_WIN32 */
    166160#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)
    168164#endif /* VBOX */
    169165
Note: See TracChangeset for help on using the changeset viewer.

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