home *** CD-ROM | disk | FTP | other *** search
Text File | 2007-02-09 | 1015.5 KB | 9,090 lines |
- f
-
-
- /*
- * Annotation for data that may be exported into a DLL and used by other
- * apps that load that DLL and import the data.
- */
- #if defined(_WIN32) && defined(VMX86_IMPORT_DLLDATA)
- # define VMX86_EXTERN_DATA extern __declspec(dllimport)
- #else // !_WIN32
- # define VMX86_EXTERN_DATA extern
- #endif
-
- #if defined(_WIN32) && !defined(VMX86_NO_THREADS)
- #define THREADSPECIFIC __declspec(thread)
- #else
- #define THREADSPECIFIC
- #endif
-
-
- /*
- * Consider the following reasons functions are inlined:
- *
- * 1) inlined for performance reasons
- * 2) inlined because it's a single-use function
- *
- * Functions which meet only condition 2 should be marked with this
- * inline macro; It is not critical to be inlined (but there is a
- * code-space & runtime savings by doing so), so when other callers
- * are added the inline-ness should be removed.
- */
-
- #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
- /*
- * Starting at version 3.3, gcc does not always inline functions marked
- * 'inline' (it depends on their size). To force gcc to do so, one must use the
- * extra __always_inline__ attribute.
- */
- # define INLINE_SINGLE_CALLER INLINE __attribute__((__always_inline__))
- # if defined(VMM) \
- && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 4))
- # warning Verify INLINE_SINGLE_CALLER '__always_inline__' attribute (did \
- monitor size change?)
- # endif
- #else
- # define INLINE_SINGLE_CALLER INLINE
- #endif
-
- /*
- * Used when a hard guaranteed of no inlining is needed. Very few
- * instances need this since the absence of INLINE is a good hint
- * that gcc will not do inlining.
- */
-
- #if defined(__GNUC__) && defined(VMM)
- #define ABSOLUTELY_NOINLINE __attribute__((__noinline__))
- #endif
-
- /*
- * Attributes placed on function declarations to tell the compiler
- * that the function never returns.
- */
-
- #ifdef _MSC_VER
- #define NORETURN __declspec(noreturn)
- #elif __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 9)
- #define NORETURN __attribute__((__noreturn__))
- #else
- #define NORETURN
- #endif
-
- /*
- * GCC 3.2 inline asm needs the + constraint for input/ouput memory operands.
- * Older GCCs don't know about it --hpreg
- */
-
- #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
- # define VM_ASM_PLUS 1
- #else
- # define VM_ASM_PLUS 0
- #endif
-
- /*
- * Branch prediction hints:
- * LIKELY(exp) - Expression exp is likely TRUE.
- * UNLIKELY(exp) - Expression exp is likely FALSE.
- * Usage example:
- * if (LIKELY(excCode == EXC_NONE)) {
- * or
- * if (UNLIKELY(REAL_MODE(vc))) {
- *
- * We know how to predict branches on gcc3 and later (hopefully),
- * all others we don't so we do nothing.
- */
-
- #if (__GNUC__ >= 3)
- /*
- * gcc3 uses __builtin_expect() to inform the compiler of an expected value.
- * We use this to inform the static branch predictor. The '!!' in LIKELY
- * will convert any !=0 to a 1.
- */
- #define LIKELY(_exp) __builtin_expect(!!(_exp), 1)
- #define UNLIKELY(_exp) __builtin_expect((_exp), 0)
- #else
- #define LIKELY(_exp) (_exp)
- #define UNLIKELY(_exp) (_exp)
- #endif
-
- /*
- * GCC's argument checking for printf-like functions
- * This is conditional until we have replaced all `"%x", void *'
- * with `"0x%08x", (uint32) void *'. Note that %p prints different things
- * on different platforms. Argument checking is enabled for the
- * vmkernel, which has already been cleansed.
- *
- * fmtPos is the position of the format string argument, beginning at 1
- * varPos is the position of the variable argument, beginning at 1
- */
-
- #if defined(__GNUC__)
- # define PRINTF_DECL(fmtPos, varPos) __attribute__((__format__(__printf__, fmtPos, varPos)))
- #else
- # define PRINTF_DECL(fmtPos, varPos)
- #endif
-
- /*
- * UNUSED_PARAM should surround the parameter name and type declaration,
- * e.g. "int MyFunction(int var1, UNUSED_PARAM(int var2))"
- *
- */
-
- #if defined(__GNUC__)
- # define UNUSED_PARAM(_parm) _parm __attribute__((__unused__))
- #else
- # define UNUSED_PARAM(_parm) _parm
- #endif
-
- /*
- * REGPARM defaults to REGPARM3, i.e., a requent that gcc
- * puts the first three arguments in registers. (It is fine
- * if the function has fewer than three args.) Gcc only.
- * Syntactically, put REGPARM where you'd put INLINE or NORETURN.
- */
-
- #if defined(__GNUC__)
- # define REGPARM0 __attribute__((regparm(0)))
- # define REGPARM1 __attribute__((regparm(1)))
- # define REGPARM2 __attribute__((regparm(2)))
- # define REGPARM3 __attribute__((regparm(3)))
- # define REGPARM REGPARM3
- #else
- # define REGPARM0
- # define REGPARM1
- # define REGPARM2
- # define REGPARM3
- # define REGPARM
- #endif
-
-
- /*
- * Once upon a time, this was used to silence compiler warnings that
- * get generated when the compiler thinks that a function returns
- * when it is marked noreturn. Don't do it. Use NOT_REACHED().
- */
-
- #define INFINITE_LOOP() do { } while (1)
-
- /*
- * On FreeBSD (for the tools build), size_t is typedef'd if _BSD_SIZE_T_
- * is defined. Use the same logic here so we don't define it twice. [greg]
- */
- #ifdef __FreeBSD__
- # ifdef _BSD_SIZE_T_
- # undef _BSD_SIZE_T_
- # ifdef VM_I386
- # ifdef VM_X86_64
- typedef uint64 size_t;
- # else
- typedef uint32 size_t;
- # endif
- # endif /* VM_I386 */
-
- # ifdef VM_IA64
- typedef uint64 size_t;
- # endif
- # endif
- #else
- # ifndef _SIZE_T
- # define _SIZE_T
- # ifdef VM_I386
- # ifdef VM_X86_64
- typedef uint64 size_t;
- # else
- typedef uint32 size_t;
- # endif
- # endif /* VM_I386 */
-
- # ifdef VM_IA64
- typedef uint64 size_t;
- # endif
- # endif
- #endif
-
- /*
- * Format modifier for printing pid_t. On sun the pid_t is a ulong, but on
- * Linux it's an int.
- * Use this like this: printf("The pid is %"FMTPID".\n", pid);
- */
- #ifdef sun
- # define FMTPID "lu"
- #else
- # define FMTPID "d"
- #endif
-
- #endif /* _VM_BASIC_TYPES_H_ */
- MZÉ ╕ @ ║ ┤ ═!╕L╨!╕L╨!╕L╨!╕L╨!╕L╨!╕L╨!╕L╨!╕L╨!╕L╨!╕L╨!╕L╨!╕L╨!╕L╨!╕L╨!╕L╨!╕L╨!╕L╨!╕L╨!╕L╨!╕L╨!╕NOR__ >= L╨ !╕(_p╕LSOLL╨ NOR__ >= L╨ !╕L╨ dif SOLgcc ╨!╕ >=!╕╨ !╕L╨╨ A SOLgcc ╨iE _ >E╨ gcc(L╨╨ A SO╨!╕c ╨iE _ ╨!╕╨ g╨ E╨╨ iE(O╨!╕c ╨OR_ _ ╨!╕╨ g╨(EE╨╨(L╨E(O╨_ ╨( ╨OR_ _>= ╕╨ g╨(EE╨╨("FMTP╨_ ' ╨OR_