VirtualBox

Changeset 658 in vbox


Ignore:
Timestamp:
Feb 6, 2007 2:07:48 AM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
18294
Message:

Moved the *ARCH_BITS stuff to cdefs.h.

Location:
trunk/include/iprt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/cdefs.h

    r647 r658  
    3333# if defined(__LINUX__) && defined(__KERNEL__)
    3434#  error "oops"
    35 # endif 
     35# endif
    3636# include <sys/cdefs.h>
    3737#else
     
    7373#define Breakpoint
    7474#define RT_NO_DEPRECATED_MACROS
     75#define ARCH_BITS
     76#define HC_ARCH_BITS
     77#define R3_ARCH_BITS
     78#define R0_ARCH_BITS
     79#define GC_ARCH_BITS
    7580#endif /* __DOXYGEN__ */
    7681
     
    8388 */
    8489#if !defined(__X86__) && !defined(__AMD64__)
    85 # if defined(__amd64__) || defined(_M_X64)
     90# if defined(__amd64__) || defined(__x86_64__) || defined(_M_X64)
    8691#  define __AMD64__
    8792# elif defined(__i386__) || defined(_M_IX86)
     
    9095#  error "Check what predefined stuff your compiler uses to indicate architecture."
    9196# endif
     97#elif defined(__X86__) && defined(__AMD64__)
     98# error "Both __X86__ and __AMD64__ cannot be defined at the same time!"
    9299#endif
    93100
     
    109116# error "You must defined which context the compiled code should run in; IN_RING3, IN_RING0 or IN_GC"
    110117#endif
     118#if (defined(IN_RING3) && (defined(IN_RING0) || defined(IN_GC)) ) \
     119 || (defined(IN_RING0) && (defined(IN_RING3) || defined(IN_GC)) ) \
     120 || (defined(IN_GC)    && (defined(IN_RING3) || defined(IN_RING0)) )
     121# error "Only one of the IN_RING3, IN_RING0, IN_GC defines should be defined."
     122#endif
     123
     124
     125/** @def ARCH_BITS
     126 * Defines the bit count of the current context.
     127 */
     128#ifndef ARCH_BITS
     129# if defined(__AMD64__)
     130#  define ARCH_BITS 64
     131# else
     132#  define ARCH_BITS 32
     133# endif
     134#endif
     135
     136/** @def HC_ARCH_BITS
     137 * Defines the host architechture bit count.
     138 */
     139#ifndef HC_ARCH_BITS
     140# ifndef IN_GC
     141#  define HC_ARCH_BITS ARCH_BITS
     142# else
     143#  define HC_ARCH_BITS 32
     144# endif
     145#endif
     146
     147/** @def R3_ARCH_BITS
     148 * Defines the host ring-3 architechture bit count.
     149 */
     150#ifndef R3_ARCH_BITS
     151# ifdef IN_RING3
     152#  define R3_ARCH_BITS ARCH_BITS
     153# else
     154#  define R3_ARCH_BITS HC_ARCH_BITS
     155# endif
     156#endif
     157
     158/** @def R0_ARCH_BITS
     159 * Defines the host ring-0 architechture bit count.
     160 */
     161#ifndef R0_ARCH_BITS
     162# ifdef IN_RING0
     163#  define R0_ARCH_BITS ARCH_BITS
     164# else
     165#  define R0_ARCH_BITS HC_ARCH_BITS
     166# endif
     167#endif
     168
     169/** @def GC_ARCH_BITS
     170 * Defines the guest architechture bit count.
     171 */
     172#ifndef GC_ARCH_BITS
     173# ifdef IN_GC
     174#  define GC_ARCH_BITS ARCH_BITS
     175# else
     176#  define GC_ARCH_BITS 32
     177# endif
     178#endif
     179
    111180
    112181/** @def CTXTYPE
     
    460529/** @def IN_RT_R3
    461530 * Used to indicate whether we're inside the same link module as
    462  * the HC Ring-3 Runtime Library. 
     531 * the HC Ring-3 Runtime Library.
    463532 */
    464533/** @def RTR3DECL(type)
     
    511580/** @def RT_NOCRT
    512581 * Symbol name wrapper for the No-CRT bits.
    513  * 
    514  * In order to coexist in the same process as other CRTs, we need to 
     582 *
     583 * In order to coexist in the same process as other CRTs, we need to
    515584 * decorate the symbols such that they don't conflict the ones in the
    516585 * other CRTs. The result of such conflicts / duplicate symbols can
    517586 * confuse the dynamic loader on unix like systems.
    518  * 
     587 *
    519588 * Define RT_WITHOUT_NOCRT_WRAPPERS to drop the wrapping.
    520589 */
     
    528597# define RT_NOCRT(name) name
    529598# define RT_NOCRT_STR(name) #name
    530 #endif 
     599#endif
    531600
    532601
     
    10371106#   define VALID_PTR(ptr)   (   (uintptr_t)(ptr) + 0x1000U >= 0x2000U \
    10381107                             && !((uintptr_t)(ptr) & 0xffff800000000000ULL) )
    1039 #  endif               
     1108#  endif
    10401109# else /* !IN_RING3 */
    10411110#  define VALID_PTR(ptr)    (   (uintptr_t)(ptr) + 0x1000U >= 0x2000U \
     
    10461115# define VALID_PTR(ptr)     ( (uintptr_t)(ptr) + 0x1000U >= 0x2000U )
    10471116#else
    1048 # error "Architecture identifier missing / not implemented." 
     1117# error "Architecture identifier missing / not implemented."
    10491118#endif
    10501119
  • trunk/include/iprt/types.h

    r653 r658  
    342342 */
    343343
    344 /** @def ARCH_BITS
    345  * Defines the bit count of the current context.
    346  */
    347 #ifndef ARCH_BITS
    348 # if defined(__x86_64__) || defined(__amd64__) || defined(_M_X64) || defined(_M_IA64) || defined(__AMD64__)
    349 #  define ARCH_BITS 64
    350 # else
    351 #  define ARCH_BITS 32
    352 # endif
    353 #endif
    354 
    355 /** @def HC_ARCH_BITS
    356  * Defines the host architechture bit count.
    357  */
    358 #ifndef HC_ARCH_BITS
    359 # ifndef IN_GC
    360 #  define HC_ARCH_BITS ARCH_BITS
    361 # else
    362 #  define HC_ARCH_BITS 32
    363 # endif
    364 #endif
    365 
    366 /** @def R3_ARCH_BITS
    367  * Defines the host ring-3 architechture bit count.
    368  */
    369 #ifndef R3_ARCH_BITS
    370 # ifdef IN_RING3
    371 #  define R3_ARCH_BITS ARCH_BITS
    372 # else
    373 #  define R3_ARCH_BITS HC_ARCH_BITS
    374 # endif
    375 #endif
    376 
    377 /** @def R0_ARCH_BITS
    378  * Defines the host ring-0 architechture bit count.
    379  */
    380 #ifndef R0_ARCH_BITS
    381 # ifdef IN_RING0
    382 #  define R0_ARCH_BITS ARCH_BITS
    383 # else
    384 #  define R0_ARCH_BITS HC_ARCH_BITS
    385 # endif
    386 #endif
    387 
    388 /** @def GC_ARCH_BITS
    389  * Defines the guest architechture bit count.
    390  */
    391 #ifndef GC_ARCH_BITS
    392 # ifdef IN_GC
    393 #  define GC_ARCH_BITS ARCH_BITS
    394 # else
    395 #  define GC_ARCH_BITS 32
    396 # endif
    397 #endif
    398 
    399 
    400344/** Signed integer which can contain both GC and HC pointers. */
    401345#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32)
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